TOMEE-2183 missed on previous commit

Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/f3c5c2d6
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/f3c5c2d6
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/f3c5c2d6

Branch: refs/heads/master
Commit: f3c5c2d6ed96f6b1bb7ea2a611a0c5f3fa712970
Parents: 754c8d6
Author: Jonathan Gallimore <[email protected]>
Authored: Thu Apr 19 22:51:41 2018 +0100
Committer: Jonathan Gallimore <[email protected]>
Committed: Thu Apr 19 22:52:34 2018 +0100

----------------------------------------------------------------------
 .../openejb/arquillian/tests/ear/CodecBean.java | 32 +++++++++
 .../arquillian/tests/ear/CodecServlet.java      | 44 ++++++++++++
 .../tests/ear/EarCommonsCodecTest.java          | 73 ++++++++++++++++++++
 3 files changed, 149 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/f3c5c2d6/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecBean.java
----------------------------------------------------------------------
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecBean.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecBean.java
new file mode 100644
index 0000000..564c7a5
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecBean.java
@@ -0,0 +1,32 @@
+/*
+ * 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.ear;
+
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.ejb.Singleton;
+
+@Singleton
+public class CodecBean {
+
+    public String test() {
+        return 
Base64.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f3c5c2d6/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecServlet.java
----------------------------------------------------------------------
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecServlet.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecServlet.java
new file mode 100644
index 0000000..0db41a3
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/CodecServlet.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ear;
+
+import org.apache.commons.codec.binary.Base64;
+
+import javax.ejb.EJB;
+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 = "/codec")
+public class CodecServlet extends HttpServlet {
+
+    @EJB
+    private CodecBean bean;
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException, IOException {
+        final String ejbLoadedFrom = bean.test();
+        final String loadedFrom = 
Base64.class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
+
+        resp.getWriter().println("EJB loaded Commons Codec Base64 from: " + 
ejbLoadedFrom);
+        resp.getWriter().println("Servlet loaded Commons Codec Base64 from: " 
+ loadedFrom);
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/f3c5c2d6/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarCommonsCodecTest.java
----------------------------------------------------------------------
diff --git 
a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarCommonsCodecTest.java
 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarCommonsCodecTest.java
new file mode 100644
index 0000000..7fa3101
--- /dev/null
+++ 
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/ear/EarCommonsCodecTest.java
@@ -0,0 +1,73 @@
+/*
+ * 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.ear;
+
+import org.apache.ziplock.IO;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.Maven;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@RunWith(Arquillian.class)
+public class EarCommonsCodecTest {
+
+    @ArquillianResource
+    private URL url;
+
+    @Deployment(testable = false)
+    public static EnterpriseArchive createDeployment() {
+
+        final File[] codecLibs = 
Maven.resolver().resolve("commons-codec:commons-codec:1.11").withTransitivity().asFile();
+
+        final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, 
"beans.jar");
+        ejbJar.addClass(CodecBean.class);
+
+        final WebArchive webapp = ShrinkWrap.create(WebArchive.class, 
"servlet.war").addClass(CodecServlet.class);
+
+        final EnterpriseArchive ear = 
ShrinkWrap.create(EnterpriseArchive.class, 
"codec.ear").addAsModule(ejbJar).addAsModule(webapp);
+        ear.addAsLibraries(codecLibs);
+
+        System.out.println(ear.toString(true));
+
+        ear.as(ZipExporter.class).exportTo(new File("/tmp/codec.ear"));
+
+        return ear;
+    }
+
+    @Test
+    public void test() throws Exception {
+        final URL servlet = new URL(url, "/codec/servlet/codec");
+        final String slurp = IO.slurp(servlet);
+
+        System.out.println(slurp);
+    }
+
+
+}

Reply via email to