use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class ResponseBufferSizeTestCase method increaseBufferSizeTest.
@Test
@OperateOnDeployment(DEPLOYMENT)
public void increaseBufferSizeTest(@ArquillianResource URL url) throws Exception {
URL testURL = new URL(url.toString() + "ResponseBufferSizeServlet?" + ResponseBufferSizeServlet.SIZE_CHANGE_PARAM_NAME + "=1.5" + "&" + ResponseBufferSizeServlet.DATA_LENGTH_IN_PERCENTS_PARAM_NAME + // more than original size, less than new buffer size
"=0.8");
final HttpGet request = new HttpGet(testURL.toString());
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
CloseableHttpResponse response = null;
try {
response = httpClient.execute(request);
Assert.assertEquals("Failed to access " + testURL, HttpURLConnection.HTTP_OK, response.getStatusLine().getStatusCode());
String content = EntityUtils.toString(response.getEntity());
Assert.assertFalse(content.contains(ResponseBufferSizeServlet.RESPONSE_COMMITED_MESSAGE));
final Header[] transferEncodingHeaders = response.getHeaders("Transfer-Encoding");
log.trace("transferEncodingHeaders: " + Arrays.toString(transferEncodingHeaders));
final Header[] contentLengthHeader = response.getHeaders("Content-Length");
log.trace("contentLengthHeader: " + Arrays.toString(contentLengthHeader));
for (Header transferEncodingHeader : transferEncodingHeaders) {
Assert.assertNotEquals("Transfer-Encoding shouldn't be chunked as set BufferSize shouldn't be filled yet, " + "probably caused due https://bugzilla.redhat.com/show_bug.cgi?id=1212566", "chunked", transferEncodingHeader.getValue());
}
Assert.assertFalse("Content-Length header not specified", contentLengthHeader.length == 0);
} finally {
IOUtils.closeQuietly(response);
httpClient.close();
}
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class ServletRunAsTestCase method runDestroyMethodInStopServer.
/**
* Restart server for invoking HttpServlet.destroy() method during stopping server. It also hit Servlet for initialization
* of Servlet before server is restarted.
*
* @param url
* @throws Exception
*/
@Test
@InSequence(10)
@OperateOnDeployment(DEPLOYMENT)
public void runDestroyMethodInStopServer(@ArquillianResource URL url) throws Exception {
deployer.deploy(DEPLOYMENT);
URL servletUrl = new URL(url.toExternalForm() + RunAsAdminServlet.SERVLET_PATH.substring(1) + "?" + Utils.encodeQueryParam(CallProtectedEjbServlet.FILE_PARAM, CORRECT_ROLE_AND_STOP_SERVER.getAbsolutePath()));
Utils.makeCall(servletUrl.toURI(), HTTP_OK);
servletUrl = new URL(url.toExternalForm() + RunAsUserServlet.SERVLET_PATH.substring(1) + "?" + Utils.encodeQueryParam(CallProtectedEjbServlet.FILE_PARAM, INCORRECT_ROLE_AND_STOP_SERVER.getAbsolutePath()));
Utils.makeCall(servletUrl.toURI(), HTTP_OK);
ServerReload.executeReloadAndWaitForCompletion(managementClient.getControllerClient(), 50000);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class ServletRunAsTestCase method runServletWithCorrectRole.
/**
* Access Servlet which uses RunAs with correct role needed for secured EJB invocation.
* <p>
* This method will run init() and doGet() method and stores results.
*
* @param url
* @throws Exception
*/
@Test
@InSequence(1)
@OperateOnDeployment(DEPLOYMENT)
public void runServletWithCorrectRole(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + RunAsAdminServlet.SERVLET_PATH.substring(1) + "?" + Utils.encodeQueryParam(CallProtectedEjbServlet.FILE_PARAM, CORRECT_ROLE_AND_UNDEPLOY.getAbsolutePath()));
correctRoleResult = Utils.makeCall(servletUrl.toURI(), HTTP_OK);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class WebSecurityDIGESTTestCase method testWrongUser.
/**
* Check whether user with incorrect credentials has not access to secured page.
*
* @param url
* @throws Exception
*/
@OperateOnDeployment(DEPLOYMENT)
@Test
public void testWrongUser(@ArquillianResource URL url) throws Exception {
final URL servletUrl = new URL(url.toExternalForm() + SimpleSecuredServlet.SERVLET_PATH.substring(1));
Utils.makeCallWithBasicAuthn(servletUrl, WRONG_USER, WRONG_USER_PASSWORD, HTTP_UNAUTHORIZED);
}
use of org.jboss.arquillian.container.test.api.OperateOnDeployment in project wildfly by wildfly.
the class TransportGuaranteeTestCase method deployAnnWar.
/*@ArquillianResource
@OperateOnDeployment(TG_ANN + WAR)
ManagementClient managementClient;*/
//private boolean beforeServerManagerInitialized = false;
@Deployment(name = TG_ANN + WAR, order = 1, testable = false)
public static WebArchive deployAnnWar() throws Exception {
log.trace("starting deployAnnWar()");
WebArchive war = ShrinkWrap.create(WebArchive.class, TG_ANN + WAR);
war.addClass(TransportGuaranteeAnnotatedServlet.class);
war.addAsResource(TransportGuaranteeTestCase.class.getPackage(), "users.properties", "users.properties");
war.addAsResource(TransportGuaranteeTestCase.class.getPackage(), "roles.properties", "roles.properties");
war.setWebXML(TransportGuaranteeTestCase.class.getPackage(), "annotated-web.xml");
war.addAsWebInfResource(TransportGuaranteeTestCase.class.getPackage(), "jboss-web.xml", "jboss-web.xml");
return war;
}
Aggregations