You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/09/24 19:42:51 UTC

svn commit: r1627373 - in /tomee/tomee/trunk/arquillian: arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/ arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/

Author: rmannibucau
Date: Wed Sep 24 17:42:50 2014
New Revision: 1627373

URL: http://svn.apache.org/r1627373
Log:
TOMEE-1362 WsRsTest was broken + avoid warning in tomee injection enricher when not relevant

Modified:
    tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java
    tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/WsRsTest.java

Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java?rev=1627373&r1=1627372&r2=1627373&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-common/src/main/java/org/apache/openejb/arquillian/common/TomEEInjectionEnricher.java Wed Sep 24 17:42:50 2014
@@ -71,7 +71,9 @@ public class TomEEInjectionEnricher impl
             }
         }
 
-        Logger.getLogger(TomEEInjectionEnricher.class.getName()).log(Level.WARNING, "Failed to find AppContext for: " + clazzName);
+        if (deployment != null && deployment.get() != null && deployment.get().getDescription().testable()) {
+            Logger.getLogger(TomEEInjectionEnricher.class.getName()).log(Level.WARNING, "Failed to find AppContext for: " + clazzName);
+        }
 
         return null;
     }

Modified: tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/WsRsTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/WsRsTest.java?rev=1627373&r1=1627372&r2=1627373&view=diff
==============================================================================
--- tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/WsRsTest.java (original)
+++ tomee/tomee/trunk/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxws-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxws/wsrs/WsRsTest.java Wed Sep 24 17:42:50 2014
@@ -27,11 +27,16 @@ import org.jboss.arquillian.container.te
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.arquillian.test.api.ArquillianResource;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptors;
+import org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor;
+import org.jboss.shrinkwrap.descriptor.api.webcommon30.WebAppVersionType;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import javax.ws.rs.core.Application;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URI;
@@ -51,7 +56,24 @@ public class WsRsTest {
     @Deployment(testable = false)
     public static WebArchive createDeployment() {
         return ShrinkWrap.create(WebArchive.class, WsRsTest.class.getName().concat(".war"))
-                .addClasses(Bean.class);
+                .addClasses(Bean.class)
+                // jaxws and jaxrs are "servlets" so if one (jaxrs here) binds to /* then the other one is not accessible depending deployment order
+                .setWebXML(new StringAsset(
+                        Descriptors.create(WebAppDescriptor.class)
+                            .version(WebAppVersionType._3_0)
+                            .getOrCreateServlet()
+                                .servletName("jaxrs")
+                                .servletClass(Application.class.getName())
+                                .createInitParam()
+                                    .paramName(Application.class.getName())
+                                    .paramValue(Application.class.getName())
+                                .up()
+                            .up()
+                            .getOrCreateServletMapping()
+                                .servletName("jaxrs")
+                                .urlPattern("/api")
+                            .up()
+                            .exportAsString()));
     }
 
     @Test
@@ -63,7 +85,7 @@ public class WsRsTest {
                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
                 "  <soap:Body>\n" +
-                "    <ns1:hello xmlns:ns1=\"http://wsrs.jaxws.tests.arquillian.tomee.apache.org/\"/>\n" +
+                "    <ns1:hello xmlns:ns1=\"http://wsrs.jaxws.tests.arquillian.openejb.apache.org/\"/>\n" +
                 "  </soap:Body>\n" +
                 "</soap:Envelope>"));
 
@@ -73,7 +95,7 @@ public class WsRsTest {
         final String expected = "" +
                 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
                 "<soap:Body>" +
-                "<ns:helloResponse xmlns:ns=\"http://wsrs.jaxws.tests.arquillian.tomee.apache.org/\">" +
+                "<ns:helloResponse xmlns:ns=\"http://wsrs.jaxws.tests.arquillian.openejb.apache.org/\">" +
                 "<return>hola</return>" +
                 "</ns:helloResponse>" +
                 "</soap:Body>" +
@@ -84,7 +106,7 @@ public class WsRsTest {
 
     @Test
     public void invokeRest() throws Exception {
-        final URI uri = new URI(url.toExternalForm() + "rest/bean");
+        final URI uri = new URI(url.toExternalForm() + "api/rest/bean");
 
         final HttpGet get = new HttpGet(uri);
         final HttpResponse response = client.execute(get);
@@ -93,7 +115,7 @@ public class WsRsTest {
         Assert.assertEquals("hola", body);
     }
 
-    public static String asString(HttpResponse execute) throws IOException {
+    public static String asString(final HttpResponse execute) throws IOException {
         final InputStream in = execute.getEntity().getContent();
         try {
             return IO.slurp(in);