[jboss-cvs] JBossAS SVN: r63662 - in branches/Branch_4_2/ejb3: src/resources/test and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 27 04:18:23 EDT 2007


Author: wolfc
Date: 2007-06-27 04:18:23 -0400 (Wed, 27 Jun 2007)
New Revision: 63662

Added:
   branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/
   branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/ejbthree994-connectors-service.xml
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/BusinessInterface.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java
Modified:
   branches/Branch_4_2/ejb3/build-test.xml
Log:
EJBTHREE-994: unit test

Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml	2007-06-27 05:45:25 UTC (rev 63661)
+++ branches/Branch_4_2/ejb3/build-test.xml	2007-06-27 08:18:23 UTC (rev 63662)
@@ -1823,6 +1823,19 @@
       <build-simple-jar name="ejbthree963"/>
    </target>
    
+   <target name="ejbthree994"
+      description="Builds a simple jar files."
+      depends="compile-classes">
+      
+      <build-simple-jar name="ejbthree994"/>
+
+      <copy todir="${build.lib}">
+         <fileset dir="${resources}/test/ejbthree994">
+            <include name="ejbthree994-connectors-service.xml"/>
+         </fileset>
+      </copy>
+   </target>
+   
    <target name="jbas4489"
       description="Builds a simple jar files."
       depends="compile-classes">

Added: branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/ejbthree994-connectors-service.xml
===================================================================
--- branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/ejbthree994-connectors-service.xml	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/ejbthree994-connectors-service.xml	2007-06-27 08:18:23 UTC (rev 63662)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   JBoss EJB3Deployer
+   
+   $Id$
+-->
+<server>
+
+   <mbean code="org.jboss.remoting.transport.Connector"
+          name="jboss.remoting:type=Connector,name=Ejbthree994Ejb3Connector,handler=ejb3">
+      <attribute name="InvokerLocator">socket://${jboss.bind.address}:3874</attribute>
+      <attribute name="Configuration">
+         <handlers>
+            <handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
+         </handlers>
+      </attribute>
+   </mbean>
+
+</server>


Property changes on: branches/Branch_4_2/ejb3/src/resources/test/ejbthree994/ejbthree994-connectors-service.xml
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/BusinessInterface.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/BusinessInterface.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/BusinessInterface.java	2007-06-27 08:18:23 UTC (rev 63662)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree994;
+
+/**
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface BusinessInterface
+{
+   String echo(String s);
+}


Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/BusinessInterface.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java	2007-06-27 08:18:23 UTC (rev 63662)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree994;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.annotation.ejb.RemoteBindings;
+
+/**
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful
+ at RemoteBindings({
+   @RemoteBinding(clientBindUrl="socket://0.0.0.0:3873", jndiBinding="Stateful3873"),
+   @RemoteBinding(clientBindUrl="socket://0.0.0.0:3874", jndiBinding="Stateful3874")
+})
+ at Remote(BusinessInterface.class)
+public class StatefulBean implements BusinessInterface
+{
+   public String echo(String s)
+   {
+      return "*** " + s + " ***";
+   }
+}


Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/StatefulBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java	2007-06-27 08:18:23 UTC (rev 63662)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * 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.ejb3.test.ejbthree994.unit;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.ejbthree994.BusinessInterface;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.test.JBossTestCase;
+
+
+/**
+ * Test if multiple remote bindings work correctly.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MultiBindingsTestCase extends JBossTestCase
+{
+
+   public MultiBindingsTestCase(String name)
+   {
+      super(name);
+   }
+
+   private static String getProxyUri(Object proxy) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
+   {
+      InvocationHandler handler = Proxy.getInvocationHandler(proxy);
+      Field f = handler.getClass().getDeclaredField("uri");
+      f.setAccessible(true);
+      InvokerLocator locator = (InvokerLocator) f.get(handler);
+      return locator.getOriginalURI();
+   }
+   
+   public void test1() throws Exception
+   {
+      {
+         BusinessInterface bean = (BusinessInterface) getInitialContext().lookup("Stateful3873");
+         String actual = bean.echo("123");
+         assertEquals(actual, "*** 123 ***");
+         
+         String proxyUri = getProxyUri(bean);
+         assertEquals(proxyUri, "socket://0.0.0.0:3873");
+      }
+
+      {
+         BusinessInterface bean = (BusinessInterface) getInitialContext().lookup("Stateful3874");
+         String actual = bean.echo("456");
+         assertEquals(actual, "*** 456 ***");
+         
+         String proxyUri = getProxyUri(bean);
+         assertEquals(proxyUri, "socket://0.0.0.0:3874");
+      }
+   }
+   
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(MultiBindingsTestCase.class, "ejbthree994-connectors-service.xml,ejbthree994.jar");
+   }
+
+}


Property changes on: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/ejbthree994/unit/MultiBindingsTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list