[jbossws-commits] JBossWS SVN: r13429 - in framework/branches/jbossws-framework-3.4.1/testsuite/test: java/org/jboss/test/ws/jaxws and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Dec 8 08:43:01 EST 2010


Author: richard.opalka at jboss.com
Date: 2010-12-08 08:43:00 -0500 (Wed, 08 Dec 2010)
New Revision: 13429

Added:
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/JBWS3026TestCase.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBean.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanLocal.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanRemote.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyService.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyServiceImpl.java
   framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/
   framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/WEB-INF/
   framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/WEB-INF/web.xml
Modified:
   framework/branches/jbossws-framework-3.4.1/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3026] providing test case

Modified: framework/branches/jbossws-framework-3.4.1/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/ant-import/build-jars-jaxws.xml	2010-12-08 11:00:53 UTC (rev 13428)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/ant-import/build-jars-jaxws.xml	2010-12-08 13:43:00 UTC (rev 13429)
@@ -927,6 +927,22 @@
 			</metainf>
 		</jar>
 
+                <!-- jaxws-jbws3026 -->
+		<jar destfile="${tests.output.dir}/test-libs/jaxws-jbws3026-ejb.jar">
+			<fileset dir="${tests.output.dir}/test-classes">
+				<include name="org/jboss/test/ws/jaxws/jbws3026/MyBean*.class" />
+				<exclude name="org/jboss/test/ws/jaxws/jbws3026/MyService*.class" />
+				<exclude name="org/jboss/test/ws/jaxws/jbws3026/*TestCase.class" />
+			</fileset>
+		</jar>
+		<war warfile="${tests.output.dir}/test-libs/jaxws-jbws3026-web.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws3026/WEB-INF/web.xml">
+			<classes dir="${tests.output.dir}/test-classes">
+				<include name="org/jboss/test/ws/jaxws/jbws3026/MyService*.class"/>
+				<exclude name="org/jboss/test/ws/jaxws/jbws3026/MyBean*.class"/>
+				<exclude name="org/jboss/test/ws/jaxws/jbws3026/*TestCase.class" />
+			</classes>
+		</war>
+
 		<!-- jaxws-jbws3034 -->
 		<war warfile="${tests.output.dir}/test-libs/jaxws-jbws3034.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws3034/WEB-INF/web.xml">
 			<classes dir="${tests.output.dir}/test-classes">

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/JBWS3026TestCase.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/JBWS3026TestCase.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/JBWS3026TestCase.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-3026] Injecting EJB into Webservice via @EJB(mappedName="MyBean/remote")
+ *
+ * @author <a href="mailto:ropalka at redhat.com">Richard Opalka</a>
+ */
+public final class JBWS3026TestCase extends JBossWSTest
+{
+   public static Test suite()
+   {
+      return new JBossWSTestSetup(JBWS3026TestCase.class, "jaxws-jbws3026-ejb.jar,jaxws-jbws3026-web.war");
+   }
+
+   public void testUsecase1WithoutSar() throws Exception
+   {
+      String endpointAddress = "http://" + getServerHost() + ":8080/jaxws-jbws3026-web/MyService";
+      QName serviceName = new QName("http://jbws3026.jaxws.ws.test.jboss.org/", "MyService");
+      Service service = Service.create(new URL(endpointAddress + "?wsdl"), serviceName);
+      MyService port = (MyService)service.getPort(MyService.class);
+      port.useBean();
+      port.thisOneWorks();
+   }
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBean.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBean.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBean.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+ at Stateless
+ at Remote(MyBeanRemote.class)
+ at Local(MyBeanLocal.class)
+public class MyBean implements MyBeanLocal
+{
+   public void myMethod()
+   {
+      System.out.println("I'll do nothing");
+   }
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanLocal.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanLocal.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanLocal.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import javax.ejb.Local;
+
+ at Local
+public interface MyBeanLocal
+{
+   public void myMethod();
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanRemote.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanRemote.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyBeanRemote.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface MyBeanRemote
+{
+   public void myMethod();
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyService.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyService.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyService.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import javax.jws.WebService;
+
+ at WebService
+public interface MyService
+{
+   public void useBean();
+   public void thisOneWorks();
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyServiceImpl.java
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyServiceImpl.java	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3026/MyServiceImpl.java	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.ws.jaxws.jbws3026;
+
+import javax.ejb.EJB;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+ at SOAPBinding(style = Style.RPC)
+ at WebService(serviceName = "MyService", portName = "MyServicePort")
+public class MyServiceImpl implements MyService
+{
+    @EJB(mappedName="MyBean/remote")
+    MyBeanRemote bean;
+
+    /**
+     * Invoking method of injected bean 
+     */
+   public void useBean()
+   {
+      bean.myMethod();
+   }
+
+   /**
+    * This method works if you just remove the @EJB-Injection
+    */
+   public void thisOneWorks()
+   {
+      MyBeanRemote bean = lookupBean();
+      if (bean != null)
+      {
+         bean.myMethod();
+      }
+   }
+
+   /**
+    * Looking up the bean by using JNDI
+    *
+    * @return
+    */
+   private MyBeanRemote lookupBean()
+   {
+      MyBeanRemote res = null;
+      try
+      {
+         InitialContext ctx = new InitialContext();
+         res= (MyBeanRemote) ctx.lookup("MyBean/remote");
+      }
+      catch (NamingException e)
+      {
+         System.out.println("Something went wrong");
+         e.printStackTrace();
+      }
+      return res;
+   }
+}

Added: framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/WEB-INF/web.xml
===================================================================
--- framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/WEB-INF/web.xml	                        (rev 0)
+++ framework/branches/jbossws-framework-3.4.1/testsuite/test/resources/jaxws/jbws3026/WEB-INF/web.xml	2010-12-08 13:43:00 UTC (rev 13429)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+   id="WebApp_ID" version="2.5">
+   <servlet>
+      <servlet-name>MyService</servlet-name>
+      <servlet-class>org.jboss.test.ws.jaxws.jbws3026.MyServiceImpl</servlet-class>
+      <load-on-startup>1</load-on-startup>
+   </servlet>
+   <servlet-mapping>
+      <servlet-name>MyService</servlet-name>
+      <url-pattern>/MyService</url-pattern>
+   </servlet-mapping>
+</web-app>
\ No newline at end of file



More information about the jbossws-commits mailing list