-
- Go home.
-
-
+public interface BeanMessageInterface {
+
+ String getMessage();
+
+ void setMessage(String message);
+
+ void appendMessage(String message);
+
+ String sayHello();
+
+}
diff --git a/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRoot.java b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRoot.java
new file mode 100644
index 000000000..e75ac0fe1
--- /dev/null
+++ b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRoot.java
@@ -0,0 +1,122 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+// Portions Copyright [2018] [Payara Foundation and/or its affiliates]
+package org.javaee7.jacc.contexts.bean;
+
+import java.io.FilePermission;
+import java.security.AccessControlException;
+import java.security.AccessController;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.EJB;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+
+@Singleton
+@Startup
+public class BeanRoot implements BeanRootInterface {
+
+ @EJB
+ private BeanLeaf bl;
+
+ @EJB
+ private BeanMessageInterface msg;
+
+ String MESSAGE_POST = "PostBeanRoot";
+ String MESSAGE_HELLO = "HelloBeanRoot";
+
+ @Override
+ @PostConstruct
+ public void afterConstruct() {
+ if (msg != null && !msg.getMessage().contains(MESSAGE_POST)) {
+ msg.appendMessage(MESSAGE_POST);
+ }
+ String h = bl.sayHello();
+ System.out.println("** BeanRoot: Hello from beanLeaf: " + h);
+ }
+
+ @Override
+ public String sayHello() {
+ if (msg != null && !msg.getMessage().contains(MESSAGE_HELLO)) {
+ msg.appendMessage(MESSAGE_HELLO);
+ }
+
+ StringBuffer check = new StringBuffer(" -EJB test-");
+
+ FilePermission fp = new FilePermission("/scratch/spei/bug/test/war.txt", "delete");
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(fp);
+ check.append("BeanRoot - success for WAR.txt; ");
+ } else
+ check.append("BeanRoot - bypass for WAR.txt; ");
+ } catch (AccessControlException e) {
+ check.append("BeanRoot - failed for WAR.txt; ");
+ }
+
+ fp = new FilePermission("/scratch/spei/bug/test/ear.txt", "delete");
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(fp);
+ check.append("BeanRoot - success for EAR.txt; ");
+ } else
+ check.append("BeanRoot - bypass for EAR.txt; ");
+ } catch (AccessControlException e) {
+ check.append("BeanRoot - failed for EAR.txt; ");
+ }
+
+ fp = new FilePermission("/scratch/spei/bug/test/ejb.txt", "delete");
+ final FilePermission p1 = fp;
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(p1);
+ check.append("BeanRoot - success for EJB.txt; ");
+ } else
+ check.append("BeanRoot - bypass for EJB.txt; ");
+ } catch (AccessControlException e) {
+ check.append("BeanRoot - failed for EJB.txt; " + e.getMessage());
+ }
+
+ return "Hello from: " + this.getClass().getName() + "; "
+ + check.toString() + " , code= "
+ + System.identityHashCode(this);
+ }
+
+}
diff --git a/servlet/security-form-based/src/main/webapp/index.jsp b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRootInterface.java
similarity index 79%
rename from servlet/security-form-based/src/main/webapp/index.jsp
rename to jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRootInterface.java
index 734e4f816..f1dec1ae1 100644
--- a/servlet/security-form-based/src/main/webapp/index.jsp
+++ b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/bean/BeanRootInterface.java
@@ -1,4 +1,3 @@
-
+// Portions Copyright [2018] [Payara Foundation and/or its affiliates]
+package org.javaee7.jacc.contexts.bean;
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
+public interface BeanRootInterface {
-
-
-
- Form-based Security - Success
-
-
-
Form-based Security - Success
-
- If you reached this page that means form-based security credentials are correctly configured.
-
-
+ void afterConstruct();
+
+ String sayHello();
+
+}
diff --git a/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/servlet/TestServlet.java b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/servlet/TestServlet.java
new file mode 100644
index 000000000..379321d8d
--- /dev/null
+++ b/jacc/permissions-xml/src/main/java/org/javaee7/jacc/contexts/servlet/TestServlet.java
@@ -0,0 +1,203 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+// Portions Copyright [2018] [Payara Foundation and/or its affiliates]
+package org.javaee7.jacc.contexts.servlet;
+
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.AccessControlException;
+import java.security.AccessController;
+
+import javax.ejb.EJB;
+import javax.naming.InitialContext;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.javaee7.jacc.contexts.bean.BeanMessageInterface;
+import org.javaee7.jacc.contexts.bean.BeanRootInterface;
+
+public class TestServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ @EJB
+ private BeanRootInterface root;
+
+ @EJB
+ private BeanMessageInterface msg;
+
+ private String message;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ message = msg.getMessage();
+ System.out.println("servlet init: message=" + message);
+ }
+
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/plain");
+ PrintWriter out = response.getWriter();
+ String EXPECTED_RESULT = "PostBeanRootPostBeanLeafHelloBeanLeaf";
+ boolean status = false;
+
+ try {
+
+ String testcase = request.getParameter("tc");
+ out.println("testcase = " + testcase);
+ out.println("TestServlet");
+ out.println("contextPath=" + request.getContextPath());
+
+ if (testcase != null) {
+
+ if ("InjectLookup".equals(testcase)) {
+ // EJB injection check
+ // out.println("injected root: " + root);
+ String hello = root.sayHello();
+ out.println("Hello from injected bean: " + hello);
+
+ // EJB lookup check
+ InitialContext initialContext = new InitialContext();
+
+
+ String EJBlookupName = null;
+ if (request.getParameter("web") == null) {
+
+ // For war inside ears:
+
+ // "java"glabal[/]//"
+ // app-name -- name of ear file (option)
+ // module-name -- name of war or jar file
+ // bean-name -- name of ejb
+
+ EJBlookupName = "java:global/appperms/apppermsEJB/BeanRoot";
+ } else {
+ // For standalone war:
+ EJBlookupName = "java:module/BeanRoot";
+ }
+
+ BeanRootInterface root2 = (BeanRootInterface) initialContext.lookup(EJBlookupName);
+
+ // out.println("global root: " + root2);
+ String hello2 = root2.sayHello();
+ out.println("Hello from lookup bean: " + hello2);
+
+ StringBuffer checkReport = new StringBuffer(" -Servlet test- ");
+ FilePermission filePermission = new FilePermission("/scratch/spei/bug/test/war.txt", "delete");
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(filePermission);
+ checkReport.append("servlet - success for WAR.txt; ");
+ } else
+ checkReport.append("servlet - bypass for WAR.txt; ");
+
+ } catch (AccessControlException e) {
+ checkReport.append("servlet - failed for WAR.txt; ");
+ }
+
+ filePermission = new FilePermission("/scratch/spei/bug/test/ear.txt", "delete");
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(filePermission);
+ checkReport.append("servlet - success for EAR.txt; ");
+ } else
+ checkReport.append("servlet - bypass for EAR.txt; ");
+ } catch (AccessControlException e) {
+ checkReport.append("servlet - failed for EAR.txt; ");
+ }
+
+ filePermission = new FilePermission("/scratch/spei/bug/test/ejb.txt", "delete");
+ try {
+ if (System.getSecurityManager() != null) {
+ AccessController.checkPermission(filePermission);
+ checkReport.append("servlet - success for EJB.txt; ");
+ } else
+ checkReport.append("servlet - bypass for EJB.txt; ");
+ } catch (AccessControlException e) {
+ checkReport.append("servlet - failed for EJB.txt; ");
+ }
+
+ String checkReportString = checkReport.toString();
+ out.println("test: " + checkReportString);
+
+ if (hello.equals(hello2) && !checkReportString.contains("failed") && !hello.contains("failed")) {
+ status = true;
+ }
+ } else if ("Startup".equals(testcase)) {
+ // Deployment check for startup
+ out.println("message by deployment: " + message);
+ if (message != null && message.equals(EXPECTED_RESULT)) {
+ status = true;
+ }
+ }
+ }
+
+ } catch (Throwable th) {
+ th.printStackTrace(out);
+ } finally {
+ if (status) {
+ out.println("Test:Pass");
+ } else {
+ out.println("Test:Fail");
+ }
+ out.close();
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }
+
+}
diff --git a/jacc/permissions-xml/src/main/resources/META-INF/application.xml b/jacc/permissions-xml/src/main/resources/META-INF/application.xml
new file mode 100644
index 000000000..8557113cc
--- /dev/null
+++ b/jacc/permissions-xml/src/main/resources/META-INF/application.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+ app-perms
+
+
+ apppermsEJB.jar
+
+
+
+
+ apppermsWeb.war
+ appperms
+
+
+
+
diff --git a/jacc/permissions-xml/src/main/resources/META-INF/permissions.xml b/jacc/permissions-xml/src/main/resources/META-INF/permissions.xml
new file mode 100644
index 000000000..f32a0f756
--- /dev/null
+++ b/jacc/permissions-xml/src/main/resources/META-INF/permissions.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+ java.io.FilePermission
+ /scratch/spei/bug/test/ear.txt
+ read,write,delete
+
+
+
+ java.io.FilePermission
+ /scratch/spei/bug/test/war.txt
+ read,write,delete
+
+
+
+ java.io.FilePermission
+ /scratch/spei/bug/test/ejb.txt
+ read,write,delete
+
+
+
+ java.lang.RuntimePermission
+ createClassLoader
+
+
+
\ No newline at end of file
diff --git a/jacc/permissions-xml/src/main/webapp/WEB-INF/web.xml b/jacc/permissions-xml/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 000000000..e49a81f4e
--- /dev/null
+++ b/jacc/permissions-xml/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+ TestServlet
+ org.javaee7.jacc.contexts.servlet.TestServlet
+
+
+ TestServlet
+ /test/*
+
+
diff --git a/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLEarTest.java b/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLEarTest.java
new file mode 100644
index 000000000..831de61bf
--- /dev/null
+++ b/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLEarTest.java
@@ -0,0 +1,120 @@
+/** Copyright Payara Services Limited **/
+package org.javaee7.jacc.permissionsxml;
+
+import static javax.ws.rs.client.ClientBuilder.newClient;
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
+import static org.jboss.shrinkwrap.api.ShrinkWrap.create;
+import static org.junit.Assert.assertTrue;
+import static org.junit.runners.MethodSorters.NAME_ASCENDING;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.ws.rs.core.Response;
+
+import org.javaee7.jacc.contexts.bean.BeanRoot;
+import org.javaee7.jacc.contexts.servlet.TestServlet;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This tests demonstrates the usage of a permissions.xml file inside
+ * an ear which contains both a web module and an EJB module.
+ *
+ * @author Arjan Tijms
+ *
+ */
+@RunWith(Arquillian.class)
+@FixMethodOrder(NAME_ASCENDING)
+public class PermissionsXMLEarTest {
+
+ private static final String WEBAPP_SRC = "src/main/webapp";
+
+ @ArquillianResource
+ private URL base;
+
+ @Deployment
+ public static Archive> deploy() {
+ if (System.getProperty("skipEAR") != null) {
+ return create(WebArchive.class);
+ }
+
+ return
+ // EAR module
+ create(EnterpriseArchive.class, "appperms.ear")
+
+ // Add permissions.xml, which is the main file we're testing
+ .addAsResource("META-INF/permissions.xml")
+ .setApplicationXML("META-INF/application.xml")
+
+ // EJB module
+ .addAsModule(
+ create(JavaArchive.class, "apppermsEJB.jar")
+
+ // Java classes containing the actual permission tests
+ // They are in the EJB module so we test the permissions work there
+ .addPackage(BeanRoot.class.getPackage())
+ )
+
+ // Web module
+ .addAsModule(
+ create(WebArchive.class, "apppermsWeb.war")
+ .addAsWebInfResource((new File(WEBAPP_SRC + "/WEB-INF", "web.xml")))
+
+ // This class kicks off the EJB tests, but also contains tests of its own.
+ // These own tests are there to test if the permissions also work in a web module
+ .addClass(TestServlet.class)
+ );
+ }
+
+
+ @Test
+ @RunAsClient
+ public void test1Startup() throws IOException, URISyntaxException {
+ if (System.getProperty("skipEAR") != null) {
+ return;
+ }
+
+ System.out.println("Testing Servlet from war from ear deployed at " + new URL(base, "test").toExternalForm());
+
+ Response response =
+ newClient()
+ .target(new URL(base, "test").toURI())
+ .queryParam("tc", "Startup")
+ .request(TEXT_PLAIN)
+ .get();
+
+ assertTrue(response.readEntity(String.class).contains("Test:Pass"));
+ }
+
+ @Test
+ @RunAsClient
+ public void test2PermissionsXML() throws IOException, URISyntaxException {
+ if (System.getProperty("skipEAR") != null) {
+ return;
+ }
+
+ System.out.println("Running actual permissions.xml test");
+
+ Response response =
+ newClient()
+ .target(new URL(base, "test").toURI())
+ .queryParam("tc", "InjectLookup")
+ .request(TEXT_PLAIN)
+ .get();
+
+ assertTrue(response.readEntity(String.class).contains("Test:Pass"));
+ }
+
+}
\ No newline at end of file
diff --git a/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLServletTest.java b/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLServletTest.java
new file mode 100644
index 000000000..22bd960d2
--- /dev/null
+++ b/jacc/permissions-xml/src/test/java/org/javaee7/jacc/permissionsxml/PermissionsXMLServletTest.java
@@ -0,0 +1,93 @@
+/** Copyright Payara Services Limited **/
+package org.javaee7.jacc.permissionsxml;
+
+import static javax.ws.rs.client.ClientBuilder.newClient;
+import static javax.ws.rs.core.MediaType.TEXT_PLAIN;
+import static org.jboss.shrinkwrap.api.ShrinkWrap.create;
+import static org.junit.Assert.assertTrue;
+import static org.junit.runners.MethodSorters.NAME_ASCENDING;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.ws.rs.core.Response;
+
+import org.javaee7.jacc.contexts.bean.BeanRoot;
+import org.javaee7.jacc.contexts.servlet.TestServlet;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * This tests demonstrates the usage of a permissions.xml file inside
+ * a standalone war
+ *
+ * @author Arjan Tijms
+ *
+ */
+@RunWith(Arquillian.class)
+@FixMethodOrder(NAME_ASCENDING)
+public class PermissionsXMLServletTest {
+
+ private static final String WEBAPP_SRC = "src/main/webapp";
+
+ @ArquillianResource
+ private URL base;
+
+ @Deployment
+ public static Archive> deploy() {
+
+ return
+ create(WebArchive.class)
+ // Add permissions.xml, which is the main file we're testing
+ .addAsResource("META-INF/permissions.xml")
+ .addAsWebInfResource((new File(WEBAPP_SRC + "/WEB-INF", "web.xml")))
+
+ // This class kicks off the EJB tests (which reside with the web module),
+ // but also contains tests of its own
+ .addClass(TestServlet.class)
+ .addPackage(BeanRoot.class.getPackage())
+ ;
+ }
+
+
+ @Test
+ @RunAsClient
+ public void test1Startup() throws IOException, URISyntaxException {
+ System.out.println("Testing Servlet from war deployed at " + new URL(base, "test"));
+
+ Response response =
+ newClient()
+ .target(new URL(base, "test").toURI())
+ .queryParam("tc", "Startup")
+ .request(TEXT_PLAIN)
+ .get();
+
+ assertTrue(response.readEntity(String.class).contains("Test:Pass"));
+ }
+
+ @Test
+ @RunAsClient
+ public void test2PermissionsXML() throws IOException, URISyntaxException {
+ System.out.println("Running actual permissions.xml test");
+
+ Response response =
+ newClient()
+ .target(new URL(base, "test").toURI())
+ .queryParam("tc", "InjectLookup")
+ .queryParam("web", "true")
+ .request(TEXT_PLAIN)
+ .get();
+
+ assertTrue(response.readEntity(String.class).contains("Test:Pass"));
+ }
+
+}
\ No newline at end of file
diff --git a/jacc/pom.xml b/jacc/pom.xml
index 332609e23..eeb4171f3 100644
--- a/jacc/pom.xml
+++ b/jacc/pom.xml
@@ -1,21 +1,19 @@
-
- 4.0.0
-
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xml
- org.javaee7
+
jacc
- 1.0-SNAPSHOTpom
+
Java EE 7 Sample: jacccontexts
+ permissions-xml
@@ -23,6 +21,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jaspic/basic-authentication/pom.xml b/jaspic/basic-authentication/pom.xml
index 17bb1bf47..8c520010e 100644
--- a/jaspic/basic-authentication/pom.xml
+++ b/jaspic/basic-authentication/pom.xml
@@ -6,11 +6,9 @@
org.javaee7jaspic1.0-SNAPSHOT
- ../pom.xml
- org.javaee7
+
jaspic-basic-authentication
- 1.0-SNAPSHOTwarJava EE 7 Sample: jaspic - basic-authentication
diff --git a/jaspic/common/pom.xml b/jaspic/common/pom.xml
index ed3a7ca7b..069b74319 100644
--- a/jaspic/common/pom.xml
+++ b/jaspic/common/pom.xml
@@ -5,19 +5,39 @@
it provides a base class for unit tests
-->
4.0.0
-
-
- org.javaee7
- jaspic
- 1.0-SNAPSHOT
-
+ org.javaee7jaspic-common
+ 1.0-SNAPSHOTjarJava EE 7 Sample: jaspic - common
+
+
+ UTF-8
+ 1.7
+ 1.7
+
+
+
+
+
+ org.jboss.arquillian
+ arquillian-bom
+ 1.1.14.Final
+ import
+ pom
+
+
+
+
+ javax
+ javaee-api
+ 7.0
+ provided
+ org.jboss.arquillian.junitarquillian-junit-container
@@ -26,19 +46,19 @@
junitjunit
- 4.11
+ 4.13.1providednet.sourceforge.htmlunithtmlunit
- 2.31
+ 2.37.0providedorg.jsoupjsoup
- 1.9.1
+ 1.14.2
diff --git a/jaspic/common/src/main/java/org/javaee7/jaspic/common/ArquillianBase.java b/jaspic/common/src/main/java/org/javaee7/jaspic/common/ArquillianBase.java
index 2771fc4b5..b2f0e9687 100644
--- a/jaspic/common/src/main/java/org/javaee7/jaspic/common/ArquillianBase.java
+++ b/jaspic/common/src/main/java/org/javaee7/jaspic/common/ArquillianBase.java
@@ -9,10 +9,13 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.Map;
import java.util.logging.Logger;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.Node;
import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
@@ -69,13 +72,24 @@ public static Archive> defaultArchive() {
}
public static WebArchive defaultWebArchive() {
- return
- create(WebArchive.class, "test.war")
- .addPackages(true, "org.javaee7.jaspic")
- .deleteClass(ArquillianBase.class)
- .addAsWebInfResource(resource("web.xml"))
- .addAsWebInfResource(resource("jboss-web.xml"))
- .addAsWebInfResource(resource("glassfish-web.xml"));
+ return
+ removeTestClasses(
+ create(WebArchive.class, "test.war")
+ .addPackages(true, "org.javaee7.jaspic")
+ .addAsWebInfResource(resource("web.xml"))
+ .addAsWebInfResource(resource("jboss-web.xml"))
+ .addAsWebInfResource(resource("glassfish-web.xml")));
+ }
+
+ private static WebArchive removeTestClasses(WebArchive archive) {
+ for (Map.Entry content : archive.getContent().entrySet()) {
+ if (content.getKey().get().endsWith("Test.class")) {
+ archive.delete(content.getKey().get());
+ }
+ }
+ archive.deleteClass(ArquillianBase.class);
+
+ return archive;
}
public static Archive> tryWrapEAR(WebArchive webArchive) {
diff --git a/jaspic/pom.xml b/jaspic/pom.xml
index 06abedd7c..fe046c0b3 100644
--- a/jaspic/pom.xml
+++ b/jaspic/pom.xml
@@ -1,12 +1,10 @@
-
- 4.0.0
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xmljaspic
@@ -83,6 +81,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/javamail/pom.xml b/javamail/pom.xml
index 4f4fd1611..428c8e563 100644
--- a/javamail/pom.xml
+++ b/javamail/pom.xml
@@ -1,17 +1,15 @@
-
- 4.0.0
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xml
- org.javaee7
+
javamail
- 1.0-SNAPSHOTpom
+
Java EE 7 Sample: javamail
@@ -23,6 +21,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jaxrpc/jaxrpc-security/pom.xml b/jaxrpc/jaxrpc-security/pom.xml
index dcc9c6c31..37c76a192 100644
--- a/jaxrpc/jaxrpc-security/pom.xml
+++ b/jaxrpc/jaxrpc-security/pom.xml
@@ -32,7 +32,7 @@
org.apache.antant
- 1.7.0
+ 1.10.11
diff --git a/jaxrpc/pom.xml b/jaxrpc/pom.xml
index 0e508e6e8..fee49f706 100644
--- a/jaxrpc/pom.xml
+++ b/jaxrpc/pom.xml
@@ -21,6 +21,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jaxrs/pom.xml b/jaxrs/pom.xml
index f1d37011d..9b8a7fe46 100644
--- a/jaxrs/pom.xml
+++ b/jaxrs/pom.xml
@@ -9,6 +9,7 @@
jaxrspom
+
Java EE 7 Sample: jaxrs
@@ -48,6 +49,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jaxws/jaxws-client/README.md b/jaxws/jaxws-client/README.md
new file mode 100644
index 000000000..bf6b5ca41
--- /dev/null
+++ b/jaxws/jaxws-client/README.md
@@ -0,0 +1,2 @@
+This JAX-WS sample generated Java service class from a .wsdl file, deploys the endpoint war generated by javaee7-samples/jaxws/jaxws-endpoint
+and then tests against that.
\ No newline at end of file
diff --git a/jaxws/jaxws-client/pom.xml b/jaxws/jaxws-client/pom.xml
index 8865e592b..cbdc0d008 100644
--- a/jaxws/jaxws-client/pom.xml
+++ b/jaxws/jaxws-client/pom.xml
@@ -1,13 +1,12 @@
-
- 4.0.0
+4.0.0org.javaee7jaxws1.0-SNAPSHOT
- ../pom.xml
+
jaxws-jaxws-clientwarJava EE 7 Sample: jaxws - jaxws-client
@@ -17,21 +16,40 @@
- org.codehaus.mojo
+ com.helger.mavenjaxws-maven-plugin
- 1.11
+ 2.6.2generate-sources
+
wsimportorg.javaee7.jaxws.client.gen
+
+
+
+
+
- ../../../jaxws-endpoint/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService.wsdl
+ ${basedir}/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService.wsdl
+
http://localhost:8080/jaxws-endpoint/EBookStoreImplService?wsdl
+
true${basedir}/src/main/java2.1
diff --git a/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService.wsdl b/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService.wsdl
new file mode 100644
index 000000000..b90f97e63
--- /dev/null
+++ b/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService.wsdl
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService_schema1.xsd b/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService_schema1.xsd
new file mode 100644
index 000000000..b18b382cd
--- /dev/null
+++ b/jaxws/jaxws-client/src/main/webapp/WEB-INF/wsdl/EBookStoreImplService_schema1.xsd
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxws/jaxws-client/src/test/java/org/javaee7/jaxws/client/EBookStoreClientSampleTest.java b/jaxws/jaxws-client/src/test/java/org/javaee7/jaxws/client/EBookStoreClientSampleTest.java
index 471fe053a..9d63e4ff7 100644
--- a/jaxws/jaxws-client/src/test/java/org/javaee7/jaxws/client/EBookStoreClientSampleTest.java
+++ b/jaxws/jaxws-client/src/test/java/org/javaee7/jaxws/client/EBookStoreClientSampleTest.java
@@ -1,6 +1,7 @@
package org.javaee7.jaxws.client;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.runners.MethodSorters.NAME_ASCENDING;
import java.net.MalformedURLException;
import java.net.URL;
@@ -12,35 +13,29 @@
import org.javaee7.jaxws.client.gen.EBook;
import org.javaee7.jaxws.client.gen.EBookStore;
import org.javaee7.jaxws.client.gen.EBookStoreImplService;
-
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.resolver.api.maven.archive.importer.MavenImporter;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
-
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
/**
* @author Fermin Gallego
*/
@RunWith(Arquillian.class)
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@FixMethodOrder(NAME_ASCENDING)
public class EBookStoreClientSampleTest {
+
+ @ArquillianResource
+ private URL url;
+
private static EBookStoreImplService eBookStoreService;
- /**
- * Method for creating and deploying the war file from 'jaxws-endpoint' project,
- * which contains the web service to be tested.
- *
- * @return a war file
- */
@Deployment(testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(MavenImporter.class)
@@ -49,9 +44,6 @@ public static WebArchive createDeployment() {
.as(WebArchive.class);
}
- @ArquillianResource
- private URL url;
-
@Before
public void setUp() throws Exception {
eBookStoreService = new EBookStoreImplService(
diff --git a/jaxws/jaxws-endpoint-ejb/pom.xml b/jaxws/jaxws-endpoint-ejb/pom.xml
new file mode 100644
index 000000000..16e0c9db2
--- /dev/null
+++ b/jaxws/jaxws-endpoint-ejb/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+
+ org.javaee7
+ jaxws
+ 1.0-SNAPSHOT
+
+
+ jaxws-jaxws-endpoint-ejb
+ war
+ Java EE 7 Sample: jaxws - jaxws-endpoint - EJB
+
+
+ jaxws-endpoint-ejb
+
+
+
+
+ org.eclipse.microprofile.opentracing
+ microprofile-opentracing-api
+ 1.0
+ provided
+
+
+
+ io.opentracing
+ opentracing-api
+ 0.30.0
+ provided
+
+
+
diff --git a/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStore.java b/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStore.java
new file mode 100644
index 000000000..26900d4fe
--- /dev/null
+++ b/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStore.java
@@ -0,0 +1,22 @@
+/** Copyright Payara Services Limited **/
+package org.javaee7.jaxws.endpoint.ejb;
+
+import static javax.jws.soap.SOAPBinding.Style.RPC;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ *
+ * @author Fermin Gallego
+ * @author Arjan Tijms
+ *
+ */
+@WebService
+@SOAPBinding(style = RPC)
+public interface EBookStore {
+
+ @WebMethod
+ String welcomeMessage(String name);
+}
diff --git a/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreImpl.java b/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreImpl.java
new file mode 100644
index 000000000..426996f75
--- /dev/null
+++ b/jaxws/jaxws-endpoint-ejb/src/main/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreImpl.java
@@ -0,0 +1,22 @@
+/** Copyright Payara Services Limited **/
+package org.javaee7.jaxws.endpoint.ejb;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+/**
+ *
+ * @author Fermin Gallego
+ * @author Arjan Tijms
+ *
+ */
+@Stateless
+@WebService(endpointInterface = "org.javaee7.jaxws.endpoint.ejb.EBookStore")
+public class EBookStoreImpl implements EBookStore {
+
+ @Override
+ public String welcomeMessage(String name) {
+ return "Welcome to EBookStore WebService, Mr/Mrs " + name;
+ }
+
+}
diff --git a/jaxws/jaxws-endpoint-ejb/src/test/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreTest.java b/jaxws/jaxws-endpoint-ejb/src/test/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreTest.java
new file mode 100644
index 000000000..269d8653f
--- /dev/null
+++ b/jaxws/jaxws-endpoint-ejb/src/test/java/org/javaee7/jaxws/endpoint/ejb/EBookStoreTest.java
@@ -0,0 +1,64 @@
+/** Copyright Payara Services Limited **/
+package org.javaee7.jaxws.endpoint.ejb;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.runners.MethodSorters.NAME_ASCENDING;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.javaee7.jaxws.endpoint.ejb.EBookStore;
+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.spec.WebArchive;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Fermin Gallego
+ * @author Arjan Tijms
+ */
+@RunWith(Arquillian.class)
+@FixMethodOrder(NAME_ASCENDING)
+public class EBookStoreTest {
+
+ @ArquillianResource
+ private URL url;
+
+ private URL rootUrl;
+
+ private static Service eBookStoreService;
+
+ @Deployment(testable = false)
+ public static WebArchive createDeployment() {
+ return ShrinkWrap.create(WebArchive.class).
+ addPackage("org.javaee7.jaxws.endpoint.ejb");
+ }
+
+ @Before
+ public void setupClass() throws MalformedURLException {
+ rootUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(), "");
+
+ eBookStoreService = Service.create(
+ // The WSDL file used to create this service is fetched from the application we deployed
+ // above using the createDeployment() method.
+ new URL(rootUrl, "EBookStoreImplService/EBookStoreImpl?wsdl"),
+ new QName("http://ejb.endpoint.jaxws.javaee7.org/", "EBookStoreImplService"));
+ }
+
+ @Test
+ public void test1WelcomeMessage() throws MalformedURLException {
+ assertEquals(
+ "Welcome to EBookStore WebService, Mr/Mrs Johnson",
+ eBookStoreService.getPort(EBookStore.class).welcomeMessage("Johnson"));
+ }
+
+
+}
diff --git a/jaxws/jaxws-endpoint/pom.xml b/jaxws/jaxws-endpoint/pom.xml
index 3067161f3..7bd2d39fc 100644
--- a/jaxws/jaxws-endpoint/pom.xml
+++ b/jaxws/jaxws-endpoint/pom.xml
@@ -1,39 +1,17 @@
-
- 4.0.0
+4.0.0org.javaee7jaxws1.0-SNAPSHOT
- ../pom.xml
+
jaxws-jaxws-endpointwarJava EE 7 Sample: jaxws - jaxws-endpointjaxws-endpoint
-
-
-
- org.jvnet.jax-ws-commons
- jaxws-maven-plugin
- 2.3
-
-
- process-classes
-
- wsgen
-
-
- org.javaee7.jaxws.endpoint.EBookStoreImpl
- true
- ${basedir}/src/main/webapp/WEB-INF/wsdl
-
-
-
-
-
diff --git a/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStore.java b/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStore.java
index 3ca54e02d..76f47b2de 100644
--- a/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStore.java
+++ b/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStore.java
@@ -14,17 +14,17 @@
public interface EBookStore {
@WebMethod
- public String welcomeMessage(String name);
+ String welcomeMessage(String name);
@WebMethod
- public List findEBooks(String text);
+ List findEBooks(String text);
@WebMethod
- public EBook takeBook(String title);
+ EBook takeBook(String title);
@WebMethod
- public void saveBook(EBook eBook);
+ void saveBook(EBook eBook);
@WebMethod
- public EBook addAppendix(EBook eBook, int appendixPages);
+ EBook addAppendix(EBook eBook, int appendixPages);
}
diff --git a/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStoreImpl.java b/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStoreImpl.java
index d029daaff..fd3b2bd5c 100644
--- a/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStoreImpl.java
+++ b/jaxws/jaxws-endpoint/src/main/java/org/javaee7/jaxws/endpoint/EBookStoreImpl.java
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.jws.WebService;
@@ -16,7 +17,7 @@
serviceName = "EBookStoreImplService")
public class EBookStoreImpl implements EBookStore {
- private HashMap eBookCollection = new HashMap();
+ private Map eBookCollection = new HashMap<>();
@Override
public String welcomeMessage(String name) {
diff --git a/jaxws/jaxws-endpoint/src/test/java/org/javaee7/jaxws/endpoint/EBookStoreTest.java b/jaxws/jaxws-endpoint/src/test/java/org/javaee7/jaxws/endpoint/EBookStoreTest.java
index ac383c12f..08f5e3f61 100644
--- a/jaxws/jaxws-endpoint/src/test/java/org/javaee7/jaxws/endpoint/EBookStoreTest.java
+++ b/jaxws/jaxws-endpoint/src/test/java/org/javaee7/jaxws/endpoint/EBookStoreTest.java
@@ -1,6 +1,8 @@
package org.javaee7.jaxws.endpoint;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.runners.MethodSorters.NAME_ASCENDING;
import java.net.MalformedURLException;
import java.net.URL;
@@ -9,8 +11,6 @@
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-import org.javaee7.jaxws.endpoint.EBook;
-import org.javaee7.jaxws.endpoint.EBookStore;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
@@ -20,35 +20,30 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
/**
* @author Fermin Gallego
*/
@RunWith(Arquillian.class)
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@FixMethodOrder(NAME_ASCENDING)
public class EBookStoreTest {
+
+ @ArquillianResource
+ private URL url;
private static Service eBookStoreService;
- /**
- * Arquillian specific method for creating a file which can be deployed
- * while executing the test.
- *
- * @return a war file
- */
@Deployment(testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class).
addPackage("org.javaee7.jaxws.endpoint");
}
- @ArquillianResource
- private URL url;
-
@Before
public void setupClass() throws MalformedURLException {
eBookStoreService = Service.create(
+ // The WSDL file used to create this service is fetched from the application we deployed
+ // above using the createDeployment() method.
new URL(url, "EBookStoreImplService?wsdl"),
new QName("http://endpoint.jaxws.javaee7.org/", "EBookStoreImplService"));
}
@@ -63,6 +58,7 @@ public void test1WelcomeMessage() throws MalformedURLException {
@Test
public void test2SaveAndTakeBook() throws MalformedURLException {
EBookStore eBookStore = eBookStoreService.getPort(EBookStore.class);
+
EBook eBook = new EBook();
eBook.setTitle("The Lord of the Rings");
eBook.setNumPages(1178);
@@ -89,15 +85,15 @@ public void test3FindEbooks() {
assertEquals("The Lord of the Rings", titleList.get(0));
}
- @Test
- public void test4AddAppendix() {
- EBookStore eBookStore = eBookStoreService.getPort(EBookStore.class);
- EBook eBook = eBookStore.takeBook("Oliver Twist");
-
- assertEquals(268, eBook.getNumPages());
- EBook eBookResponse = eBookStore.addAppendix(eBook, 5);
-
- assertEquals(268, eBook.getNumPages());
- assertEquals(273, eBookResponse.getNumPages());
- }
+// @Test
+// public void test4AddAppendix() {
+// EBookStore eBookStore = eBookStoreService.getPort(EBookStore.class);
+// EBook eBook = eBookStore.takeBook("Oliver Twist");
+//
+// assertEquals(268, eBook.getNumPages());
+// EBook eBookResponse = eBookStore.addAppendix(eBook, 5);
+//
+// assertEquals(268, eBook.getNumPages());
+// assertEquals(273, eBookResponse.getNumPages());
+// }
}
diff --git a/jaxws/pom.xml b/jaxws/pom.xml
index 7099a2360..81a9e49f2 100644
--- a/jaxws/pom.xml
+++ b/jaxws/pom.xml
@@ -7,13 +7,13 @@
1.0-SNAPSHOT
- org.javaee7jaxwspomJava EE 7 Sample: jaxwsjaxws-endpoint
+ jaxws-endpoint-ejbjaxws-client
@@ -22,10 +22,27 @@
org.javaee7test-utils${project.version}
+ test
+
+
+ com.sun.xml.ws
+ jaxws-rt
+ 2.3.5
+ test
+
+
+
+ com.helger.maven
+ jaxws-maven-plugin
+ 2.6
+
+
+
+
maven-surefire-plugin
diff --git a/jca/pom.xml b/jca/pom.xml
index e4af5f93f..148d44f40 100644
--- a/jca/pom.xml
+++ b/jca/pom.xml
@@ -1,7 +1,5 @@
-
- 4.0.0
+4.0.0org.javaee7
@@ -11,6 +9,7 @@
jcapom
+
Java EE 7 Sample: jca
@@ -23,6 +22,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jms/pom.xml b/jms/pom.xml
index 2d4408fbc..01119e5d3 100644
--- a/jms/pom.xml
+++ b/jms/pom.xml
@@ -25,6 +25,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Language.java b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Language.java
new file mode 100644
index 000000000..3bd675da9
--- /dev/null
+++ b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Language.java
@@ -0,0 +1,8 @@
+package org.javaee7.jpa.listeners;
+
+/**
+ * @author Patrik Dudits
+ */
+public enum Language {
+ ENGLISH, GERMAN;
+}
diff --git a/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/LanguageConverter.java b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/LanguageConverter.java
new file mode 100644
index 000000000..8ffdf949d
--- /dev/null
+++ b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/LanguageConverter.java
@@ -0,0 +1,40 @@
+package org.javaee7.jpa.listeners;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+/**
+ * The presence of a converter causes injection to fail in Eclipselink 2.7.4
+ * @author Patrik Dudits
+ */
+@Converter(autoApply = true)
+public class LanguageConverter implements AttributeConverter {
+ @Override
+ public String convertToDatabaseColumn(Language attribute) {
+ if (attribute == null) {
+ return "Unknown";
+ }
+ switch (attribute) {
+ case ENGLISH:
+ return "en";
+ case GERMAN:
+ return "de";
+ }
+ return null;
+ }
+
+ @Override
+ public Language convertToEntityAttribute(String dbData) {
+ if (dbData == null) {
+ return null;
+ }
+ switch (dbData) {
+ case "en":
+ return Language.ENGLISH;
+ case "de":
+ return Language.GERMAN;
+ default:
+ return null;
+ }
+ }
+}
diff --git a/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Movie.java b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Movie.java
index b3b7e5d7d..54d2373b5 100644
--- a/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Movie.java
+++ b/jpa/listeners-injection/src/main/java/org/javaee7/jpa/listeners/Movie.java
@@ -41,6 +41,8 @@ public class Movie implements Serializable {
@Transient
private Integer rating;
+ private Language language;
+
public Movie() {
}
diff --git a/jpa/listeners-injection/src/main/resources/META-INF/create.sql b/jpa/listeners-injection/src/main/resources/META-INF/create.sql
index 00a37e63a..ac2ac3210 100644
--- a/jpa/listeners-injection/src/main/resources/META-INF/create.sql
+++ b/jpa/listeners-injection/src/main/resources/META-INF/create.sql
@@ -1,2 +1,2 @@
-CREATE TABLE MOVIE_LISTENER("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null, "ACTORS" VARCHAR(200) not null)
+CREATE TABLE MOVIE_LISTENER("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null, "ACTORS" VARCHAR(200) not null, "LANGUAGE" VARCHAR(12))
CREATE TABLE MOVIE_RATINGS("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null, "RATING" INTEGER not null)
\ No newline at end of file
diff --git a/jpa/pom.xml b/jpa/pom.xml
index 42f5e5697..22dadcbf3 100644
--- a/jpa/pom.xml
+++ b/jpa/pom.xml
@@ -1,12 +1,10 @@
-
- 4.0.0
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xmljpa
@@ -50,6 +48,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jsf/pom.xml b/jsf/pom.xml
index 733f580a6..63f33f4c3 100644
--- a/jsf/pom.xml
+++ b/jsf/pom.xml
@@ -1,6 +1,5 @@
-
- 4.0.0
+4.0.0org.javaee7
@@ -9,7 +8,6 @@
jsf
- 1.0-SNAPSHOTpomJava EE 7 Sample: jsf
@@ -40,6 +38,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/json/pom.xml b/json/pom.xml
index 83ceb12aa..db0a5703c 100644
--- a/json/pom.xml
+++ b/json/pom.xml
@@ -1,17 +1,15 @@
-
- 4.0.0
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xml
- org.javaee7
+
json
- 1.0-SNAPSHOTpom
+
Java EE 7 Sample: json
@@ -26,6 +24,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/jta/pom.xml b/jta/pom.xml
index 4edfaf1c8..1aed93aea 100644
--- a/jta/pom.xml
+++ b/jta/pom.xml
@@ -1,17 +1,15 @@
-
- 4.0.0
+4.0.0org.javaee7samples-parent1.0-SNAPSHOT
- ../pom.xml
- org.javaee7
+
jta
- 1.0-SNAPSHOTpom
+
Java EE 7 Sample: jta
@@ -25,6 +23,7 @@
org.javaee7test-utils${project.version}
+ test
diff --git a/pom.xml b/pom.xml
index 92183d391..732727fc8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,9 +10,9 @@
Java EE 7 Sample: javaee7-samples
- 1.1.14.Final
+ 1.7.0.Alpha11.7
- 3.0.0
+ 3.5.4UTF-8false
@@ -34,11 +34,11 @@
-->
4.1.2.181payaradomain
- 5.182
+ 5.04.1.116.0.0.413.0.0.Final
- 2.0.0.Final
+ 2.4.0.Final7.0.29.0.4
@@ -75,21 +75,6 @@
false
-
-
- ossrh
- Sonatype-snapshot
-
- https://oss.sonatype.org/content/repositories/snapshots
-
-
- false
-
-
- true
- always
-
-
@@ -139,14 +124,24 @@
com.h2databaseh2
- 1.4.195
+ 1.4.197fish.payara.arquillianpayara-client-ee7
- 1.0.Beta3-m1
+ 2.2test
+
+ org.bouncycastle
+ bcprov-jdk15on
+ 1.61
+
+
+ org.bouncycastle
+ bcpkix-jdk15on
+ 1.61
+
@@ -168,26 +163,24 @@
junitjunit
- 4.12
+ 4.13.1testorg.hamcresthamcrest-core
- 1.3testorg.hamcresthamcrest-library
- 1.3testorg.assertjassertj-core
- 1.5.0
+ 3.16.1test
@@ -214,13 +207,13 @@
xmlunitxmlunit
- 1.5
+ 1.6testorg.skyscreamerjsonassert
- 1.2.1
+ 1.5.0test
@@ -233,43 +226,61 @@
net.sourceforge.htmlunithtmlunit
- 2.31
+ 2.40.0testrhinojs
- 1.7R1
+ 1.7R2testorg.jsonjson
- 20131018
+ 20180813testcom.jayway.awaitilityawaitility
- 1.6.0
+ 1.7.0test
+
+ org.omnifaces
+ omniutils
+ 0.11
+ test
+
+
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+ 3.0.0
+
+
+ org.glassfish.jaxb
+ jaxb-runtime
+ 3.0.0
+ ${project.artifactId}
+
src/test/resourcestrue
+
org.apache.maven.pluginsmaven-compiler-plugin
- 3.6.1
+ 3.8.1${java.min.version}${java.min.version}
@@ -278,7 +289,7 @@
org.apache.maven.pluginsmaven-surefire-report-plugin
- 2.19.1
+ 3.0.0-M3truetrue
@@ -287,7 +298,7 @@
org.apache.maven.pluginsmaven-war-plugin
- 3.0.0
+ 3.2.3truefalse
@@ -320,7 +331,7 @@
org.wildfly.pluginswildfly-maven-plugin
- 1.0.2.Final
+ 1.2.1.Final
@@ -328,12 +339,12 @@
org.apache.maven.pluginsmaven-enforcer-plugin
- 1.3.1
+ 3.0.0-M3org.apache.maven.pluginsmaven-surefire-plugin
- 2.19.1
+ 3.0.0-M4
@@ -345,6 +356,52 @@
+
+
+
+
+ piranha-embedded-micro
+
+
+ true
+
+ true
+
+
+
+
+
+ fish.payara.arquillian
+ payara-client-ee7
+
+
+
+ cloud.piranha.arquillian
+ piranha-arquillian-server
+ 20.6.0-SNAPSHOT
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+ piranha-embedded
+ 20.6.0-SNAPSHOT
+ true
+ ${skipEJB}
+
+
+
+
+
+
+
+
+
@@ -367,7 +424,7 @@
fish.payara.arquillianarquillian-payara-server-4-managed
- 1.0.Beta3-m1
+ 1.1
@@ -468,10 +525,10 @@
fish.payara.extraspayara-micro
- ${payara.micro.version}
+ ${payara.version}false${session.executionRootDirectory}/target/
- payara-micro-${payara.micro.version}.jar
+ payara-micro-${payara.version}.jar
@@ -483,7 +540,8 @@
maven-surefire-plugin
- ${session.executionRootDirectory}/target/payara-micro-${payara.micro.version}.jar
+ ${skipEAR}
+ ${session.executionRootDirectory}/target/payara-micro-${payara.version}.jar
@@ -546,16 +604,17 @@
-
+ maven-surefire-pluginpayara-remote
+ ${payara_domain}
-
+ src/test/resources
@@ -1384,7 +1443,7 @@
org.apache.maven.pluginsmaven-antrun-plugin
- 1.1
+ 1.8process-test-classes
@@ -1644,7 +1703,7 @@
org.apache.maven.pluginsmaven-dependency-plugin
- 2.4
+ 3.1.2sources
diff --git a/servlet/async-servlet/pom.xml b/servlet/async-servlet/pom.xml
index e940bdd18..64f60a48e 100644
--- a/servlet/async-servlet/pom.xml
+++ b/servlet/async-servlet/pom.xml
@@ -1,6 +1,5 @@
-
+4.0.0
@@ -8,9 +7,9 @@
servlet1.0-SNAPSHOT
-
+
servlet-async-servletwar
-
+
Java EE 7 Sample: servlet - async-servlet
diff --git a/servlet/async-servlet/src/main/java/org/javaee7/servlet/async/MyAsyncServlet.java b/servlet/async-servlet/src/main/java/org/javaee7/servlet/async/MyAsyncServlet.java
index c8db9f77c..a340f5161 100644
--- a/servlet/async-servlet/src/main/java/org/javaee7/servlet/async/MyAsyncServlet.java
+++ b/servlet/async-servlet/src/main/java/org/javaee7/servlet/async/MyAsyncServlet.java
@@ -39,6 +39,8 @@
*/
package org.javaee7.servlet.async;
+import java.io.IOException;
+
import javax.annotation.Resource;
import javax.enterprise.concurrent.ManagedExecutorService;
import javax.servlet.AsyncContext;
@@ -49,7 +51,6 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
/**
* @author Arun Gupta
@@ -57,24 +58,23 @@
@WebServlet(urlPatterns = "/MyAsyncServlet", asyncSupported = true)
public class MyAsyncServlet extends HttpServlet {
- // @Resource(lookup="java:comp/DefaultManagedExecutorService")
+ private static final long serialVersionUID = 3709640331218336841L;
+
@Resource
ManagedExecutorService executor;
/**
- * Processes requests for both HTTP GET and POST
- * methods.
+ * Processes requests for both HTTP GET and POST methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
- protected void processRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- AsyncContext ac = request.startAsync();
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ AsyncContext asyncContext = request.startAsync();
- ac.addListener(new AsyncListener() {
+ asyncContext.addListener(new AsyncListener() {
@Override
public void onComplete(AsyncEvent event) throws IOException {
event.getSuppliedResponse().getWriter().println("onComplete");
@@ -96,29 +96,29 @@ public void onStartAsync(AsyncEvent event) throws IOException {
event.getSuppliedResponse().getWriter().println("onStartAsync");
}
});
- executor.submit(new MyAsyncService(ac));
+
+ executor.submit(new MyAsyncService(asyncContext));
}
class MyAsyncService implements Runnable {
- AsyncContext ac;
+ AsyncContext asyncContext;
- public MyAsyncService(AsyncContext ac) {
- this.ac = ac;
+ public MyAsyncService(AsyncContext asyncContext) {
+ this.asyncContext = asyncContext;
}
@Override
public void run() {
try {
- ac.getResponse().getWriter().println("Running inside MyAsyncService");
+ asyncContext.getResponse().getWriter().println("Running inside MyAsyncService");
} catch (IOException e) {
throw new IllegalStateException(e);
}
- ac.complete();
+ asyncContext.complete();
}
}
- //
/**
* Handles the HTTP GET method.
*
@@ -128,8 +128,7 @@ public void run() {
* @throws IOException if an I/O error occurs
*/
@Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
@@ -142,8 +141,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
* @throws IOException if an I/O error occurs
*/
@Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request, response);
}
@@ -155,5 +153,5 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
@Override
public String getServletInfo() {
return "Short description";
- }//
+ }
}
diff --git a/servlet/cookies/pom.xml b/servlet/cookies/pom.xml
index 9bd042110..f3981cade 100644
--- a/servlet/cookies/pom.xml
+++ b/servlet/cookies/pom.xml
@@ -8,9 +8,11 @@
1.0-SNAPSHOT../pom.xml
+
org.javaee7servlet-cookies1.0-SNAPSHOTwar
+
Java EE 7 Sample: servlet - cookies
diff --git a/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/ClientCookieServlet.java b/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/ClientCookieServlet.java
new file mode 100644
index 000000000..9805b8459
--- /dev/null
+++ b/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/ClientCookieServlet.java
@@ -0,0 +1,114 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package org.javaee7.servlet.cookies;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Arun Gupta
+ */
+@WebServlet(urlPatterns = { "/ClientCookieServlet" })
+public class ClientCookieServlet extends HttpServlet {
+
+ private static final long serialVersionUID = -1944396991856607131L;
+
+ /**
+ * Processes requests for both HTTP GET and POST methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ response.setContentType("text/html;charset=UTF-8");
+
+ try (PrintWriter out = response.getWriter()) {
+ out.println("");
+ out.println("");
+ out.println("");
+ out.println("Servlet ClientCookieServlet");
+ out.println("");
+ out.println("");
+ out.println("
Servlet ClientCookieServlet at " + request.getContextPath() + "
");
+
+
+ out.println("");
+
+ out.println("");
+ out.println("");
+ }
+ }
+
+ /**
+ * Handles the HTTP GET method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP POST method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ processRequest(request, response);
+ }
+}
diff --git a/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/TestServlet.java b/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/TestServlet.java
index e1beb39a5..1ad92047e 100644
--- a/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/TestServlet.java
+++ b/servlet/cookies/src/main/java/org/javaee7/servlet/cookies/TestServlet.java
@@ -41,9 +41,8 @@
import java.io.IOException;
import java.io.PrintWriter;
+
import javax.servlet.ServletException;
-import javax.servlet.SessionCookieConfig;
-import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
@@ -54,21 +53,21 @@
* @author Arun Gupta
*/
@WebServlet(urlPatterns = { "/TestServlet" })
-@MultipartConfig(location = "/tmp")
public class TestServlet extends HttpServlet {
+ private static final long serialVersionUID = -1944396991856607131L;
+
/**
- * Processes requests for both HTTP GET and POST
- * methods.
+ * Processes requests for both HTTP GET and POST methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
- protected void processRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
+
try (PrintWriter out = response.getWriter()) {
out.println("");
out.println("");
@@ -77,33 +76,36 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
out.println("");
out.println("");
out.println("
Servlet TestServlet at " + request.getContextPath() + "
");
- SessionCookieConfig cookies = request.getServletContext().getSessionCookieConfig();
- out.println("Found cookie: " + cookies.getName());
+
+ if (request.getCookies() != null) {
+ for (Cookie cookie : request.getCookies()) {
+ out.println("Found cookie: " + cookie.getName());
+ }
+ }
+ // General cookie
Cookie cookie = new Cookie("myCookieKey", "myCookieValue");
cookie.setMaxAge(60);
response.addCookie(cookie);
+
out.println("
Set a new cookie");
+ // Http only cookie
cookie = new Cookie("myHttpOnlyCookieKey", "myHttpOnlyCookieValue");
cookie.setHttpOnly(true);
cookie.setMaxAge(60);
response.addCookie(cookie);
+
out.println(" Set a new HTTPOnly Cookie
");
out.println("Check what cookies are visible by");
- out.println("clicking here");
+ out.println("clicking here");
out.println("");
out.println("