[jboss-cvs] JBossAS SVN: r65512 - in branches/Branch_4_2/ejb3: src/test/org/jboss/ejb3/test/webservices/jsr181 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 20 19:58:12 EDT 2007


Author: bdecoste
Date: 2007-09-20 19:58:12 -0400 (Thu, 20 Sep 2007)
New Revision: 65512

Added:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3Bean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3RemoteInterface.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEndpointInterface.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/RemoteHomeInterface.java
Modified:
   branches/Branch_4_2/ejb3/build-test.xml
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java
Log:
[JBCTS-540] additional tests for using narrow() to resolve a home interface

Modified: branches/Branch_4_2/ejb3/build-test.xml
===================================================================
--- branches/Branch_4_2/ejb3/build-test.xml	2007-09-20 22:42:14 UTC (rev 65511)
+++ branches/Branch_4_2/ejb3/build-test.xml	2007-09-20 23:58:12 UTC (rev 65512)
@@ -4,7 +4,6 @@
    <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
 ]>
 
-<!-- ====================================================================== -->
 <!--                                                                        -->
 <!--  JBoss, the OpenSource J2EE webOS                                      -->
 <!--                                                                        -->
@@ -839,7 +838,9 @@
       <jar jarfile="${build.lib}/jsr181.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/webservices/jsr181/EJB3*.class"/>
+         	<include name="org/jboss/ejb3/test/webservices/jsr181/*HomeInterface.class"/>
             <include name="org/jboss/ejb3/test/webservices/jsr181/Stateless*.class"/>
+         	<include name="org/jboss/ejb3/test/webservices/jsr181/Narrowable*.class"/>
          </fileset>
          <fileset dir="${resources}/test/webservices">
          	<include name="META-INF/ejb-jar.xml"/>
@@ -851,6 +852,7 @@
       <jar jarfile="${build.lib}/jsr181-client.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/webservices/jsr181/EndpointInterface.class"/>
+	        <include name="org/jboss/ejb3/test/webservices/jsr181/NarrowableEndpointInterface.class"/>
          </fileset>
          <fileset dir="${resources}/test/webservices">
             <include name="META-INF/application-client.xml"/>
@@ -1586,6 +1588,7 @@
          webxml="${build.resources}/test/servlet/WEB-INF/test-web.xml">
          <webinf dir="${build.resources}/test/servlet/WEB-INF">
             <include name="jboss-web.xml"/>
+         	<include name="context.xml"/>
          </webinf>
          <classes dir="${build.classes}">
             <include name="org/jboss/ejb3/test/servlet/servlets/**"/>
@@ -3659,6 +3662,7 @@
       <antcall target="clustered-jms-test" inheritRefs="true"/>
       <antcall target="invoker-test"  inheritRefs="true"/>
       <antcall target="iiop-tests"  inheritRefs="true"/>
+	  <antcall target="webservices-tests"  inheritRefs="true"/>
       <antcall target="libdeployment-test"  inheritRefs="true"/>
       <antcall target="multi-instance-localfromremote-test"  inheritRefs="true"/>
       <antcall target="statelesscreation-test"  inheritRefs="true"/>
@@ -3704,9 +3708,6 @@
          <param name="test" value="arjuna"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
-         <param name="test" value="webservices"/>
-      </antcall>
-      <antcall target="test" inheritRefs="true">
          <param name="test" value="regression/ejbthree454"/>
       </antcall>
       <antcall target="test" inheritRefs="true">
@@ -4108,21 +4109,21 @@
 
 
    <target name="ssl-simple-test" depends="init">
-     <create-config baseconf="all" newconf="ejb3-ssl" jboss.dist="${ejb3.dist}">
+     <!--create-config baseconf="default" newconf="ejb3-ssl" jboss.dist="${ejb3.dist}">
          <patternset>
             <include name="conf/**"/>
             <include name="deploy*/**"/>
             <include name="lib/**"/>
          </patternset>
-      </create-config>
+      </create-config-->
 
       <!--
          We are using the simplest remoting sslsocket configuration possible, we
          need to tell JBoss to use the supplied keystore via system properties
       -->
       <property name="ssl-args" value="-Djavax.net.ssl.keyStore=${ejb3.dist}/server/ejb3-ssl/conf/localhost.keystore -Djavax.net.ssl.keyStorePassword=opensource ${ejb3.jboss.jvmargs}"/>
-      <start-jboss conf="ejb3-ssl" host="${node0}" jvmargs="${ssl-args}" jboss.dist="${ejb3.dist}"/>
-      <wait-on-host/>
+      <!--start-jboss conf="ejb3-ssl" host="${node0}" jvmargs="${ssl-args}" jboss.dist="${ejb3.dist}"/>
+      <wait-on-host/-->
 
       <!-- Tell client to use the supplied truststore -->
       <property name="jvmargs" value="-Djavax.net.ssl.trustStore=${resources}/test/ssl/localhost.truststore -Djavax.net.ssl.trustStorePassword=opensource"/>
@@ -4132,8 +4133,8 @@
          <param name="jvmargs" value="${jvmargs}"/>
       </antcall>
 
-      <stop-jboss jboss.dist="${ejb3.dist}"/>
-      <wait-on-shutdown conf="ejb3-ssl"/>
+      <!--stop-jboss jboss.dist="${ejb3.dist}"/>
+      <wait-on-shutdown conf="ejb3-ssl"/-->
    </target>
 
    <target name="ssl-advanced-test" depends="init">
@@ -4587,4 +4588,21 @@
       <!-- TODO: call sunorb-test, but the report gets overwritten -->
    </target>
    
+   <target name="webservices-tests" depends="init" description="Execute all tests">
+
+      <start-jboss conf="all" host="${node0}" jboss.dist="${ejb3.dist}" jvmargs="${ejb3.jboss.jvmargs}"/>
+      <wait-on-host/>
+
+      <antcall target="no-start-jboss-iiop-tests" inheritRefs="true"/>
+
+      <stop-jboss jboss.dist="${ejb3.dist}"/>
+      <wait-on-shutdown conf="all"/>
+   </target>
+	
+   <target name="no-start-jboss-webservices-tests" depends="init" description="Execute all webservices tests">
+      <antcall target="jacorb-test" inheritRefs="true">
+         <param name="test" value="webservices"/>
+      </antcall>
+      <!-- TODO: call sunorb-test, but the report gets overwritten -->
+   </target>
 </project>

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java	2007-09-20 22:42:14 UTC (rev 65511)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/EJB3Bean.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -25,6 +25,7 @@
 import org.jboss.ws.annotation.WebContext;
 
 import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
 import javax.ejb.Stateless;
 import javax.jws.WebMethod;
 import javax.jws.WebService;
@@ -38,6 +39,7 @@
 @WebContext(contextRoot="jsr181", urlPattern="/*")
 @SOAPBinding(style = SOAPBinding.Style.RPC)
 @Remote(EJB3RemoteInterface.class)
+ at RemoteHome(RemoteHomeInterface.class)
 @RemoteBinding(jndiBinding = "/ejb3/EJB3EndpointInterface")
 @Stateless
 public class EJB3Bean implements EJB3RemoteInterface

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3Bean.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3Bean.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3Bean.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.webservices.jsr181;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.ws.annotation.WebContext;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Stateless;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.ejb3.iiop.IORFactory;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @version $Revision: 62396 $
+ */
+ at WebService(name = "NarrowableEndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "NarrowableTestService")
+ at WebContext(contextRoot="jsr181", urlPattern="/Narrowable*")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at Remote(NarrowableEJB3RemoteInterface.class)
+ at RemoteHome(RemoteHomeInterface.class)
+ at RemoteBinding(factory=IORFactory.class)
+ at Stateless
+public class NarrowableEJB3Bean
+{
+   @WebMethod
+   public String echo(String input) throws RemoteException
+   {
+      return input;
+   }
+}

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3RemoteInterface.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3RemoteInterface.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEJB3RemoteInterface.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.webservices.jsr181;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * An EJB3 remote interface
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 10-May-2005
+ */
+public interface NarrowableEJB3RemoteInterface extends EJBObject
+{
+   String echo(String input) throws RemoteException;
+}

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEndpointInterface.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEndpointInterface.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/NarrowableEndpointInterface.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.webservices.jsr181;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * Test the JSR-181 javax.jws.WebService annotation on an SEI
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 29-Apr-2005
+ */
+ at WebService(name = "NarrowableEndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "NarrowableTestService")
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface NarrowableEndpointInterface extends Remote
+{
+   String echo(String input) throws RemoteException;
+}

Added: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/RemoteHomeInterface.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/RemoteHomeInterface.java	                        (rev 0)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/jsr181/RemoteHomeInterface.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.ejb3.test.webservices.jsr181;
+
+import javax.ejb.*;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ */
+public interface RemoteHomeInterface extends EJBHome {
+    
+  public EJB3RemoteInterface create() throws java.rmi.RemoteException, javax.ejb.CreateException;
+} 
+

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java	2007-09-20 22:42:14 UTC (rev 65511)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/webservices/unit/JSR181TestCase.java	2007-09-20 23:58:12 UTC (rev 65512)
@@ -24,6 +24,7 @@
 import junit.framework.Test;
 import org.jboss.ejb3.test.webservices.jsr181.EJB3RemoteInterface;
 import org.jboss.ejb3.test.webservices.jsr181.EndpointInterface;
+import org.jboss.ejb3.test.webservices.jsr181.RemoteHomeInterface;
 import org.jboss.ejb3.test.webservices.jsr181.StatelessRemote;
 import org.jboss.test.JBossTestCase;
 
@@ -31,8 +32,11 @@
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
 import javax.xml.rpc.Service;
+
 import java.util.Hashtable;
+import java.util.Properties;
 
 /**
  * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
@@ -54,7 +58,41 @@
       Object retObj = ejb3Remote.echo(helloWorld);
       assertEquals(helloWorld, retObj);
    }
+   
+   public void testHomeRemoteAccess() throws Exception
+   {
+      InitialContext iniCtx = getInitialContext();
+      RemoteHomeInterface home = (RemoteHomeInterface)iniCtx.lookup("EJB3Bean/home");
+      EJB3RemoteInterface ejb3Remote = home.create();
 
+      String helloWorld = "Hello world!";
+      Object retObj = ejb3Remote.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
+   }
+   
+   public void testNarrowedHomeRemoteAccess() throws Exception
+   {
+      Properties props = new Properties();
+      props.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
+      props.put("java.naming.provider.url", "corbaloc::localhost:3528/NameService");
+      props.put("java.naming.factory.object", "org.jboss.tm.iiop.client.IIOPClientUserTransactionObjectFactory");
+      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client:org.jnp.interfaces");
+      props.put("j2ee.clientName", "jbossws-client");
+      
+      InitialContext jndiContext = new InitialContext(props);
+  
+      Object proxy = jndiContext.lookup("NarrowableEJB3Bean/home");
+      assertNotNull(proxy);
+      
+      RemoteHomeInterface home = (RemoteHomeInterface)PortableRemoteObject.narrow(proxy, RemoteHomeInterface.class);
+      assertNotNull(home);
+      EJB3RemoteInterface ejb3Remote = home.create();
+
+      String helloWorld = "Hello world!";
+      Object retObj = ejb3Remote.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
+   }
+
    public void testWebService() throws Exception
    {
       InitialContext iniCtx = getInitialContext();




More information about the jboss-cvs-commits mailing list