4.3.0: Issues with plugin unit testing; oracle plugin integration

Ian Springer ian.springer at redhat.com
Thu Nov 3 17:56:12 UTC 2011


Hi,

Have you looked at some of the other plugins that have integration tests 
(e.g. the jboss-as plugin)? In those, we do a bunch of filesystem setup 
for the tests to make sure the plugin container can find the plugin 
being tested, other dependent plugins, and the platform plugin (which is 
always required), as well as the SIGAR native libs.

I'd look closely at jboss-as/pom.xml, as well as the JBossASPluginTest 
class, and see if there's anything being done there that you also need 
to do.

Cheers,
Ian

On 11/03/2011 01:47 PM, Elias Ross wrote:
> I'm working on improving the Oracle plugin and wrote a unit test to
> test against my database. The test runs fine within Eclipse but within
> Maven,
> I run into issues.
>
> At the moment, I am seeing this:
>
> Caused by: java.lang.IllegalArgumentException: interface
> org.rhq.core.pluginapi.inventory.ResourceComponent is not visible from
> class loader
> 	at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
> 	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
> 	at org.rhq.core.pc.inventory.ResourceContainer.createResourceComponentProxy(ResourceContainer.java:381)
> 	at org.rhq.core.pc.inventory.InventoryManager.activateResource(InventoryManager.java:1576)
> 	at org.rhq.core.pc.inventory.InventoryManager.mergeResourceFromDiscovery(InventoryManager.java:1354)
> 	at org.rhq.core.pc.inventory.InventoryManager.executePlatformScan(InventoryManager.java:505)
> 	at org.rhq.core.pc.inventory.InventoryManager.initialize(InventoryManager.java:226)
> 	at org.rhq.core.pc.PluginContainer.startContainerService(PluginContainer.java:431)
> 	at org.rhq.core.pc.PluginContainer.initialize(PluginContainer.java:282)
> 	at org.rhq.plugins.oracle.ComponentTest.<init>(ComponentTest.java:96)
> 	at org.rhq.plugins.oracle.OracleServerComponentTest.<init>(OracleServerComponentTest.java:19)
> 	... 34 more
>
> Here is the relevant code. I imagine this is due to the
> 'pluginClassLoader' not having a reference to the API class.
>
> public class ResourceContainer implements Serializable {
>
>                  ClassLoader pluginClassLoader =
> this.resourceContainer.getResourceClassLoader();
>                  if (pluginClassLoader == null) {
>                      throw new IllegalStateException("No plugin class
> loader was specified for " + this + ".");
>                  }
>                  Thread.currentThread().setContextClassLoader(pluginClassLoader);
>
> I'm also wondering how to integrate the unit tests for this plugin, as
> it depends on an actual Oracle database as well as configuration
> details.
>
> Currently I invoke using:
>
> mvn -Poracle-test -Doracle.url=jdbc:oracle:thin:@hostname:1521/sid
> -Doracle.username=user -Doracle.password=pw
>
> If you don't plan on having this sort of testing automated, then it
> might make sense to require users to manually invoke, and I will
> disable the tests by default. I thought of centralizing this sort of
> config but: 1) It's a lot of work 2) And doesn't really have much
> value outside of this one plugin.
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel


-- 
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer at redhat.com



More information about the rhq-devel mailing list