use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationConfiguredGloballyTestCase method testInvalidRequestsAreAcceptedDependingOnGlobalValidationConfiguration.
@Test
public void testInvalidRequestsAreAcceptedDependingOnGlobalValidationConfiguration() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/globally-configured-validate/3/disabled");
HttpResponse result = client.execute(get);
Assert.assertEquals("No constraint violated", 200, result.getStatusLine().getStatusCode());
EntityUtils.consume(result.getEntity());
get = new HttpGet(url + "myjaxrs/globally-configured-validate/3/enabled");
result = client.execute(get);
Assert.assertEquals("Parameter constraint violated", 400, result.getStatusLine().getStatusCode());
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationIntegrationTestCase method testInvalidRequestCausingPropertyConstraintViolation.
@Test
public void testInvalidRequestCausingPropertyConstraintViolation() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/another-validate/3");
HttpResponse result = client.execute(get);
Assert.assertEquals("Property constraint violated", 400, result.getStatusLine().getStatusCode());
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationIntegrationTestCase method testInvalidRequest.
@Test
public void testInvalidRequest() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/validate/3");
HttpResponse result = client.execute(get);
Assert.assertEquals("Parameter constraint violated", 400, result.getStatusLine().getStatusCode());
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationIntegrationTestCase method testInvalidResponse.
@Test
public void testInvalidResponse() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/validate/11");
HttpResponse result = client.execute(get);
Assert.assertEquals("Return value constraint violated", 500, result.getStatusLine().getStatusCode());
}
use of org.apache.http.impl.conn.PoolingClientConnectionManager in project wildfly by wildfly.
the class BeanValidationIntegrationTestCase method testInvalidRequestsAreAcceptedDependingOnValidationConfiguration.
@Test
public void testInvalidRequestsAreAcceptedDependingOnValidationConfiguration() throws Exception {
DefaultHttpClient client = new DefaultHttpClient(new PoolingClientConnectionManager());
HttpGet get = new HttpGet(url + "myjaxrs/yet-another-validate/3/disabled");
HttpResponse result = client.execute(get);
Assert.assertEquals("No constraint violated", 200, result.getStatusLine().getStatusCode());
EntityUtils.consume(result.getEntity());
get = new HttpGet(url + "myjaxrs/yet-another-validate/3/enabled");
result = client.execute(get);
Assert.assertEquals("Parameter constraint violated", 400, result.getStatusLine().getStatusCode());
}
Aggregations