[jboss-jira] [JBoss JIRA] Closed: (JBRULES-139) TCK is not creating a classloader properly in org.jcp.jsr94.tck.util.TestCaseUtil

Mark Proctor (JIRA) jira-events at lists.jboss.org
Thu May 3 20:33:30 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-139?page=all ]

Mark Proctor closed JBRULES-139.
--------------------------------

    Fix Version/s: 3.0.6
                       (was:  4.0.0.MR3)
       Resolution: Done

> TCK is not creating a classloader properly in org.jcp.jsr94.tck.util.TestCaseUtil
> ---------------------------------------------------------------------------------
>
>                 Key: JBRULES-139
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-139
>             Project: JBoss Rules
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: JSR94
>         Environment: winXP
>            Reporter: Michael Frandsen
>         Assigned To: Mark Proctor
>            Priority: Minor
>             Fix For: 3.0.6
>
>
> TCK is not creating a classloader properly in org.jcp.jsr94.tck.util.TestCaseUtil
> Line 147-:
> /** This method complements the previous method. We suppose that the
>    * rule provider implementation classes are stored in stand-alone JAR
>    * files provided as URLs. The method creates a URLClassLoader, loads
>    * the RuleServiceProvider class from the class loader, then registers
>    * the object using the class loader.
>    *
>    * Note: we need to take care about the CLASSPATH when launching
>    * this test.
>    * 
>    * @param uri The registration name of this rule service provider.
>    * @param urls The URLs which provide the rule service provoider classes.
>    *
>    * @return The registered provider.
>    * 
>    */
>   public static RuleServiceProvider getRuleServiceProvider(String uri,
> 							   URL[] urls)
>     throws ClassNotFoundException, ConfigurationException
>   {
>     if (ruleServiceProvider == null) parseTckConfiguration();
>     
>     // Fail this test if no provider has been specified.
>     if (ruleServiceProvider == null)
>       throw new ClassNotFoundException("rule-service-provider not specified");
>     ClassLoader cl = new URLClassLoader(urls);
>     Class ruleServiceProviderClass = cl.loadClass(ruleServiceProvider);
>     TestCase.assertNotNull("[TestCaseUtil] Class loading on " +
> 			   ruleServiceProvider + " failed. ",
> 			   ruleServiceProviderClass);
>     // Register the provider.
>     RuleServiceProviderManager.registerRuleServiceProvider(uri,
> 							   ruleServiceProviderClass,cl);
>     // Retrieve and return the provider
>     return RuleServiceProviderManager.getRuleServiceProvider(uri);
>   }
> Should take in the constructor of the classloader: Thread.currentThread().getContextClassLoader(), else mvn´s surefire is getting problems:
>  public static RuleServiceProvider getRuleServiceProvider(String uri,
> 							   URL[] urls)
>     throws ClassNotFoundException, ConfigurationException
>   {
>     if (ruleServiceProvider == null) parseTckConfiguration();
>     
>     // Fail this test if no provider has been specified.
>     if (ruleServiceProvider == null)
>       throw new ClassNotFoundException("rule-service-provider not specified");
>     ClassLoader cl = new URLClassLoader(urls,Thread.currentThread().getContextClassLoader());
>     Class ruleServiceProviderClass = cl.loadClass(ruleServiceProvider);
>     TestCase.assertNotNull("[TestCaseUtil] Class loading on " +
> 			   ruleServiceProvider + " failed. ",
> 			   ruleServiceProviderClass);
>     // Register the provider.
>     RuleServiceProviderManager.registerRuleServiceProvider(uri,
> 							   ruleServiceProviderClass,cl);
>     // Retrieve and return the provider
>     return RuleServiceProviderManager.getRuleServiceProvider(uri);
>   }
> //This tip was given by "kenney" from #maven

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the jboss-jira mailing list