Skip to content

Added profile for Liberty #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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``

Expand All @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -25,8 +26,9 @@
public class RequestFromPolicyContextTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
return defaultArchive().addPackages(true, "org.javaee7.jacc");
public static Archive<?> createDeployment() {
// TODO: Fix for Liberty which requires EARs :(
return ((WebArchive)defaultArchive()).addPackages(true, "org.javaee7.jacc");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -44,8 +45,9 @@
public class SubjectFromPolicyContextTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
return defaultArchive().addPackages(true, "org.javaee7.jacc");
public static Archive<?> createDeployment() {
// TODO: Fix for Liberty which requires EARs :(
return ((WebArchive)defaultArchive()).addPackages(true, "org.javaee7.jacc");
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@
public class AsyncAuthenticationPublicTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,7 +24,7 @@
public class BasicAuthenticationProtectedTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@
public class BasicAuthenticationPublicTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@
public class BasicAuthenticationStatelessTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -23,12 +27,31 @@ public class ArquillianBase {
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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,7 +23,7 @@
public class ProtectedEJBPropagationTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -26,7 +26,7 @@
public class PublicEJBPropagationLogoutTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,7 +23,7 @@
public class PublicEJBPropagationTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
11 changes: 11 additions & 0 deletions jaspic/lifecycle/src/main/webapp/WEB-INF/ibm-application-bnd.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,7 +27,7 @@
public class AuthModuleMethodInvocationTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -17,7 +17,7 @@
public class RegisterSessionTest extends ArquillianBase {

@Deployment(testable = false)
public static WebArchive createDeployment() {
public static Archive<?> createDeployment() {
return defaultArchive();
}

Expand Down
11 changes: 11 additions & 0 deletions jaspic/wrapping/src/main/webapp/WEB-INF/ibm-application-bnd.xml
Original file line number Diff line number Diff line change
@@ -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>
Loading