geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/assembly/src/plan system-plan.xml
Date Thu, 02 Sep 2004 01:06:51 GMT
djencks     2004/09/01 18:06:51

  Modified:    modules/naming project.xml
               modules/assembly/src/plan system-plan.xml
  Added:       modules/system/src/java/org/apache/geronimo/system/properties
                        NamingProperties.java
               modules/system/src/test/org/apache/geronimo/system/properties
                        NamingPropertiesTest.java
  Removed:     modules/core/src/conf jndi.properties
               modules/core/src/test-data jndi.properties
  Log:
  GBean for properties to set up jndi properly.  Remove use of jndi.properties files except
in testing and remove unused jndi.property copies
  
  Revision  Changes    Path
  1.16      +1 -7      incubator-geronimo/modules/naming/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/naming/project.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- project.xml	1 Sep 2004 16:39:32 -0000	1.15
  +++ project.xml	2 Sep 2004 01:06:50 -0000	1.16
  @@ -120,12 +120,6 @@
   
       <build>
           <resources>
  -            <resource>
  -                <directory>${basedir}/src/test-data</directory>
  -                <includes>
  -                    <include>*.properties</include>
  -                </includes>
  -            </resource>
           </resources>
           <unitTest>
              <includes>
  
  
  
  1.1                  incubator-geronimo/modules/system/src/java/org/apache/geronimo/system/properties/NamingProperties.java
  
  Index: NamingProperties.java
  ===================================================================
  package org.apache.geronimo.system.properties;
  
  import org.apache.geronimo.gbean.GBeanInfo;
  import org.apache.geronimo.gbean.GBeanInfoFactory;
  
  /** java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
  java.naming.factory.url.pkgs=org.apache.geronimo.naming
  java.naming.provider.url=rmi://localhost:1099
  
   */
  public class NamingProperties {
  
      static final String JAVA_NAMING_FACTORY_INITIAL = "java.naming.factory.initial";
      static final String JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
      static final String JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
  
      public NamingProperties(String namingFactoryInitial, String namingFactoryUrlPkgs, String
namingProviderUrl) {
          setNamingFactoryInitial(namingFactoryInitial);
          setNamingFactoryUrlPkgs(namingFactoryUrlPkgs);
          setNamingProviderUrl(namingProviderUrl);
      }
  
      public String getNamingFactoryInitial() {
          return System.getProperty(JAVA_NAMING_FACTORY_INITIAL);
      }
  
      public void setNamingFactoryInitial(String namingFactoryInitial) {
          System.setProperty(JAVA_NAMING_FACTORY_INITIAL, namingFactoryInitial);
      }
  
      public String getNamingFactoryUrlPkgs() {
          return System.getProperty(JAVA_NAMING_FACTORY_URL_PKGS);
      }
  
      public void setNamingFactoryUrlPkgs(String namingFactoryUrlPkgs) {
          System.setProperty(JAVA_NAMING_FACTORY_URL_PKGS, namingFactoryUrlPkgs);
      }
  
      public String getNamingProviderUrl() {
          return System.getProperty(JAVA_NAMING_PROVIDER_URL);
      }
  
      public void setNamingProviderUrl(String namingProviderUrl) {
          System.setProperty(JAVA_NAMING_PROVIDER_URL, namingProviderUrl);
      }
  
      public static final GBeanInfo gbeanInfo;
  
      static {
          GBeanInfoFactory infoFactory = new GBeanInfoFactory(NamingProperties.class);
          infoFactory.addAttribute("namingFactoryInitial", String.class, true);
          infoFactory.addAttribute("namingFactoryUrlPkgs", String.class, true);
          infoFactory.addAttribute("namingProviderUrl", String.class, true);
  
          infoFactory.setConstructor(new String[] {"namingFactoryInitial", "namingFactoryUrlPkgs",
"namingProviderUrl"});
  
          gbeanInfo = infoFactory.getBeanInfo();
      }
  
      public static GBeanInfo getGBeanInfo() {
          return gbeanInfo;
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/system/src/test/org/apache/geronimo/system/properties/NamingPropertiesTest.java
  
  Index: NamingPropertiesTest.java
  ===================================================================
  package org.apache.geronimo.system.properties;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  
  import junit.framework.TestCase;
  
  /**
   */
  public class NamingPropertiesTest extends TestCase {
      private static final String NAMING_FACTORY_INITIAL = "com.sun.jndi.rmi.registry.RegistryContextFactory";
      private static final String FACTORY_URL_PKGS = "org.apache.geronimo.naming";
      private static final String PROVIDER_URL = "rmi://localhost:1099";
  
      public void testNamingFactoryInitial() throws Exception {
  
          assertNull(this.getClass().getClassLoader().getResource("jndi.properties"));
  
          try {
              new InitialContext();
              System.out.println("Something is wrong, initial context can be constructed");
  //            fail();
          } catch (NamingException ne) {
              //expected
          }
          assertNull(System.getProperty(NamingProperties.JAVA_NAMING_FACTORY_INITIAL));
          assertNull(System.getProperty(NamingProperties.JAVA_NAMING_FACTORY_URL_PKGS));
          assertNull(System.getProperty(NamingProperties.JAVA_NAMING_PROVIDER_URL));
          NamingProperties namingProperties = new NamingProperties(NAMING_FACTORY_INITIAL,
FACTORY_URL_PKGS, PROVIDER_URL);
          assertEquals(System.getProperty(NamingProperties.JAVA_NAMING_FACTORY_INITIAL), NAMING_FACTORY_INITIAL);
          assertEquals(System.getProperty(NamingProperties.JAVA_NAMING_FACTORY_URL_PKGS),
FACTORY_URL_PKGS);
          assertEquals(System.getProperty(NamingProperties.JAVA_NAMING_PROVIDER_URL), PROVIDER_URL);
  
          assertEquals(namingProperties.getNamingFactoryInitial(), NAMING_FACTORY_INITIAL);
          assertEquals(namingProperties.getNamingFactoryUrlPkgs(), FACTORY_URL_PKGS);
          assertEquals(namingProperties.getNamingProviderUrl(), PROVIDER_URL);
  
          new InitialContext();
  
      }
  }
  
  
  
  1.12      +8 -0      incubator-geronimo/modules/assembly/src/plan/system-plan.xml
  
  Index: system-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/system-plan.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- system-plan.xml	12 Jul 2004 06:07:50 -0000	1.11
  +++ system-plan.xml	2 Sep 2004 01:06:51 -0000	1.12
  @@ -85,4 +85,12 @@
       <gbean name="geronimo.server:role=RMIRegistry" class="org.apache.geronimo.system.RMIRegistryService">
           <attribute name="port" type="int">1099</attribute>
       </gbean>
  +
  +    <!-- Naming properties -->
  +    <gbean name="geronimo.server:role=NamingProperties" class="org.apache.geronimo.system.properties.NamingProperties">
  +        <attribute name="namingFactoryInitial" type="java.lang.String">com.sun.jndi.rmi.registry.RegistryContextFactory</attribute>
  +        <attribute name="namingFactoryUrlPkgs" type="java.lang.String">org.apache.geronimo.naming</attribute>
  +        <attribute name="namingProviderUrl" type="java.lang.String">rmi://localhost:1099</attribute>
  +    </gbean>
  +    
   </configuration>
  
  
  

Mime
View raw message