Merge pull request #1063 from andymc12/beansXml

Ensure resourceconstructor test includes beans.xml
diff --git a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/JAXRSClientIT.java b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/JAXRSClientIT.java
index 43e927f..794d21e 100644
--- a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/JAXRSClientIT.java
+++ b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/JAXRSClientIT.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -18,7 +18,6 @@
 
 import java.io.InputStream;
 import java.io.IOException;
-import java.util.Properties;
 import jakarta.ws.rs.tck.lib.util.TestUtil;
 
 import jakarta.ws.rs.tck.common.client.JaxrsCommonClient;
@@ -30,10 +29,8 @@
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.TestInfo;
@@ -79,7 +76,7 @@
 
     WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxrs_ee_rs_container_requestcontext_security_web.war");
     archive.addClasses(TSAppConfig.class, Resource.class, RequestFilter.class);
-    archive.addAsResource("jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml");
+    archive.addAsWebInfResource("jakarta/ws/rs/tck/ee/rs/container/requestcontext/security/jaxrs_ee_rs_container_requestcontext_security_web.war.sun-web.xml", "sun-web.xml");
     archive.setWebXML(new StringAsset(webXml));
     return archive;
 
@@ -102,7 +99,7 @@
    * @test_Strategy: Get the injectable security context information for the
    * current request, the user is authenticated.
    */
-  //@Test
+  @Test
   public void getSecurityContextTest() throws Fault {
     setProperty(Property.BASIC_AUTH_USER, user);
     setProperty(Property.BASIC_AUTH_PASSWD, password);
diff --git a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/JAXRSBasicClientIT.java b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/JAXRSBasicClientIT.java
index ffc910c..3e1d2ba 100644
--- a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/JAXRSBasicClientIT.java
+++ b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/JAXRSBasicClientIT.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -80,8 +80,7 @@
       jakarta.ws.rs.tck.ee.rs.core.securitycontext.TestServlet.Scheme.class,
       jakarta.ws.rs.tck.ee.rs.core.securitycontext.TestServlet.Role.class);
     archive.setWebXML(new StringAsset(webXml));
-    archive.addAsResource("jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.ear.sun-application.xml");
-    archive.addAsResource("jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml");
+    archive.addAsWebInfResource("jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.war.sun-web.xml", "sun-web.xml");
     return archive;
 
   }
diff --git a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/jaxrs21/ee/sse/ssebroadcaster/JAXRSClientIT.java b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/jaxrs21/ee/sse/ssebroadcaster/JAXRSClientIT.java
index 1673667..72c40b0 100644
--- a/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/jaxrs21/ee/sse/ssebroadcaster/JAXRSClientIT.java
+++ b/jaxrs-tck/src/main/java/jakarta/ws/rs/tck/jaxrs21/ee/sse/ssebroadcaster/JAXRSClientIT.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021 Oracle and/or its affiliates. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -17,12 +17,9 @@
 package jakarta.ws.rs.tck.jaxrs21.ee.sse.ssebroadcaster;
 
 import java.util.List;
-import java.util.Properties;
 import java.io.InputStream;
 import java.io.IOException;
 
-import jakarta.ws.rs.tck.lib.util.TestUtil;
-
 import jakarta.ws.rs.client.ClientBuilder;
 import jakarta.ws.rs.client.WebTarget;
 import jakarta.ws.rs.sse.InboundSseEvent;
@@ -38,10 +35,8 @@
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.api.exporter.ZipExporter;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.TestInfo;
@@ -64,8 +59,8 @@
   private static final int CLIENTS = 5;
 
   public JAXRSClientIT() {
-    setup();
     setContextRoot("/jaxrs_jaxrs21_ee_sse_ssebroadcaster_web");
+    setup();
   }
 
   @Override
diff --git a/jaxrs-tck/src/main/resources/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.ear.sun-application.xml b/jaxrs-tck/src/main/resources/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.ear.sun-application.xml
deleted file mode 100644
index 0e9e638..0000000
--- a/jaxrs-tck/src/main/resources/jakarta/ws/rs/tck/ee/rs/core/securitycontext/basic/jaxrs_ee_core_securitycontext_basic_web.ear.sun-application.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
-
-    This program and the accompanying materials are made available under the
-    terms of the Eclipse Public License v. 2.0, which is available at
-    http://www.eclipse.org/legal/epl-2.0.
-
-    This Source Code may also be made available under the following Secondary
-    Licenses when the conditions for such availability set forth in the
-    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
-    version 2 with the GNU Classpath Exception, which is available at
-    https://www.gnu.org/software/classpath/license.html.
-
-    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-
--->
-
-<!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 J2EE Application 1.4//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-application_1_4-0.dtd">
-<sun-application>
-  <web>
-    <web-uri>jaxrs_ee_core_securitycontext_basic_web.war</web-uri>
-    <context-root>jaxrs_ee_core_securitycontext_basic_web</context-root>
-  </web>
-  <unique-id>0</unique-id>
-  <security-role-mapping>
-    <role-name>DIRECTOR</role-name>
-    <principal-name>j2ee</principal-name>
-  </security-role-mapping>
-  <security-role-mapping>
-    <role-name>OTHERROLE</role-name>
-    <principal-name>javajoe</principal-name>
-  </security-role-mapping>  
-</sun-application>
diff --git a/jersey-tck/j2ee.pass b/jersey-tck/j2ee.pass
new file mode 100644
index 0000000..906340c
--- /dev/null
+++ b/jersey-tck/j2ee.pass
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=j2ee
\ No newline at end of file
diff --git a/jersey-tck/javajoe.pass b/jersey-tck/javajoe.pass
new file mode 100644
index 0000000..4e595a6
--- /dev/null
+++ b/jersey-tck/javajoe.pass
@@ -0,0 +1,16 @@
+#
+# Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0, which is available at
+# http://www.eclipse.org/legal/epl-2.0.
+#
+# This Source Code may also be made available under the following Secondary
+# Licenses when the conditions for such availability set forth in the
+# Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+# version 2 with the GNU Classpath Exception, which is available at
+# https://www.gnu.org/software/classpath/license.html.
+#
+# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+#
+AS_ADMIN_USERPASSWORD=javajoe
\ No newline at end of file
diff --git a/jersey-tck/pom.xml b/jersey-tck/pom.xml
index 5f5e7ba..0ac8ccb 100644
--- a/jersey-tck/pom.xml
+++ b/jersey-tck/pom.xml
@@ -1,4 +1,21 @@
 <?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0, which is available at
+    http://www.eclipse.org/legal/epl-2.0.
+
+    This Source Code may also be made available under the following Secondary
+    Licenses when the conditions for such availability set forth in the
+    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+    version 2 with the GNU Classpath Exception, which is available at
+    https://www.gnu.org/software/classpath/license.html.
+
+    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
@@ -18,7 +35,7 @@
         <glassfish.container.version>6.1.0</glassfish.container.version>
         <jakarta.platform.version>9.1.0</jakarta.platform.version>
         <junit.jupiter.version>5.7.2</junit.jupiter.version>
-        <jakarta.rest.version>3.0.0</jakarta.rest.version>
+        <jakarta.rest.version>3.1.0</jakarta.rest.version>
     </properties>
 
     <dependencyManagement>
@@ -96,23 +113,33 @@
             <groupId>org.glassfish.jersey.core</groupId>
             <artifactId>jersey-server</artifactId>
             <version>${jersey.version}</version>
-            <scope>test</scope> 
+            <scope>test</scope>
         </dependency>
-        
         <dependency>
             <groupId>org.glassfish.jersey.containers</groupId>
             <artifactId>jersey-container-grizzly2-http</artifactId>
             <version>${jersey.version}</version>
             <scope>test</scope>
         </dependency> 
-
         <dependency>
             <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-json-binding</artifactId>
+            <version>${jersey.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.glassfish.jersey.media</groupId>
+            <artifactId>jersey-media-jaxb</artifactId>
+            <version>${jersey.version}</version>
+            <scope>test</scope>
+        </dependency>
+       <dependency>
+            <groupId>org.glassfish.jersey.media</groupId>
             <artifactId>jersey-media-sse</artifactId>
             <version>${jersey.version}</version>
+            <scope>test</scope>
         </dependency>
 
-
     </dependencies>
 
 
@@ -276,7 +303,59 @@
                         </configuration>
                     </execution>
                     <execution>
-                        <id>StopDomain2</id>
+                        <id>Add User j2ee</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <workingDirectory>${project.build.directory}/glassfish6/glassfish/bin</workingDirectory>
+                            <executable>asadmin</executable>
+                            <arguments>
+                                <argument>--passwordfile</argument>
+                                <argument>${project.basedir}/j2ee.pass</argument>
+                                <argument>create-file-user</argument>
+                                <argument>--groups</argument>
+                                <argument>staff:mgr</argument>
+                                <argument>j2ee</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>Add User javajoe</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <workingDirectory>${project.build.directory}/glassfish6/glassfish/bin</workingDirectory>
+                            <executable>asadmin</executable>
+                            <arguments>
+                                <argument>--passwordfile</argument>
+                                <argument>${project.basedir}/javajoe.pass</argument>
+                                <argument>create-file-user</argument>
+                                <argument>--groups</argument>
+                                <argument>guest</argument>
+                                <argument>javajoe</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>list users</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <workingDirectory>${project.build.directory}/glassfish6/glassfish/bin</workingDirectory>
+                            <executable>asadmin</executable>
+                            <arguments>
+                                <argument>list-file-users</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>StopDomain</id>
                         <phase>pre-integration-test</phase>
                         <goals>
                             <goal>exec</goal>
diff --git a/pom.xml b/pom.xml
index 29285c0..31f88f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -47,12 +47,30 @@
                 </repository>
             </distributionManagement>
         </profile>
+        <profile>
+            <id>dependentModules</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+                <property>
+                    <name>jaxrs.all.build</name>
+                </property>
+            </activation>
+            <modules>
+                <module>jaxrs-api</module>
+                <module>jaxrs-tck</module>
+                <module>examples</module>
+            </modules>
+        </profile>
+        <profile>
+            <id>dependentSpecification</id>
+            <activation>
+                <property>
+                    <name>jaxrs.all.build</name>
+                </property>
+            </activation>
+            <modules>
+                <module>jaxrs-spec</module>
+            </modules>
+        </profile>
     </profiles>
-
-    <modules>
-        <module>jaxrs-api</module>
-        <module>jaxrs-spec</module>
-        <module>jaxrs-tck</module>
-        <module>examples</module>
-    </modules>
 </project>