User: starksm 
  Date: 01/04/26 00:50:51

  Modified:    src/main/org/jnp/client Main.java
  Log:
  Fix bug 419015 and rmiPort externalization.
  
  Revision  Changes    Path
  1.5       +39 -21    jnp/src/main/org/jnp/client/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /cvsroot/jboss/jnp/src/main/org/jnp/client/Main.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Main.java 2001/04/23 06:42:32     1.4
  +++ Main.java 2001/04/26 07:50:51     1.5
  @@ -29,20 +29,16 @@
    *   in various ways to test the functionality.
    *
    *   The JNDI configuration is provided in the jndi.properties file.
  - *      
  + *
    *   @see NamingContext
  - *   @author $Author: starksm $
  + *   @author oberg
    *   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.5 $
    */
   public class Main
      implements Runnable
   {
  -   // Constants -----------------------------------------------------
  -    
  -   // Attributes ----------------------------------------------------
  -      
  -   // Static --------------------------------------------------------
  +    org.jnp.server.Main remoteServer;
   
      /**
       *   Start the test
  @@ -50,12 +46,16 @@
       * @param   args  
       * @exception   Exception  
       */
  -   public static void main(String[] args)
  +    public static void main(String[] args)
         throws Exception
  -   {
  -      new Main().run();
  -   }
  -   
  +    {
  +       System.setProperty("java.naming.factory.initial", 
"org.jnp.interfaces.NamingContextFactory");
  +       System.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");
  +       System.setProperty("java.naming.provider.url", "localhost");
  +       System.setErr(System.out);
  +       new Main().run();
  +    }
  +
      // Constructors --------------------------------------------------
   
      // Public --------------------------------------------------------
  @@ -208,7 +208,6 @@
            }
            
            showTree(ctx);
  -         iniCtx.close();
   
            // Create an initial context that is rooted at /test
            Properties env = new Properties();
  @@ -232,20 +231,39 @@
            server = ctx.lookup("test/server");
            System.out.println("+ PROVIDER_URL=jnp://localhost:1099/ 
lookup(test/server):"+server);
   
  +         // Test accessing a remote by accessing a non-default local server
  +         runRemoteServer();
  +         System.out.println("+++ Started second jnp server on port 10099");
  +         test = (Context) iniCtx.lookup("test");
  +         showTree(test);
  +
  +         env = new Properties();
  +         env.setProperty(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory");
  +         env.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
  +         ctx = (Context) new InitialContext(env).lookup("jnp://localhost:10099/");
  +         System.out.println(ctx.getEnvironment());
  +         // Create subcontext
  +         test = ctx.createSubcontext("test2");
  +         System.out.println("10099 test2 created:"+test);
  +         System.out.println("10099 test2.env:"+test.getEnvironment());
  +         test.bind("external", new LinkRef("jnp://localhost:1099/test"));
  +         Context external = (Context) new 
InitialContext(env).lookup("jnp://localhost:10099/test2/external");
  +         System.out.println("jnp://localhost:10099/test2 = "+external);
  +         System.out.println("jnp://localhost:10099/test2.env = 
"+external.getEnvironment());
  +         remoteServer.stop();
         }
         catch (Exception e)
         {
            e.printStackTrace(System.err);
         } 
      }
  -    
  -   // Y overrides ---------------------------------------------------
   
  -   // Package protected ---------------------------------------------
  -    
  -   // Protected -----------------------------------------------------
  -    
  -   // Private -------------------------------------------------------
  +   private void runRemoteServer() throws Exception
  +   {
  +       remoteServer = new org.jnp.server.Main();
  +       remoteServer.setPort(10099);
  +       remoteServer.start();
  +   }
   
      /**
       *   Print the contents of a JNDI context recursively
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to