[jboss-remoting-commits] JBoss Remoting SVN: r4469 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/parentfirst.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Tue Aug 5 23:48:45 EDT 2008


Author: ron.sigal at jboss.com
Date: 2008-08-05 23:48:45 -0400 (Tue, 05 Aug 2008)
New Revision: 4469

Modified:
   remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/parentfirst/ParentFirstClassloaderTestCase.java
Log:
JBREM-1019: (1) Added testByInvokerLocator(); (2) in testBySystemProperty(), moved setting of system property to before client invoker is created.

Modified: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/parentfirst/ParentFirstClassloaderTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/parentfirst/ParentFirstClassloaderTestCase.java	2008-08-06 03:47:08 UTC (rev 4468)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/classloader/parentfirst/ParentFirstClassloaderTestCase.java	2008-08-06 03:48:45 UTC (rev 4469)
@@ -130,6 +130,46 @@
    /**
     * Verify that by the context classloader is called first if 
     * org.jboss.remoting.Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION is set to "true"
+    * in the InvokerLocator.
+    */
+   public void testByInvokerLocator() throws Throwable
+   {
+      log.info("entering " + getName());
+      
+      // Start server.
+      setupServer();
+      
+      // Create client.
+      String clientLocatorURI = locatorURI;
+      clientLocatorURI += "/?" + Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION + "=false";
+      InvokerLocator clientLocator = new InvokerLocator(clientLocatorURI);
+      HashMap clientConfig = new HashMap();
+      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+      addExtraClientConfig(clientConfig);
+      Client client = new Client(clientLocator, clientConfig);
+      client.connect();
+      log.info("client is connected");
+      
+      TestClassLoader tcl = new TestClassLoader();
+      setContextClassLoader(tcl);
+      
+      // Test connection.
+      client.invoke("abc");
+      log.info("connection is good");
+      
+      // Verify that TestClassLoader has been queried.
+      assertTrue(tcl.visited);
+      log.info("context classloader has been queried");
+      
+      client.disconnect();
+      shutdownServer();
+      log.info(getName() + " PASSES");
+   }
+   
+   
+   /**
+    * Verify that by the context classloader is called first if 
+    * org.jboss.remoting.Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION is set to "true"
     * in the config map.
     */
    public void testByConfigMap() throws Throwable
@@ -183,11 +223,11 @@
       HashMap clientConfig = new HashMap();
       clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
       addExtraClientConfig(clientConfig);
+      System.setProperty(Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION_PROP, "false");
       Client client = new Client(clientLocator, clientConfig);
       client.connect();
       log.info("client is connected");
       
-      System.setProperty(Remoting.CLASSLOADING_PARENT_FIRST_DELEGATION_PROP, "false");
       TestClassLoader tcl = new TestClassLoader();
       setContextClassLoader(tcl);
       




More information about the jboss-remoting-commits mailing list