This is an automated email from the ASF dual-hosted git repository.

radcortez pushed a commit to branch TOMEE-2408
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 3f59d382b12ebc17b2d1fc9e587486d55fc4a749
Author: Roberto Cortez <radcor...@yahoo.com>
AuthorDate: Thu Jan 31 18:35:02 2019 +0000

    TOMEE-2462 - Added test to verify servlets, default servlet and rest 
endpoints execution.
---
 .../arquillian/tests/jaxrs/servlets/Echo.java      | 28 +++++++++++++
 .../tests/jaxrs/servlets/RestWithServletsTest.java | 49 ++++++++++++++++++++++
 .../tests/jaxrs/servlets/RootServlet.java          | 33 +++++++++++++++
 .../arquillian/tests/jaxrs/servlets/Servlet.java   | 33 +++++++++++++++
 .../arquillian/tests/jaxrs/servlets/ok.html        |  1 +
 5 files changed, 144 insertions(+)

diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java
new file mode 100644
index 0000000..eba9000
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Echo.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+
+@Path("/echo")
+public class Echo {
+    @GET
+    public String ok() {
+        return "ok!";
+    }
+}
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java
new file mode 100644
index 0000000..8b4e214
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RestWithServletsTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import org.apache.openejb.arquillian.tests.jaxrs.JaxrsTest;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Arquillian.class)
+public class RestWithServletsTest extends JaxrsTest {
+    @Deployment(testable = false)
+    public static WebArchive archive() {
+        final WebArchive webArchive =
+                ShrinkWrap.create(WebArchive.class)
+                          .addClass(Echo.class)
+                          .addClass(Servlet.class)
+                          
.addAsWebResource("org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html", 
"ok.html");
+        System.out.println(webArchive.toString(true));
+        return webArchive;
+    }
+
+    @Test
+    public void servlets() throws Exception {
+        assertTrue(get("/ok.html").contains("<html><body>ok!</body></html>"));
+        assertEquals("ok!", get("/servlet"));
+        assertEquals("ok!", get("/echo"));
+    }
+}
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java
new file mode 100644
index 0000000..62ebcfc
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/RootServlet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebServlet(urlPatterns = "/")
+public class RootServlet extends HttpServlet {
+    @Override
+    protected void doGet(final HttpServletRequest req, final 
HttpServletResponse resp)
+            throws ServletException, IOException {
+        resp.getWriter().write("ok!");
+    }
+}
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java
new file mode 100644
index 0000000..6db6f78
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/java/org/apache/openejb/arquillian/tests/jaxrs/servlets/Servlet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.arquillian.tests.jaxrs.servlets;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+@WebServlet(urlPatterns = "/servlet")
+public class Servlet extends HttpServlet {
+    @Override
+    protected void doGet(final HttpServletRequest req, final 
HttpServletResponse resp)
+            throws ServletException, IOException {
+        resp.getWriter().write("ok!");
+    }
+}
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html
new file mode 100644
index 0000000..c7be294
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-jaxrs-tests/src/test/resources/org/apache/openejb/arquillian/tests/jaxrs/servlets/ok.html
@@ -0,0 +1 @@
+<html><body>ok!</body></html>

Reply via email to