You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/04/19 21:52:12 UTC
tomee git commit: TOMEE-2183 missed on previous commit
Repository: tomee
Updated Branches:
refs/heads/master 2f93f9623 -> ff7856983
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/ff785698
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/ff785698
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/ff785698
Branch: refs/heads/master
Commit: ff78569839e82752e0abfa91dbb99132482208bb
Parents: 2f93f96
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Thu Apr 19 22:51:41 2018 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Thu Apr 19 22:51:41 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/ff785698/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/ff785698/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/ff785698/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);
+ }
+
+
+}