[jboss-cvs] JBossAS SVN: r72815 - in trunk/testsuite: src/main/org/jboss/test/refs and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 28 22:44:21 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-04-28 22:44:21 -0400 (Mon, 28 Apr 2008)
New Revision: 72815

Added:
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/Client.java
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink1Bean.java
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink2Bean.java
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface1.java
   trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface2.java
   trunk/testsuite/src/main/org/jboss/test/refs/test/PathEjbRefResolutionUnitTestCase.java
   trunk/testsuite/src/resources/refs/clientpath/
   trunk/testsuite/src/resources/refs/clientpath/ejb1/
   trunk/testsuite/src/resources/refs/clientpath/ejb1/jboss.xml
   trunk/testsuite/src/resources/refs/clientpath/ejb2/
   trunk/testsuite/src/resources/refs/clientpath/ejb2/jboss.xml
Modified:
   trunk/testsuite/imports/sections/refs.xml
Log:
Test path references and jndi names

Modified: trunk/testsuite/imports/sections/refs.xml
===================================================================
--- trunk/testsuite/imports/sections/refs.xml	2008-04-29 02:18:03 UTC (rev 72814)
+++ trunk/testsuite/imports/sections/refs.xml	2008-04-29 02:44:21 UTC (rev 72815)
@@ -109,5 +109,44 @@
 				<include name="refs-ejblink-client.jar" />
 			</fileset>
 		</jar>
+		
+      <!-- refspath-client.jar -->
+      <jar destfile="${build.lib}/refspath-client.jar">
+         <manifest>
+            <attribute name="Main-Class" value="org.jboss.test.refs.clientpath.Client" />
+         </manifest>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/refs/clientpath/*" />
+            <include name="org/jboss/test/refs/clientpath/ejbs/Iface*" />
+         </fileset>
+      </jar>
+      <!-- refspath-ejb1.jar -->
+      <jar destfile="${build.lib}/refspath-ejb1.jar">
+         <metainf dir="${build.resources}/refs/clientpath/ejb1">
+            <include name="*.xml" />
+         </metainf>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/refs/clientpath/ejbs/EjbLink1Bean*" />
+            <include name="org/jboss/test/refs/clientpath/ejbs/Iface1*" />
+         </fileset>
+      </jar>
+      <!-- refspath-ejb2.jar -->
+      <jar destfile="${build.lib}/refspath-ejb2.jar">
+         <metainf dir="${build.resources}/refs/clientpath/ejb2">
+            <include name="*.xml" />
+         </metainf>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/refs/clientpath/ejbs/EjbLink2Bean*" />
+            <include name="org/jboss/test/refs/clientpath/ejbs/Iface2*" />
+         </fileset>
+      </jar>
+		<!-- refspath.ear -->
+      <jar destfile="${build.lib}/refspath.ear">
+         <fileset dir="${build.lib}">
+            <include name="refspath-client.jar" />
+            <include name="refspath-ejb1.jar" />
+            <include name="refspath-ejb2.jar" />
+         </fileset>
+      </jar>
 	</target>
 </project>

Added: trunk/testsuite/src/main/org/jboss/test/refs/clientpath/Client.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/clientpath/Client.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/clientpath/Client.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.jboss.test.refs.clientpath;
+
+import javax.ejb.EJB;
+
+import org.jboss.test.refs.clientpath.ejbs.Iface1;
+import org.jboss.test.refs.clientpath.ejbs.Iface2;
+
+/**
+ * Annotation only client with path relative ejb-refs
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class Client
+{
+   @EJB(beanName = "refspath-ejb1.jar#EJB")
+   private static Iface1 ejb1;
+
+   @EJB(beanName = "refspath-ejb2.jar#EJB")
+   private static Iface2 ejb2;
+
+   public static void main(String[] args)
+      throws Exception
+   {
+      if(ejb1 == null)
+         throw new IllegalStateException("ejb1 is null");
+      if(ejb2 == null)
+         throw new IllegalStateException("ejb2 is null");
+      ejb1.method1();
+      ejb2.method2();
+   }
+
+}

Added: trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink1Bean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink1Bean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink1Bean.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.jboss.test.refs.clientpath.ejbs;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 71369 $
+ */
+ at Stateless(name = "EJB")
+ at Remote( { Iface1.class })
+public class EjbLink1Bean implements Iface1
+{
+   private static Logger log = Logger.getLogger(EjbLink1Bean.class);
+
+   public EjbLink1Bean()
+   {
+   }
+
+   public void method1()
+   {
+      log.info("method1()");
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink2Bean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink2Bean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/EjbLink2Bean.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.jboss.test.refs.clientpath.ejbs;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 71369 $
+ */
+ at Stateless(name = "EJB")
+ at Remote( { Iface2.class })
+public class EjbLink2Bean implements Iface2
+{
+   private static Logger log = Logger.getLogger(EjbLink2Bean.class);
+
+   public EjbLink2Bean()
+   {
+   }
+
+   public void method2()
+   {
+      log.info("method2()");
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface1.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface1.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface1.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,33 @@
+/*
+ * 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.jboss.test.refs.clientpath.ejbs;
+
+/**
+ * EJB interface 1
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface Iface1
+{
+   public void method1();
+}

Added: trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface2.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface2.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/clientpath/ejbs/Iface2.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,33 @@
+/*
+ * 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.jboss.test.refs.clientpath.ejbs;
+
+/**
+ * EJB interface 2
+ * 
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface Iface2
+{
+   public void method2();
+}

Added: trunk/testsuite/src/main/org/jboss/test/refs/test/PathEjbRefResolutionUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/test/PathEjbRefResolutionUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/test/PathEjbRefResolutionUnitTestCase.java	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, 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.jboss.test.refs.test;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.client.ClientLauncher;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.refs.clientpath.Client;
+
+/**
+ * Tests of reference resolution. The ear consists of:
+
+   refspath.ear
+    + refspath-client.jar
+      - @EJB(beanName = "ejb1.jar#EJB")
+        -> EjbLink1Bean
+      - @EJB(beanName = "ejb2.jar#EJB")
+        -> EjbLink2Bean
+    + refspath-ejb1.jar
+      - EjbLink1Bean
+         + @Stateful(name = "EJB", mappedName="refs/clientpath/EJB1")
+         + @Remote({Iface1.class})
+    + refspath-ejb2.jar
+      - EjbLink2Bean
+        + @Stateless(name = "EJB", mappedName="refs/clientpath/EJB2")
+        + @Remote(Iface2.class)
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 72733 $
+ */
+public class PathEjbRefResolutionUnitTestCase
+   extends JBossTestCase
+{
+   public static Test suite() throws Exception
+   {
+      Test t1 = getDeploySetup(PathEjbRefResolutionUnitTestCase.class, "refspath.ear");
+      return t1;
+   }
+
+   public PathEjbRefResolutionUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * 
+    * @throws Throwable
+    */
+   public void testClientRefs()
+      throws Throwable
+   {
+      String mainClassName = Client.class.getName();
+      // must match JNDI name in jboss-client.xml or display-name in application-client.xml
+      String applicationClientName = "refspath-client";
+      String args[] = { };
+      
+      ClientLauncher launcher = new ClientLauncher();
+      launcher.launch(mainClassName, applicationClientName, args);
+   }
+}

Added: trunk/testsuite/src/resources/refs/clientpath/ejb1/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/refs/clientpath/ejb1/jboss.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/refs/clientpath/ejb1/jboss.xml	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss xmlns="http://www.jboss.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+    http://www.jboss.org/j2ee/schema/jboss_5_0.xsd" version="3.0">
+    <unauthenticated-principal>guest</unauthenticated-principal>
+    <enterprise-beans>
+        <session>
+            <ejb-name>EJB</ejb-name>
+            <jndi-name>refs/clientpath/EJB1</jndi-name>
+        </session>
+    </enterprise-beans>
+</jboss>

Added: trunk/testsuite/src/resources/refs/clientpath/ejb2/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/refs/clientpath/ejb2/jboss.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/refs/clientpath/ejb2/jboss.xml	2008-04-29 02:44:21 UTC (rev 72815)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jboss xmlns="http://www.jboss.com/xml/ns/javaee"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+    http://www.jboss.org/j2ee/schema/jboss_5_0.xsd" version="3.0">
+    <unauthenticated-principal>guest</unauthenticated-principal>
+    <enterprise-beans>
+        <session>
+            <ejb-name>EJB</ejb-name>
+            <jndi-name>refs/clientpath/EJB2</jndi-name>
+        </session>
+    </enterprise-beans>
+</jboss>




More information about the jboss-cvs-commits mailing list