Permalink
Browse files

Added profile for Liberty and adjusted JASPIC tests to be explicitly

compatible with a limitation in Liberty that group to role mapping files
are required and can only appear in an EAR.
  • Loading branch information...
arjantijms committed Apr 19, 2015
1 parent 7018631 commit eb7483717940929663485054ec127bdaa7f07cb1
Showing with 198 additions and 30 deletions.
  1. +39 −2 README.md
  2. +11 −0 jaspic/async-authentication/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  3. +2 −2 ...ntication/src/test/java/org/javaee7/jaspic/asyncauthentication/AsyncAuthenticationPublicTest.java
  4. +11 −0 jaspic/basic-authentication/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  5. +2 −2 ...cation/src/test/java/org/javaee7/jaspic/basicauthentication/BasicAuthenticationProtectedTest.java
  6. +2 −2 ...ntication/src/test/java/org/javaee7/jaspic/basicauthentication/BasicAuthenticationPublicTest.java
  7. +2 −2 ...cation/src/test/java/org/javaee7/jaspic/basicauthentication/BasicAuthenticationStatelessTest.java
  8. +30 −7 jaspic/common/src/main/java/org/javaee7/jaspic/common/ArquillianBase.java
  9. +11 −0 jaspic/ejb-propagation/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  10. +2 −2 .../ejb-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/ProtectedEJBPropagationTest.java
  11. +3 −3 ...b-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/PublicEJBPropagationLogoutTest.java
  12. +2 −2 jaspic/ejb-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/PublicEJBPropagationTest.java
  13. +11 −0 jaspic/lifecycle/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  14. +2 −2 jaspic/lifecycle/src/test/java/org/javaee7/jaspic/lifecycle/AuthModuleMethodInvocationTest.java
  15. +11 −0 jaspic/register-session/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  16. +2 −2 jaspic/register-session/src/test/java/org/javaee7/jaspic/registersession/RegisterSessionTest.java
  17. +11 −0 jaspic/wrapping/src/main/webapp/WEB-INF/ibm-application-bnd.xml
  18. +2 −2 jaspic/wrapping/src/test/java/org/javaee7/jaspic/wrapping/WrappingTest.java
  19. +34 −0 pom.xml
  20. +8 −0 test-utils/src/main/resources/arquillian.xml
View
@@ -12,7 +12,7 @@ A brief instruction how to clone, build, import and run the samples on your loca
Only one container profile and one profile for browser can be active at a given time otherwise there will be dependency conflicts.
-There are 4 available container profiles:
+There are 5 available container profiles:
* ``wildfly-managed-arquillian``
@@ -35,8 +35,45 @@ There are 4 available container profiles:
This profile requires you to start up a GlassFish server outside of the build. Each sample will then
reuse this instance to run the tests.
Useful for development to avoid the server start up cost per sample.
+
+* ``liberty-managed-arquillian``
-Each of the containers allow you to override the version used
+ This profile will start up the server per sample, and optionally connects to a running server that you
+ can start up outside of the build (with the restriction that this server has to run on the host as where
+ the tests are run using the same user).
+
+ To connect to a running server the ``org.jboss.arquillian.container.was.wlp_managed_8_5.allowConnectingToRunningServer``
+ system property has to be set to true. E.g.
+
+ ``-Dorg.jboss.arquillian.container.was.wlp_managed_8_5.allowConnectingToRunningServer=true``
+
+ This profile requires you to set the location where Liberty is installed via the ``libertyManagedArquillian_wlpHome``
+ system property. E.g.
+
+ ``-DlibertyManagedArquillian_wlpHome=/opt/wlp``
+
+ This profile also requires the localConnector feature to be configured in server.xml, and if all tests are to be run at least the
+ javaee-7.0 feature and jaspic-1.1 (even though this is part of Java EE 7 already). E.g.
+
+ ```xml
+ <featureManager>
+ <feature>javaee-7.0</feature>
+ <feature>jaspic-1.1</feature>
+ <feature>localConnector-1.0</feature>
+ </featureManager>
+ ```
+
+ For the JASPIC tests to even be attempted to be executed a cheat is needed that creates a user in Liberty's internal user registry:
+
+ ```xml
+ <basicRegistry id="basic">
+ <user name="test" password="not needed"/>
+ <group name="architect"/>
+ </basicRegistry>
+ ```
+
+
+Some of the containers allow you to override the version used
* `-Dorg.wildfly=8.1.0.Final`
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -7,7 +7,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -22,7 +22,7 @@
public class AsyncAuthenticationPublicTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -8,7 +8,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -24,7 +24,7 @@
public class BasicAuthenticationProtectedTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -7,7 +7,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -22,7 +22,7 @@
public class BasicAuthenticationPublicTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -8,7 +8,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -22,7 +22,7 @@
public class BasicAuthenticationStatelessTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -1,11 +1,15 @@
package org.javaee7.jaspic.common;
+import static java.lang.Boolean.getBoolean;
+import static org.jboss.shrinkwrap.api.ShrinkWrap.create;
+
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.jboss.arquillian.test.api.ArquillianResource;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.After;
import org.junit.Before;
@@ -23,12 +27,31 @@
private static final String WEBAPP_SRC = "src/main/webapp";
private WebClient webClient;
- public static WebArchive defaultArchive() {
- return ShrinkWrap.create(WebArchive.class)
- .addPackages(true, "org.javaee7.jaspic")
- .addAsWebInfResource(resource("web.xml"))
- .addAsWebInfResource(resource("jboss-web.xml"))
- .addAsWebInfResource(resource("glassfish-web.xml"));
+ public static Archive<?> defaultArchive() {
+
+ WebArchive webArchive =
+ create(WebArchive.class, "test.war")
+ .addPackages(true, "org.javaee7.jaspic")
+ .addAsWebInfResource(resource("web.xml"))
+ .addAsWebInfResource(resource("jboss-web.xml"))
+ .addAsWebInfResource(resource("glassfish-web.xml"));
+
+ if (getBoolean("useEarForJaspic")) {
+ return
+ // EAR archive
+ create(EnterpriseArchive.class, "test.ear")
+
+ // Liberty needs to have the binding file in an ear.
+ .addAsManifestResource(resource("ibm-application-bnd.xml"))
+
+ // Web module
+ // This is needed to prevent Arquillian generating an illegal application.xml
+ .addAsModule(
+ webArchive
+ );
+ } else {
+ return webArchive;
+ }
}
private static File resource(String name) {
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -7,7 +7,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -23,7 +23,7 @@
public class ProtectedEJBPropagationTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -1,14 +1,14 @@
package org.javaee7.jaspic.ejbpropagation;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -26,7 +26,7 @@
public class PublicEJBPropagationLogoutTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -7,7 +7,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -23,7 +23,7 @@
public class PublicEJBPropagationTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -10,7 +10,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -27,7 +27,7 @@
public class AuthModuleMethodInvocationTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -8,7 +8,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -17,7 +17,7 @@
public class RegisterSessionTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<application-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
+ xmlns="http://websphere.ibm.com/xml/ns/javaee"
+ version="1.2">
+
+ <security-role name="architect">
+ <group name="architect" />
+ </security-role>
+
+</application-bnd>
@@ -7,7 +7,7 @@
import org.javaee7.jaspic.common.ArquillianBase;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.SAXException;
@@ -23,7 +23,7 @@
public class WrappingTest extends ArquillianBase {
@Deployment(testable = false)
- public static WebArchive createDeployment() {
+ public static Archive<?> createDeployment() {
return defaultArchive();
}
Oops, something went wrong.

0 comments on commit eb74837

Please sign in to comment.