use of org.glassfish.jersey.internal.MapPropertiesDelegate in project jersey by jersey.
the class PropertyValidationTest method assertApply.
private void assertApply(int responseStatus, ResourceConfig resourceConfig, URI uri) throws InterruptedException, ExecutionException {
final ApplicationHandler applicationHandler = new ApplicationHandler(resourceConfig);
final ContainerRequest requestContext = new ContainerRequest(uri, uri, "POST", null, new MapPropertiesDelegate());
final ContainerResponse containerResponse = applicationHandler.apply(requestContext).get();
assertEquals(responseStatus, containerResponse.getStatus());
}
use of org.glassfish.jersey.internal.MapPropertiesDelegate in project jersey by jersey.
the class ContainerRequestTest method testMethod.
@Test
public void testMethod() {
ContainerRequest r = new ContainerRequest(URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"), "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
assertEquals(r.getMethod(), "GET");
}
use of org.glassfish.jersey.internal.MapPropertiesDelegate in project jersey by jersey.
the class ContainerRequestTest method testPreconditionsMatch.
@Test
public void testPreconditionsMatch() {
ContainerRequest r = new ContainerRequest(URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"), "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
r.header(HttpHeaders.IF_MATCH, "\"686897696a7c876b7e\"");
assertNull(r.evaluatePreconditions(new EntityTag("686897696a7c876b7e")));
assertEquals(r.evaluatePreconditions(new EntityTag("0")).build().getStatus(), Response.Status.PRECONDITION_FAILED.getStatusCode());
}
use of org.glassfish.jersey.internal.MapPropertiesDelegate in project jersey by jersey.
the class ContainerRequestTest method testSelectVariant.
@Test
public void testSelectVariant() {
ContainerRequest r = new ContainerRequest(URI.create("http://example.org/app"), URI.create("http://example.org/app/resource"), "GET", SECURITY_CONTEXT, new MapPropertiesDelegate());
r.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
r.header(HttpHeaders.ACCEPT_LANGUAGE, "en");
List<Variant> lv = Variant.mediaTypes(MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_JSON_TYPE).languages(Locale.ENGLISH, Locale.FRENCH).add().build();
assertEquals(r.selectVariant(lv).getMediaType(), MediaType.APPLICATION_JSON_TYPE);
assertEquals(r.selectVariant(lv).getLanguage(), Locale.ENGLISH);
}
use of org.glassfish.jersey.internal.MapPropertiesDelegate in project jersey by jersey.
the class JsonProcessingAutoDiscoverableServerTest method _test.
private void _test(final String response, final Boolean globalDisable, final Boolean serverDisable) throws Exception {
final ResourceConfig resourceConfig = new ResourceConfig(Resource.class, Filter.class);
if (globalDisable != null) {
resourceConfig.property(CommonProperties.JSON_PROCESSING_FEATURE_DISABLE, globalDisable);
}
if (serverDisable != null) {
resourceConfig.property(ServerProperties.JSON_PROCESSING_FEATURE_DISABLE, serverDisable);
}
final ApplicationHandler app = new ApplicationHandler(resourceConfig);
final URI baseUri = URI.create("/");
assertEquals(response, app.apply(new ContainerRequest(baseUri, baseUri, "GET", null, new MapPropertiesDelegate())).get().getEntity());
}
Aggregations