use of ee.jakarta.tck.ws.rs.common.provider.StringBeanWithAnnotation in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getEntityAnnotationsIsNotTakenFromEntityClassTest.
/*
* @testName: getEntityAnnotationsIsNotTakenFromEntityClassTest
*
* @assertion_ids: JAXRS:JAVADOC:435; JAXRS:JAVADOC:455; JAXRS:JAVADOC:456;
* JAXRS:SPEC:85; JAXRS:JAVADOC:427;
*
* @test_Strategy: Get the annotations attached to the entity. Note that the
* returned annotations array contains only those annotations explicitly
* attached to entity instance (such as the ones attached using
* Entity.Entity(Object, jakarta.ws.rs.core.MediaType,
* java.lang.annotation.Annotation[]) method). The entity instance annotations
* array does not include annotations declared on the entity implementation
* class or its ancestors.
*
* ClientRequestFilter.abortWith
*/
@Test
public void getEntityAnnotationsIsNotTakenFromEntityClassTest() throws Fault {
ContextProvider provider = new ContextProvider() {
@Override
protected void checkFilterContext(ClientRequestContext context) throws Fault {
Annotation[] annotations = context.getEntityAnnotations();
String first = annotations == null ? "0" : String.valueOf(annotations.length);
Response r = Response.ok(first).build();
context.abortWith(r);
}
};
Entity<StringBeanWithAnnotation> post = createEntity(new StringBeanWithAnnotation("test"));
Invocation invocation = buildTarget(provider).register(StringBeanEntityProvider.class).request().buildPost(post);
Response response = invoke(invocation);
String entity = response.readEntity(String.class);
assertContains(entity, "0");
}
use of ee.jakarta.tck.ws.rs.common.provider.StringBeanWithAnnotation in project jaxrs-api by eclipse-ee4j.
the class Resource method getEntityAnnotationsOnEntity.
@POST
@Path("getentityannotationsonentity")
public Response getEntityAnnotationsOnEntity(String entity) {
ResponseBuilder builder = createResponseWithHeader();
builder = builder.entity(new StringBeanWithAnnotation(entity));
Response response = builder.build();
return response;
}
Aggregations