Search in sources :

Example 6 with ReadableWritableEntity

use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method clientAnyReaderUsageTest.

/* Run test */
/*
   * @testName: clientAnyReaderUsageTest
   * 
   * @assertion_ids: JAXRS:SPEC:69;
   * 
   * @test_Strategy: JAX-RS implementations are REQUIRED to use entity providers
   */
@Test
public void clientAnyReaderUsageTest() throws Fault {
    addProvider(new EntityMessageReader());
    setProperty(Property.REQUEST, buildRequest(Request.GET, "readerprovider"));
    setProperty(Property.REQUEST_HEADERS, buildAccept(MediaType.TEXT_XML_TYPE));
    setProperty(Property.SEARCH_STRING, Resource.class.getName());
    bufferEntity(true);
    invoke();
    ReadableWritableEntity entity = getResponse().readEntity(ReadableWritableEntity.class);
    assertTrue(entity != null, "Returned Entity is null!");
    assertTrue(entity.toString().equals(Resource.class.getName()), "Returned Entity" + entity.toString() + "is unexpected");
}
Also used : ReadableWritableEntity(ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity) Test(org.junit.jupiter.api.Test)

Example 7 with ReadableWritableEntity

use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.

the class ReturnTypeTest method entityResponseTest.

@GET
@Path("entitybodyresponsetest")
public Response entityResponseTest() {
    RuntimeDelegate rd = RuntimeDelegate.getInstance();
    ResponseBuilder rb = rd.createResponseBuilder();
    ReadableWritableEntity rwe = entityTest();
    return rb.entity(rwe).build();
}
Also used : ReadableWritableEntity(ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity) ResponseBuilder(jakarta.ws.rs.core.Response.ResponseBuilder) RuntimeDelegate(jakarta.ws.rs.ext.RuntimeDelegate) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Example 8 with ReadableWritableEntity

use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.

the class ProvidersServlet method isRegisteredEntityMessageReaderXml.

@GET
@Path("isRegisteredMessageReaderXml")
public Response isRegisteredEntityMessageReaderXml() {
    MessageBodyReader<ReadableWritableEntity> reader;
    reader = providers.getMessageBodyReader(ReadableWritableEntity.class, null, getArgumentAnnotations("readEntityFromBody"), MediaType.TEXT_XML_TYPE);
    Status status = reader == null ? Status.NOT_ACCEPTABLE : Status.OK;
    return Response.status(status).build();
}
Also used : Status(jakarta.ws.rs.core.Response.Status) ReadableWritableEntity(ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Example 9 with ReadableWritableEntity

use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.

the class ProvidersServlet method isRegisteredWriterWildCard.

@GET
@Path("isRegisteredWriterWildcard")
public Response isRegisteredWriterWildCard() {
    MessageBodyWriter<ReadableWritableEntity> writer;
    writer = providers.getMessageBodyWriter(ReadableWritableEntity.class, null, getMethodAnnotations("writeBodyEntityUsingWriter"), MediaType.WILDCARD_TYPE);
    Status status = writer == null ? Status.NOT_ACCEPTABLE : Status.OK;
    return Response.status(status).build();
}
Also used : Status(jakarta.ws.rs.core.Response.Status) ReadableWritableEntity(ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Example 10 with ReadableWritableEntity

use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.

the class ProvidersServlet method isRegisteredEntityMessageReaderWildcard.

@GET
@Path("isRegisteredMessageReaderWildCard")
public Response isRegisteredEntityMessageReaderWildcard() {
    MessageBodyReader<ReadableWritableEntity> reader;
    reader = providers.getMessageBodyReader(ReadableWritableEntity.class, null, getArgumentAnnotations("readEntityFromBody"), MediaType.WILDCARD_TYPE);
    Status status = reader == null ? Status.NOT_ACCEPTABLE : Status.OK;
    return Response.status(status).build();
}
Also used : Status(jakarta.ws.rs.core.Response.Status) ReadableWritableEntity(ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Aggregations

ReadableWritableEntity (ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity)12 Test (org.junit.jupiter.api.Test)6 GET (jakarta.ws.rs.GET)5 Path (jakarta.ws.rs.Path)5 Status (jakarta.ws.rs.core.Response.Status)4 ApplicationHolderSingleton (ee.jakarta.tck.ws.rs.ee.rs.core.application.ApplicationHolderSingleton)1 ResponseBuilder (jakarta.ws.rs.core.Response.ResponseBuilder)1 RuntimeDelegate (jakarta.ws.rs.ext.RuntimeDelegate)1 HashSet (java.util.HashSet)1