Skip to content

Commit 3f52c35

Browse files
committed
Merge pull request #330 from arjantijms/master
Updated JASPIC and JACC tests for better Liberty compatibility
2 parents 5f53c52 + dae0efe commit 3f52c35

File tree

11 files changed

+43
-39
lines changed

11 files changed

+43
-39
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,20 @@ There are 5 available container profiles:
5252

5353
``-DlibertyManagedArquillian_wlpHome=/opt/wlp``
5454

55-
This profile also requires the localConnector feature to be configured in server.xml, and if all tests are to be run at least the
56-
javaee-7.0 feature and jaspic-1.1 (even though this is part of Java EE 7 already). E.g.
55+
This profile also requires the localConnector feature to be configured in server.xml, and if all tests are to be run the
56+
javaee-7.0 feature E.g.
5757

5858
```xml
5959
<featureManager>
6060
<feature>javaee-7.0</feature>
61-
<feature>jaspic-1.1</feature>
6261
<feature>localConnector-1.0</feature>
6362
</featureManager>
6463
```
6564

66-
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:
65+
For the JASPIC tests to even be attempted to be executed a cheat is needed that creates a group in Liberty's internal user registry:
6766

6867
```xml
6968
<basicRegistry id="basic">
70-
<user name="test" password="not needed"/>
7169
<group name="architect"/>
7270
</basicRegistry>
7371
```

jacc/contexts/src/test/java/org/javaee7/jacc/contexts/SubjectFromPolicyContextTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static Archive<?> createDeployment() {
5656
@Test
5757
public void testCanObtainRequestInServlet() throws IOException, SAXException {
5858

59-
String response = getFromServerPath("subjectServlet?doLogin");
59+
String response = getFromServerPath("subjectServlet?doLogin=true");
6060

6161
assertTrue(response.contains("Obtained subject from context."));
6262
}
@@ -68,7 +68,7 @@ public void testCanObtainRequestInServlet() throws IOException, SAXException {
6868
@Test
6969
public void testCanObtainRolesFromSubjectInServlet() throws IOException, SAXException {
7070

71-
String response = getFromServerPath("subjectServlet?doLogin");
71+
String response = getFromServerPath("subjectServlet?doLogin=true");
7272

7373
// The role that was assigned to the user in TestServerAuthModule
7474
assertTrue(response.contains("User has role architect"));

jaspic/basic-authentication/src/test/java/org/javaee7/jaspic/basicauthentication/BasicAuthenticationPublicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testPublicPageLoggedin() throws IOException, SAXException {
4949

5050
// JASPIC has to be able to authenticate a user when accessing a public (non-protected) resource.
5151

52-
String response = getFromServerPath("public/servlet?doLogin");
52+
String response = getFromServerPath("public/servlet?doLogin=true");
5353

5454
// Now has to be logged-in
5555
assertTrue(

jaspic/basic-authentication/src/test/java/org/javaee7/jaspic/basicauthentication/BasicAuthenticationStatelessTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void testProtectedAccessIsStateless() throws IOException, SAXException {
5151
// we're not authenticated and it will deny further attempts to authenticate. This may happen when
5252
// the container does not correctly recognize the JASPIC protocol for "do nothing".
5353

54-
response = getFromServerPath("protected/servlet?doLogin");
54+
response = getFromServerPath("protected/servlet?doLogin=true");
5555

5656
// Now has to be logged-in so page is accessible
5757
assertTrue(
@@ -87,7 +87,7 @@ public void testProtectedAccessIsStateless2() throws IOException, SAXException {
8787
// -------------------- Request 1 ---------------------------
8888

8989
// Start with doing a login
90-
String response = getFromServerPath("protected/servlet?doLogin");
90+
String response = getFromServerPath("protected/servlet?doLogin=true");
9191

9292

9393
// -------------------- Request 2 ---------------------------
@@ -134,7 +134,7 @@ public void testPublicAccessIsStateless() throws IOException, SAXException {
134134

135135
// -------------------- Request 2 ---------------------------
136136

137-
response = getFromServerPath("public/servlet?doLogin");
137+
response = getFromServerPath("public/servlet?doLogin=true");
138138

139139
// Now has to be logged-in
140140
assertTrue(
@@ -173,7 +173,7 @@ public void testProtectedThenPublicAccessIsStateless() throws IOException, SAXEx
173173
// -------------------- Request 1 ---------------------------
174174

175175
// Accessing protected page with login
176-
String response = getFromServerPath("protected/servlet?doLogin");
176+
String response = getFromServerPath("protected/servlet?doLogin=true");
177177

178178

179179
// -------------------- Request 2 ---------------------------

jaspic/custom-principal/src/test/java/org/javaee7/jaspictest/customprincipal/CustomPrincipalPublicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void testPublicPageLoggedin() throws IOException, SAXException {
3232

3333
// JASPIC has to be able to authenticate a user when accessing a public (non-protected) resource.
3434

35-
String response = getFromServerPath("public/servlet?doLogin");
35+
String response = getFromServerPath("public/servlet?doLogin=true");
3636

3737
// Has to be logged-in with the right principal
3838
assertTrue(

jaspic/custom-principal/src/test/java/org/javaee7/jaspictest/customprincipal/CustomPrincipalStatelessTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testProtectedAccessIsStateless() throws IOException, SAXException {
5252
// we're not authenticated and it will deny further attempts to authenticate. This may happen when
5353
// the container does not correctly recognize the JASPIC protocol for "do nothing".
5454

55-
response = getFromServerPath("protected/servlet?doLogin");
55+
response = getFromServerPath("protected/servlet?doLogin=true");
5656

5757
// Now has to be logged-in so page is accessible
5858
assertTrue("Could not access protected page, but should be able to. "
@@ -83,7 +83,7 @@ public void testProtectedAccessIsStateless2() throws IOException, SAXException {
8383
// -------------------- Request 1 ---------------------------
8484

8585
// Start with doing a login
86-
String response = getFromServerPath("protected/servlet?doLogin");
86+
String response = getFromServerPath("protected/servlet?doLogin=true");
8787

8888
// -------------------- Request 2 ---------------------------
8989

@@ -116,7 +116,7 @@ public void testPublicAccessIsStateless() throws IOException, SAXException {
116116

117117
// -------------------- Request 2 ---------------------------
118118

119-
response = getFromServerPath("public/servlet?doLogin");
119+
response = getFromServerPath("public/servlet?doLogin=true");
120120

121121
// Now has to be logged-in
122122
assertTrue(
@@ -153,7 +153,7 @@ public void testProtectedThenPublicAccessIsStateless() throws IOException, SAXEx
153153
// -------------------- Request 1 ---------------------------
154154

155155
// Accessing protected page with login
156-
String response = getFromServerPath("protected/servlet?doLogin");
156+
String response = getFromServerPath("protected/servlet?doLogin=true");
157157

158158
// -------------------- Request 2 ---------------------------
159159

jaspic/dispatching/src/test/java/org/javaee7/jaspic/dispatching/BasicIncludeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static Archive<?> createDeployment() {
2727
}
2828

2929
@Test
30-
public void testBasicForwardViaPublicResource() throws IOException, SAXException {
30+
public void testBasicIncludeViaPublicResource() throws IOException, SAXException {
3131

3232
String response = getFromServerPath("public/servlet?dispatch=include");
3333

jaspic/ejb-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/ProtectedEJBPropagationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Archive<?> createDeployment() {
3030
@Test
3131
public void testProtectedServletWithLoginCallingEJB() throws IOException, SAXException {
3232

33-
String response = getFromServerPath("protected/servlet-protected-ejb?doLogin");
33+
String response = getFromServerPath("protected/servlet-protected-ejb?doLogin=true");
3434

3535
// Both the web (HttpServletRequest) and EJB (EJBContext) should see the same
3636
// user name.
@@ -52,7 +52,7 @@ public void testProtectedServletWithLoginCallingEJB() throws IOException, SAXExc
5252
@Test
5353
public void testPublicServletWithLoginCallingEJB() throws IOException, SAXException {
5454

55-
String response = getFromServerPath("public/servlet-protected-ejb?doLogin");
55+
String response = getFromServerPath("public/servlet-protected-ejb?doLogin=true");
5656

5757
// Both the web (HttpServletRequest) and EJB (EJBContext) should see the same
5858
// user name.

jaspic/ejb-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/PublicEJBPropagationLogoutTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static Archive<?> createDeployment() {
3333
@Test
3434
public void testProtectedServletWithLoginCallingEJB() throws IOException, SAXException {
3535

36-
String response = getFromServerPath("public/servlet-public-ejb-logout?doLogin");
36+
String response = getFromServerPath("public/servlet-public-ejb-logout?doLogin=true");
3737

3838
System.out.println(response);
3939

jaspic/ejb-propagation/src/test/java/org/javaee7/jaspic/ejbpropagation/PublicEJBPropagationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static Archive<?> createDeployment() {
3030
@Test
3131
public void testProtectedServletWithLoginCallingEJB() throws IOException, SAXException {
3232

33-
String response = getFromServerPath("protected/servlet-public-ejb?doLogin");
33+
String response = getFromServerPath("protected/servlet-public-ejb?doLogin=true");
3434

3535
// Both the web (HttpServletRequest) and EJB (EJBContext) should see the same
3636
// user name.

0 commit comments

Comments
 (0)