use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class LoggingDeploymentResourceTestCase method testEarDeploymentConfigurationResource.
@OperateOnDeployment(EAR_DEPLOYMENT_NAME)
@Test
public void testEarDeploymentConfigurationResource() throws Exception {
ModelNode loggingConfiguration = readDeploymentResource(EAR_DEPLOYMENT_NAME, EAR_DEPLOYMENT_NAME + "/META-INF/logging.properties");
// The address should have logging.properties
Deque<Property> resultAddress = new ArrayDeque<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList());
Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties"));
ModelNode handler = loggingConfiguration.get("handler", "FILE");
Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined());
Assert.assertTrue(handler.hasDefined("properties"));
String fileName = null;
// Find the fileName property
for (Property property : handler.get("properties").asPropertyList()) {
if ("fileName".equals(property.getName())) {
fileName = property.getValue().asString();
break;
}
}
Assert.assertNotNull("fileName property not found", fileName);
Assert.assertTrue(fileName.endsWith("test-logging-ear.log"));
// Check the WAR which should inherit the EAR's logging.properties
loggingConfiguration = readSubDeploymentResource(EAR_DEPLOYMENT_NAME, EAR_WAR_DEPLOYMENT_NAME, EAR_DEPLOYMENT_NAME + "/META-INF/logging.properties");
// The address should have logging.properties
resultAddress = new ArrayDeque<>(Operations.getOperationAddress(loggingConfiguration).asPropertyList());
Assert.assertTrue("The configuration path did not include logging.properties", resultAddress.getLast().getValue().asString().contains("logging.properties"));
handler = loggingConfiguration.get("handler", "FILE");
Assert.assertTrue("The FILE handler was not found effective configuration", handler.isDefined());
Assert.assertTrue(handler.hasDefined("properties"));
fileName = null;
// Find the fileName property
for (Property property : handler.get("properties").asPropertyList()) {
if ("fileName".equals(property.getName())) {
fileName = property.getValue().asString();
break;
}
}
Assert.assertNotNull("fileName property not found", fileName);
Assert.assertTrue(fileName.endsWith("test-logging-ear.log"));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class ReuseAuthenticatedSubjectTestCase method testEjbInDifferentSecurityDomain.
/**
* Test whether if web app and EJB belong to the different security domain then the user is authenticated for both web app
* and EJB invoked from that app.
*
* @param url
* @throws Exception
*/
@OperateOnDeployment(DEPLOYMENT_NAME)
@Test
public void testEjbInDifferentSecurityDomain(@ArquillianResource URL url) throws Exception {
resetCounter(url);
final URL servletUrl = new URL(url.toExternalForm() + ReuseAuthenticatedSubjectServlet.SERVLET_PATH.substring(1) + "?" + ReuseAuthenticatedSubjectServlet.SAME_SECURITY_DOMAIN_PARAM + "=false");
String servletOutput = Utils.makeCallWithBasicAuthn(servletUrl, USER, PASSWORD, 200);
Assert.assertEquals("Unexpected servlet output after EJB call", EjbOwnSecurityDomainImpl.SAY_HELLO, servletOutput);
Assert.assertEquals("Authenticated subject was reused for EJB from the different security domain", "2", getCounter(url));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class JACCForEarModulesTestCase method testWebPermissions.
/**
* Tests web permissions (war directly and war in ear).
*
* @param webAppURL
* @throws Exception
*/
@Test
@OperateOnDeployment("war")
public void testWebPermissions(@ArquillianResource URL webAppURL) throws Exception {
final Document doc = getPermissionDocument(webAppURL);
testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT + "/ActiveContextPolicies/ContextPolicy[@contextID='jacc-test.war']"));
testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.war']"));
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class UsersRolesLoginModuleTestCase method testExternalFiles.
/**
* testExternalFiles
*
* @throws Exception
* @see #USERS_EXT
* @see #ROLES_EXT
*/
@OperateOnDeployment(DEP1)
@Test
public void testExternalFiles(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
//successful authentication and authorization
assertEquals("Response body is not correct.", SimpleSecuredServlet.RESPONSE_BODY, Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, ANIL_PWD, 200));
//successful authentication and unsuccessful authorization
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS_PWD, 403);
//tests related to case insensitiveness
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS_PWD.toUpperCase(Locale.ENGLISH), 401);
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, ANIL_PWD.toLowerCase(Locale.ENGLISH), 401);
//unsuccessful authentication
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, MARCUS_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, MARCUS, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL_PWD, MARCUS_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(MARCUS_PWD, Coding.BASE_64), 401);
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(MARCUS_PWD, Coding.HEX), 401);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class UsersRolesLoginModuleTestCase method testHashOnlyStorePassword.
/**
* testHashOnlyStorePassword
*
* @throws Exception
*/
@OperateOnDeployment(DEP6a)
@Test
public void testHashOnlyStorePassword(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
//successful authentication and authorization
assertEquals("Response body is not correct.", SimpleSecuredServlet.RESPONSE_BODY, Utils.makeCallWithBasicAuthn(servletUrl, ANIL, Utils.hashMD5(ANIL_PWD, Coding.BASE_64), 200));
//successful authentication and unsuccessful authorization
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, Utils.hashMD5(MARCUS_PWD, Coding.BASE_64), 403);
//unsuccessful authentication
Utils.makeCallWithBasicAuthn(servletUrl, ANIL, ANIL_PWD, 401);
Utils.makeCallWithBasicAuthn(servletUrl, MARCUS, MARCUS_PWD, 401);
}
Aggregations