use of io.undertow.testutils.AjpIgnore in project undertow by undertow-io.
the class LotsOfQueryParametersTestCase method testLotsOfQueryParameters_MaxParameters_BadRequest.
@Test
@AjpIgnore
public void testLotsOfQueryParameters_MaxParameters_BadRequest() throws IOException {
OptionMap existing = DefaultServer.getUndertowOptions();
TestHttpClient client = new TestHttpClient();
try {
StringBuilder qs = new StringBuilder();
// add query parameters more than specified MAX_PARAMETERS
for (int i = 0; i < (TEST_MAX_PARAMETERS + 1); ++i) {
qs.append(QUERY + i);
qs.append("=");
qs.append(URLEncoder.encode(MESSAGE + i, "UTF-8"));
qs.append("&");
}
// delete last useless '&'
qs.deleteCharAt(qs.length() - 1);
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path?" + qs.toString());
DefaultServer.setUndertowOptions(OptionMap.create(UndertowOptions.MAX_PARAMETERS, TEST_MAX_PARAMETERS));
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.BAD_REQUEST, result.getStatusLine().getStatusCode());
} finally {
DefaultServer.setUndertowOptions(existing);
client.getConnectionManager().shutdown();
}
}
use of io.undertow.testutils.AjpIgnore in project undertow by undertow-io.
the class LotsOfQueryParametersTestCase method testLotsOfQueryParameters_MaxParameters_Ok.
@Test
@AjpIgnore
public void testLotsOfQueryParameters_MaxParameters_Ok() throws IOException {
OptionMap existing = DefaultServer.getUndertowOptions();
TestHttpClient client = new TestHttpClient();
try {
StringBuilder qs = new StringBuilder();
for (int i = 0; i < TEST_MAX_PARAMETERS; ++i) {
qs.append(QUERY + i);
qs.append("=");
qs.append(URLEncoder.encode(MESSAGE + i, "UTF-8"));
qs.append("&");
}
// delete last useless '&'
qs.deleteCharAt(qs.length() - 1);
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path?" + qs.toString());
DefaultServer.setUndertowOptions(OptionMap.create(UndertowOptions.MAX_PARAMETERS, TEST_MAX_PARAMETERS));
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
for (int i = 0; i < TEST_MAX_PARAMETERS; ++i) {
Header[] header = result.getHeaders(QUERY + i);
Assert.assertEquals(MESSAGE + i, header[0].getValue());
}
} finally {
DefaultServer.setUndertowOptions(existing);
client.getConnectionManager().shutdown();
}
}
use of io.undertow.testutils.AjpIgnore in project undertow by undertow-io.
the class LotsOfHeadersRequestTestCase method testLotsOfHeadersInRequest_MaxHeaders_Ok.
@Test
@AjpIgnore
public void testLotsOfHeadersInRequest_MaxHeaders_Ok() throws IOException {
OptionMap existing = DefaultServer.getUndertowOptions();
TestHttpClient client = new TestHttpClient();
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path");
for (int i = 0; i < getTestMaxHeaders(); ++i) {
get.addHeader(HEADER + i, MESSAGE + i);
}
DefaultServer.setUndertowOptions(OptionMap.create(UndertowOptions.MAX_HEADERS, TEST_MAX_HEADERS));
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
for (int i = 0; i < getTestMaxHeaders(); ++i) {
Header[] header = result.getHeaders(HEADER + i);
Assert.assertEquals(MESSAGE + i, header[0].getValue());
}
} finally {
DefaultServer.setUndertowOptions(existing);
client.getConnectionManager().shutdown();
}
}
use of io.undertow.testutils.AjpIgnore in project undertow by undertow-io.
the class LotsOfHeadersRequestTestCase method testLotsOfHeadersInRequest_Default_Ok.
@Test
@AjpIgnore
public void testLotsOfHeadersInRequest_Default_Ok() throws IOException {
TestHttpClient client = new TestHttpClient();
try {
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path");
for (int i = 0; i < getDefaultMaxHeaders(); ++i) {
get.addHeader(HEADER + i, MESSAGE + i);
}
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
for (int i = 0; i < getDefaultMaxHeaders(); ++i) {
Header[] header = result.getHeaders(HEADER + i);
Assert.assertEquals(MESSAGE + i, header[0].getValue());
}
} finally {
client.getConnectionManager().shutdown();
}
}
use of io.undertow.testutils.AjpIgnore in project undertow by undertow-io.
the class LotsOfQueryParametersTestCase method testLotsOfQueryParameters_Default_Ok.
@Test
@AjpIgnore
public void testLotsOfQueryParameters_Default_Ok() throws IOException {
TestHttpClient client = new TestHttpClient();
try {
StringBuilder qs = new StringBuilder();
for (int i = 0; i < DEFAULT_MAX_PARAMETERS; ++i) {
qs.append(QUERY + i);
qs.append("=");
qs.append(URLEncoder.encode(MESSAGE + i, "UTF-8"));
qs.append("&");
}
// delete last useless '&'
qs.deleteCharAt(qs.length() - 1);
HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/path?" + qs.toString());
HttpResponse result = client.execute(get);
Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode());
for (int i = 0; i < DEFAULT_MAX_PARAMETERS; ++i) {
Header[] header = result.getHeaders(QUERY + i);
Assert.assertEquals(MESSAGE + i, header[0].getValue());
}
} finally {
client.getConnectionManager().shutdown();
}
}
Aggregations