[jboss-cvs] JBossAS SVN: r78907 - in projects/naming/trunk/jnpserver: src/test/java/org/jnp/test and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 26 21:05:49 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-09-26 21:05:49 -0400 (Fri, 26 Sep 2008)
New Revision: 78907

Added:
   projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
   projects/naming/trunk/jnpserver/src/test/resources/org/
   projects/naming/trunk/jnpserver/src/test/resources/org/jnp/
   projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/
   projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testLocaNamingBeanImpl.xml
   projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testSingletonNamingServer.xml
Modified:
   projects/naming/trunk/jnpserver/.classpath
   projects/naming/trunk/jnpserver/.project
   projects/naming/trunk/jnpserver/pom.xml
Log:
JBNAME-10, tests of using the naming server in the mc

Modified: projects/naming/trunk/jnpserver/.classpath
===================================================================
--- projects/naming/trunk/jnpserver/.classpath	2008-09-27 01:03:53 UTC (rev 78906)
+++ projects/naming/trunk/jnpserver/.classpath	2008-09-27 01:05:49 UTC (rev 78907)
@@ -1,13 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry kind="src" output="target/eclipse-test-classes" path="src/test/resources"/>
-	<classpathentry kind="src" output="target/eclipse-test-classes" path="src/test/java"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
-	<classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
-	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.3.GA/jboss-common-core-2.2.3.GA.jar"/>
-	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar"/>
-	<classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-log4j/2.0.4.GA/jboss-common-logging-log4j-2.0.4.GA.jar"/>
-	<classpathentry kind="output" path="target/eclipse-classes"/>
-</classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.8.GA/jboss-common-core-2.2.8.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.2.0-SNAPSHOT/jboss-dependency-2.2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.2.0-SNAPSHOT/jboss-dependency-2.2.0-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.2.0-SNAPSHOT/jboss-kernel-2.2.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.2.0-SNAPSHOT/jboss-kernel-2.2.0-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.0.CR1/jboss-mdr-2.0.0.CR1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.CR1/jboss-reflect-2.0.0.CR1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR13/jbossxb-2.0.0.CR13.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR13/jbossxb-2.0.0.CR13-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+</classpath>
\ No newline at end of file

Modified: projects/naming/trunk/jnpserver/.project
===================================================================
--- projects/naming/trunk/jnpserver/.project	2008-09-27 01:03:53 UTC (rev 78906)
+++ projects/naming/trunk/jnpserver/.project	2008-09-27 01:05:49 UTC (rev 78907)
@@ -1,18 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>jnpserver</name>
-	<comment></comment>
-	<projects>
-		<project>common</project>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
+  <name>jnpserver</name>
+  <comment>The JBoss JNDI Server</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Modified: projects/naming/trunk/jnpserver/pom.xml
===================================================================
--- projects/naming/trunk/jnpserver/pom.xml	2008-09-27 01:03:53 UTC (rev 78906)
+++ projects/naming/trunk/jnpserver/pom.xml	2008-09-27 01:05:49 UTC (rev 78907)
@@ -1,9 +1,11 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <!-- Parent -->
   <parent>
-     <groupId>org.jboss</groupId>
-     <artifactId>jboss-parent</artifactId>
-     <version>3</version>
+    <groupId>org.jboss</groupId>
+    <artifactId>jboss-parent</artifactId>
+    <version>4-beta-2</version>
   </parent>
+  
   <version>5.0.0-SNAPSHOT</version>   
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jboss.naming</groupId>
@@ -15,6 +17,12 @@
   <scm>
      <connection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/naming/trunk</connection>
   </scm>
+  <!-- Properties -->
+  <properties>
+    <version.org.jboss.common.core>2.2.8.GA</version.org.jboss.common.core>
+    <version.org.jboss.microcontainer>2.2.0-SNAPSHOT</version.org.jboss.microcontainer>
+  </properties>
+
   <build>
     <plugins>
       <plugin>
@@ -32,9 +40,9 @@
     <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core</artifactId>
-      <version>2.2.7.GA</version>
+      <version>${version.org.jboss.common.core}</version>
     </dependency>
-    
+
     <dependency>
       <groupId>org.jboss.logging</groupId>
       <artifactId>jboss-logging-spi</artifactId>
@@ -47,5 +55,17 @@
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-kernel</artifactId>
+      <version>${version.org.jboss.microcontainer}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.test</groupId>
+      <artifactId>jboss-test</artifactId>
+      <version>1.1.1.GA</version>
+    </dependency>
+    
   </dependencies>
-</project>
\ No newline at end of file
+</project>

Added: projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
===================================================================
--- projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	                        (rev 0)
+++ projects/naming/trunk/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	2008-09-27 01:05:49 UTC (rev 78907)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jnp.test;
+
+import java.math.BigInteger;
+import java.util.Properties;
+
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+
+/**
+ * Test bootstraping the naming service using the mc
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class NamingMCUnitTest extends MicrocontainerTest
+{
+   public static Test suite()
+   {
+      return suite(NamingMCUnitTest.class);
+   }
+   /** */
+   private InitialContext ctx;
+
+   /**
+    * 
+    * @param name
+    */
+   public NamingMCUnitTest(String name)
+   {
+      super(name, true);
+   }
+
+   /**
+    * Obtain the InitialContext from the InitialContextFactory bean ctx property.
+    * Each test expects an InitialContextFactory bean
+    * @see org.jboss.naming.InitialContextFactory
+    * 
+    * @param ctx
+    */
+   @Inject(bean="InitialContextFactory", property="ctx")
+   public void setInitialContext(InitialContext ctx)
+   {
+      this.ctx = ctx;
+   }
+
+   /**
+    * Validate that a NamingBeanImpl mc bean is accessible via the
+    * LocalOnlyContextFactory
+    * 
+    * @throws Exception
+    */
+   public void testLocaNamingBeanImpl()
+      throws Exception
+   {
+      assertNotNull(ctx);
+      validateCtx(ctx);
+   }
+
+   /**
+    * Validate that a SingletonNamingServer mc bean is accessible via the
+    * LocalOnlyContextFactory
+    * 
+    * @throws Exception
+    */
+   public void testSingletonNamingServer()
+      throws Exception
+   {
+      assertNotNull(ctx);
+      validateCtx(ctx);
+   }
+
+   /**
+    * 
+    * @param ic
+    * @throws Exception
+    */
+   protected void validateCtx(InitialContext ic)
+      throws Exception
+   {
+      Integer i1 = (Integer) ctx.lookup("ints/1");
+      assertEquals("ints/1", new Integer(1), i1);
+      String s1 = (String) ctx.lookup("strings/1");
+      assertEquals("strings/1", "String1", s1);
+      BigInteger bi1 = (BigInteger) ctx.lookup("bigint/1");
+      assertEquals("bigint/1", new BigInteger("123456789"), bi1);
+      Properties env = (Properties) ctx.lookup("env-props");
+      Properties expected = new Properties();
+      expected.setProperty("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
+      expected.setProperty("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");
+      assertEquals("env-props", expected, env);
+   }
+}

Added: projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testLocaNamingBeanImpl.xml
===================================================================
--- projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testLocaNamingBeanImpl.xml	                        (rev 0)
+++ projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testLocaNamingBeanImpl.xml	2008-09-27 01:05:49 UTC (rev 78907)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
+    xmlns="urn:jboss:bean-deployer:2.0">
+
+    <bean name="InitialContextFactory" class="org.jboss.naming.InitialContextFactoryBean">
+        <property name="env">
+            <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                <entry>
+                    <key>java.naming.factory.initial</key>
+                    <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                </entry>
+                <entry>
+                    <key>java.naming.factory.url</key>
+                    <value>org.jboss.naming:org.jnp.interfaces</value>
+                </entry>
+            </map>
+        </property>
+        <depends>testLocaNamingBeanImpl</depends>
+    </bean>
+    <bean name="JndiBindings" class="org.jboss.naming.BindingsInitializer">
+        <property name="ctx">
+            <inject bean="InitialContextFactory" property="ctx"/>
+        </property>
+        <property name="bindings">
+            <map keyClass="java.lang.String">
+                <entry>
+                    <key>ints/1</key>
+                    <value class="java.lang.Integer">1</value>
+                </entry>
+                <entry>
+                    <key>strings/1</key>
+                    <value class="java.lang.String">String1</value>
+                </entry>
+                <entry>
+                    <key>bigint/1</key>
+                    <value class="java.math.BigInteger">123456789</value>
+                </entry>
+                <entry>
+                    <key>env-props</key>
+                    <value>
+                        <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                        <entry>
+                            <key>java.naming.factory.initial</key>
+                            <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                        </entry>
+                        <entry>
+                            <key>java.naming.factory.url</key>
+                            <value>org.jboss.naming:org.jnp.interfaces</value>
+                        </entry>
+                        </map>
+                    </value>
+                </entry>
+            </map>
+        </property>
+    </bean>
+    <bean name="testLocaNamingBeanImpl" class="org.jnp.server.NamingBeanImpl">
+        <!-- Install this bean as the global JVM NamingServer -->
+        <property name="installGlobalService">true</property>
+        
+        <property name="useGlobalService">false</property>
+    </bean>
+
+</deployment>

Added: projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testSingletonNamingServer.xml
===================================================================
--- projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testSingletonNamingServer.xml	                        (rev 0)
+++ projects/naming/trunk/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testSingletonNamingServer.xml	2008-09-27 01:05:49 UTC (rev 78907)
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
+    xmlns="urn:jboss:bean-deployer:2.0">
+
+    <bean name="InitialContextFactory" class="org.jboss.naming.InitialContextFactoryBean">
+        <property name="env">
+            <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                <entry>
+                    <key>java.naming.factory.initial</key>
+                    <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                </entry>
+                <entry>
+                    <key>java.naming.factory.url</key>
+                    <value>org.jboss.naming:org.jnp.interfaces</value>
+                </entry>
+            </map>
+        </property>
+        <depends>testSingletonNamingServer</depends>
+    </bean>
+    <bean name="JndiBindings" class="org.jboss.naming.BindingsInitializer">
+        <property name="ctx">
+            <inject bean="InitialContextFactory" property="ctx"/>
+        </property>
+        <property name="bindings">
+            <map keyClass="java.lang.String">
+                <entry>
+                    <key>ints/1</key>
+                    <value class="java.lang.Integer">1</value>
+                </entry>
+                <entry>
+                    <key>strings/1</key>
+                    <value class="java.lang.String">String1</value>
+                </entry>
+                <entry>
+                    <key>bigint/1</key>
+                    <value class="java.math.BigInteger">123456789</value>
+                </entry>
+                <entry>
+                    <key>env-props</key>
+                    <value>
+                        <map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
+                            <entry>
+                                <key>java.naming.factory.initial</key>
+                                <value>org.jnp.interfaces.LocalOnlyContextFactory</value>
+                            </entry>
+                            <entry>
+                                <key>java.naming.factory.url</key>
+                                <value>org.jboss.naming:org.jnp.interfaces</value>
+                            </entry>
+                        </map>
+                    </value>
+                </entry>
+            </map>
+        </property>
+    </bean>
+
+    <bean name="testSingletonNamingServer" class="org.jnp.server.SingletonNamingServer">
+    </bean>
+
+</deployment>




More information about the jboss-cvs-commits mailing list