[jboss-cvs] JBossAS SVN: r80495 - in trunk/testsuite: src/main/org/jboss/test/ejb3 and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 4 08:41:52 EST 2008


Author: wolfc
Date: 2008-11-04 08:41:52 -0500 (Tue, 04 Nov 2008)
New Revision: 80495

Added:
   trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/
   trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/Greeter.java
   trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/SimpleSessionBean.java
   trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/unit/
   trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/unit/SameNamedJarUnitTestCase.java
Modified:
   trunk/testsuite/imports/sections/ejb3.xml
Log:
JBAS-6161: unit test

Modified: trunk/testsuite/imports/sections/ejb3.xml
===================================================================
--- trunk/testsuite/imports/sections/ejb3.xml	2008-11-04 13:32:58 UTC (rev 80494)
+++ trunk/testsuite/imports/sections/ejb3.xml	2008-11-04 13:41:52 UTC (rev 80495)
@@ -1,5 +1,23 @@
 <project name="tests-ejb3-jars">
-	<target name="_jars-ejb3">
+   <target name="jbas6161" depends="compile">
+      <mkdir dir="${build.lib}" />
+      
+      <jar destfile="${build.lib}/jbas6161.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/ejb3/jbas6161/**" />
+         </fileset>
+      </jar>
+      
+      <jar destfile="${build.lib}/jbas6161-A.ear">
+         <fileset dir="${build.lib}" includes="jbas6161.jar"/>
+      </jar>
+      
+      <jar destfile="${build.lib}/jbas6161-B.ear">
+         <fileset dir="${build.lib}" includes="jbas6161.jar"/>
+      </jar>
+   </target>
+   
+	<target name="_jars-ejb3" depends="jbas6161">
 		<mkdir dir="${build.lib}" />
 
 		<!-- A jar with a simple ejb3 session -->

Added: trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/Greeter.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/Greeter.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/Greeter.java	2008-11-04 13:41:52 UTC (rev 80495)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.jbas6161;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface Greeter
+{
+   String sayHiTo(String name);
+}

Added: trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/SimpleSessionBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/SimpleSessionBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/SimpleSessionBean.java	2008-11-04 13:41:52 UTC (rev 80495)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.jbas6161;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(Greeter.class)
+public class SimpleSessionBean implements Greeter
+{
+   public String sayHiTo(String name)
+   {
+      return "Hi " + name;
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/unit/SameNamedJarUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/unit/SameNamedJarUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb3/jbas6161/unit/SameNamedJarUnitTestCase.java	2008-11-04 13:41:52 UTC (rev 80495)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.jbas6161.unit;
+
+import java.util.Date;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.ejb3.jbas6161.Greeter;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SameNamedJarUnitTestCase extends JBossTestCase
+{
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(SameNamedJarUnitTestCase.class, "jbas6161-A.ear,jbas6161-B.ear");
+   }
+   
+   public SameNamedJarUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   protected <T> T lookup(String name, Class<T> cls) throws Exception
+   {
+      return cls.cast(getInitialContext().lookup(name));
+   }
+   
+   /**
+    * Do some simple beans to both session beans in each ear.
+    */
+   public void testBeanCalls() throws Exception
+   {
+      String earNames[] = { "jbas6161-A", "jbas6161-B" };
+      for(String earName : earNames)
+      {
+         Greeter bean = lookup(earName + "/SimpleSessionBean/remote", Greeter.class);
+         String name = new Date().toString();
+         String actual = bean.sayHiTo(name);
+         assertEquals("Hi " + name, actual);
+      }
+   }
+   
+   public void testServerFound() throws Exception
+   {
+      serverFound();
+   }
+}




More information about the jboss-cvs-commits mailing list