[jboss-cvs] JBossAS SVN: r68900 - in trunk/testsuite: imports/sections and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 11 12:44:25 EST 2008


Author: scott.stark at jboss.org
Date: 2008-01-11 12:44:24 -0500 (Fri, 11 Jan 2008)
New Revision: 68900

Added:
   trunk/testsuite/imports/sections/refs.xml
   trunk/testsuite/src/main/org/jboss/test/refs/
   trunk/testsuite/src/main/org/jboss/test/refs/client/
   trunk/testsuite/src/main/org/jboss/test/refs/client/Client.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulIF.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java
   trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIF.java
   trunk/testsuite/src/main/org/jboss/test/refs/test/
   trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java
   trunk/testsuite/src/resources/refs/
   trunk/testsuite/src/resources/refs/jboss-client.xml
   trunk/testsuite/src/resources/refs/jboss.xml
Modified:
   trunk/testsuite/imports/test-jars.xml
Log:
Reference resolution tests

Added: trunk/testsuite/imports/sections/refs.xml
===================================================================
--- trunk/testsuite/imports/sections/refs.xml	                        (rev 0)
+++ trunk/testsuite/imports/sections/refs.xml	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,31 @@
+<project name="tests-refs-jars"> 
+  <target name="_jars-refs">
+      <mkdir dir="${build.lib}"/>
+
+  		<jar destfile="${build.lib}/refs-client.jar">
+  	    <manifest>
+  	        <attribute name="Main-Class" value="org.jboss.test.refs.client.Client"/>
+  	    </manifest>
+  		 <metainf dir="${build.resources}/refs">
+         <include name="jboss-client.xml"/>
+  		 </metainf>
+  			<fileset dir="${build.classes}">
+            <include name="org/jboss/test/refs/client/**"/>
+  			</fileset>
+  		</jar>
+		<jar destfile="${build.lib}/refs-ejb.jar">
+	  		 <metainf dir="${build.resources}/refs">
+	         <include name="jboss.xml"/>
+	  		 </metainf>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/refs/ejbs/**"/>
+         </fileset>
+		</jar>
+      <jar destfile="${build.lib}/refs.ear">
+         <fileset dir="${build.lib}">
+            <include name="refs-client.jar" />
+            <include name="refs-ejb.jar" />
+         </fileset>
+      </jar> 
+  </target> 
+</project>


Property changes on: trunk/testsuite/imports/sections/refs.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Modified: trunk/testsuite/imports/test-jars.xml
===================================================================
--- trunk/testsuite/imports/test-jars.xml	2008-01-11 17:19:58 UTC (rev 68899)
+++ trunk/testsuite/imports/test-jars.xml	2008-01-11 17:44:24 UTC (rev 68900)
@@ -54,6 +54,7 @@
    <import file="sections/pooled.xml"/>
    <import file="sections/proxycompiler.xml"/>
    <import file="sections/readahead.xml"/>
+   <import file="sections/refs.xml"/>
    <import file="sections/retry.xml"/>
 	<import file="sections/scoped.xml"/>
 	<import file="sections/seam.xml"/>
@@ -139,6 +140,7 @@
         _jars-pooled,
         _jars-proxycompiler,
         _jars-readahead,
+        _jars-refs,
         _jars-retry,
         _jars-scoped,
         _jars-security,

Added: trunk/testsuite/src/main/org/jboss/test/refs/client/Client.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/client/Client.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/client/Client.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,100 @@
+/*
+ * 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.client;
+
+import java.util.Properties;
+import javax.ejb.EJB;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.refs.ejbs.StatefulIF;
+import org.jboss.test.refs.ejbs.StatelessIF;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Client
+{
+   private static Logger log = Logger.getLogger(Client.class);
+   @EJB(name = "ejb/StatefulBean", beanInterface = StatefulIF.class)
+   private static StatefulIF statefulBean;
+
+   @EJB(name = "ejb/StatelessBean", beanInterface = StatelessIF.class)
+   private static StatelessIF statelessBean;
+
+   private Properties props;
+
+   public static StatefulIF getStatefulBean()
+   {
+      return statefulBean;
+   }
+   public static StatelessIF getStatelessBean()
+   {
+      return statelessBean;
+   }
+
+   public static void main(String[] args)
+      throws Exception
+   {
+      Client c = new Client();
+      int test = 1;
+      if(args.length > 0)
+         test = Integer.parseInt(args[0]);
+      switch(test)
+      {
+         case 1:
+            c.test1();
+            break;
+         case 2:
+         default:
+            c.test2();
+            break;
+      }
+   }
+
+   public void test1() throws Exception
+   {
+      log.info("Begin test1");
+      try
+      {
+         statefulBean.init(props);
+         statefulBean.test1();
+      }
+      catch (Exception e)
+      {
+         log.info("", e);
+      }
+   }
+   public void test2() throws Exception
+   {
+      log.info("Begin test2");
+      try
+      {
+         statefulBean.test2();
+      }
+      catch (Exception e)
+      {
+         log.info("", e);
+      }
+   }
+
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/client/Client.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,48 @@
+/*
+ * 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.ejbs;
+
+import java.util.Properties;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Stateful(name="StatefulBean", mappedName="refs/StatefulBean")
+ at Remote({StatefulIF.class})
+public class StatefulBean implements StatefulIF
+{
+   public void init(Properties prop) throws Exception
+   {
+   }
+   public void test1() throws Exception
+   {
+      
+   }
+   public void test2() throws Exception
+   {
+      
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulIF.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulIF.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulIF.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,35 @@
+/*
+ * 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.ejbs;
+
+import java.util.Properties;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface StatefulIF
+{
+   public void init(Properties prop) throws Exception;
+   public void test1() throws Exception;
+   public void test2() throws Exception;
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatefulIF.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,51 @@
+/*
+ * 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.ejbs;
+
+import java.util.Properties;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Stateless(name="StatelessBean", mappedName="refs/StatelessBean")
+ at Remote({StatelessIF.class})
+ at TransactionManagement(TransactionManagementType.CONTAINER)
+public class StatelessBean implements StatelessIF
+{
+   public void init(Properties prop) throws Exception
+   {
+   }
+   public void test1() throws Exception
+   {
+      
+   }
+   public void test2() throws Exception
+   {
+      
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIF.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIF.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIF.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,32 @@
+/*
+ * 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.ejbs;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface StatelessIF
+{
+   public void test1() throws Exception;
+   public void test2() throws Exception;
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/ejbs/StatelessIF.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,64 @@
+/*
+ * 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 java.util.Date;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.client.ClientLauncher;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.refs.client.Client;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class RefResolutionUnitTestCase
+   extends JBossTestCase
+{
+   public static Test suite() throws Exception
+   {
+      Test t1 = getDeploySetup(RefResolutionUnitTestCase.class, "refs.ear");
+      return t1;
+   }
+
+   public RefResolutionUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testSessionRefByInterface()
+      throws Throwable
+   {
+      String mainClassName = Client.class.getName();
+      // must match JNDI name in jboss-client.xml or display-name in application-client.xml
+      String applicationClientName = "refs_client";
+      String name = new Date().toString();
+      String args[] = { name };
+      
+      ClientLauncher launcher = new ClientLauncher();
+      launcher.launch(mainClassName, applicationClientName, args);
+      assertNotNull(Client.getStatefulBean());
+      assertNotNull(Client.getStatelessBean());
+   }
+}


Property changes on: trunk/testsuite/src/main/org/jboss/test/refs/test/RefResolutionUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/resources/refs/jboss-client.xml
===================================================================
--- trunk/testsuite/src/resources/refs/jboss-client.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/refs/jboss-client.xml	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-client
+    PUBLIC "-//JBoss//DTD Application Client 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-client_5_0.dtd">
+
+<jboss-client>
+    <jndi-name>refs_client</jndi-name>
+    <ejb-ref>
+        <ejb-ref-name>ejb/StatefulBean</ejb-ref-name>
+        <jndi-name>refs/StatefulBean</jndi-name>
+    </ejb-ref>
+    <ejb-ref>
+        <ejb-ref-name>ejb/StatelessBean</ejb-ref-name>
+        <jndi-name>refs/StatelessBean</jndi-name>
+    </ejb-ref>
+</jboss-client>


Property changes on: trunk/testsuite/src/resources/refs/jboss-client.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: trunk/testsuite/src/resources/refs/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/refs/jboss.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/refs/jboss.xml	2008-01-11 17:44:24 UTC (rev 68900)
@@ -0,0 +1,15 @@
+<?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>
+        <ejb>
+            <ejb-name>StatefulBean</ejb-name>
+        </ejb>
+        <ejb>
+            <ejb-name>StatelessBean</ejb-name>
+        </ejb>
+    </enterprise-beans>
+</jboss>


Property changes on: trunk/testsuite/src/resources/refs/jboss.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list