Skip to content

Commit

Permalink
Merge pull request #10165 from mjurc/WFLY-8904
Browse files Browse the repository at this point in the history
[WFLY-8904] Fix AuthenticationTestCase and GetCallerPrincipalTestCase for Elytron and unignore it
  • Loading branch information
kabir committed Jun 12, 2017
2 parents 57fbb2c + 40d4dee commit afbfe66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,15 @@
import org.jboss.as.test.integration.security.common.AbstractSecurityDomainSetup;
import org.jboss.as.test.shared.TestSuiteEnvironment;
import org.jboss.as.test.shared.integration.ejb.security.Util;
import org.jboss.as.test.shared.util.AssumeTestGroupUtil;
import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.wildfly.security.auth.server.SecurityDomain;

/**
* Test case to hold the authentication scenarios, these range from calling a servlet which calls a bean to calling a bean which
Expand All @@ -85,12 +84,6 @@ public class AuthenticationTestCase {

private static final Logger log = Logger.getLogger(AuthenticationTestCase.class.getName());

@BeforeClass
public static void beforeClass() {
//Conditionally ignore all the tests, although only testICIR_TwoBeans_ViaServlet() needs this treatment.
//There seems to be an issue with the system property not getting propagated to the server
AssumeTestGroupUtil.assumeElytronProfileTestsEnabled();
}
/*
* Authentication Scenarios
*
Expand Down Expand Up @@ -254,7 +247,11 @@ public void testAuthentication_TwoBeans_ReAuth__BadPwd_ViaServlet() throws Excep
getWhoAmI("?method=doubleWhoAmI&username=user2&password=bad_password");
fail("Expected IOException");
} catch (IOException e) {
assertTrue(e.getMessage().contains("javax.ejb.EJBAccessException"));
if (SecurityDomain.getCurrent() == null) {
assertTrue(e.getMessage().contains("javax.ejb.EJBAccessException"));
} else {
assertTrue(e.getMessage().contains("javax.ejb.EJBException: java.lang.SecurityException: ELY01151"));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import javax.naming.NamingException;

import org.jboss.as.test.shared.integration.ejb.security.Util;
import org.jboss.as.test.shared.util.AssumeTestGroupUtil;
import org.junit.Assert;

import org.jboss.arquillian.container.test.api.Deployer;
Expand All @@ -63,7 +62,6 @@
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.staxmapper.XMLElementReader;
import org.jboss.staxmapper.XMLElementWriter;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -97,11 +95,6 @@ public class GetCallerPrincipalTestCase {

public static final String LOCAL_USER = "$local";

@BeforeClass
public static void beforeClass() {
AssumeTestGroupUtil.assumeElytronProfileTestsEnabled();
}

@ArquillianResource
Deployer deployer;

Expand Down Expand Up @@ -224,7 +217,11 @@ public void testStatefulLifecycle() throws Exception {

bean.remove();

Assert.assertEquals(LOCAL_USER + "stop", results.getSfsb("predestroy"));
if (System.getProperty("elytron") == null) {
Assert.assertEquals(LOCAL_USER + "stop", results.getSfsb("predestroy"));
} else {
Assert.assertEquals(ANONYMOUS + "stop", results.getSfsb("predestroy"));
}
return null;
};
try {
Expand Down

0 comments on commit afbfe66

Please sign in to comment.