use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.
the class JAXRSProvidersClientIT method writeBodyEntityUsingWriterTest.
/*
* @testName: writeBodyEntityUsingWriterTest
*
* @assertion_ids: JAXRS:JAVADOC:87; JAXRS:JAVADOC:276; JAXRS:JAVADOC:283;
* JAXRS:JAVADOC:132; JAXRS:JAVADOC:275; JAXRS:JAVADOC:276; JAXRS:JAVADOC:304;
*
* @test_Strategy: Check BodyWriter is used for text/xml to write entity
*/
@Test
public void writeBodyEntityUsingWriterTest() throws Fault {
String ename = EnumProvider.JAXRS.name();
String search = new ReadableWritableEntity(ename).toXmlString();
setProperty(Property.REQUEST_HEADERS, "Accept: " + MediaType.TEXT_XML);
setProperty(Property.REQUEST, buildRequest(GET, "writeBodyEntityUsingWriter"));
setProperty(Property.STATUS_CODE, getStatusCode(Status.OK));
setProperty(Property.SEARCH_STRING, search);
invoke();
}
use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.
the class JAXRSProvidersClientIT method writeHeaderEntityUsingWriterTest.
/*
* @testName: writeHeaderEntityUsingWriterTest
*
* @assertion_ids: JAXRS:JAVADOC:87; JAXRS:JAVADOC:276; JAXRS:JAVADOC:132;
* JAXRS:JAVADOC:275; JAXRS:JAVADOC:277; JAXRS:JAVADOC:304;
*
* @test_Strategy: Check HeaderWriter is used for text/xml to write entity
*/
@Test
public void writeHeaderEntityUsingWriterTest() throws Fault {
String ename = EnumProvider.JAXRS.name();
String search = new ReadableWritableEntity(ename).toXmlString();
setProperty(Property.REQUEST_HEADERS, "Accept: " + MediaType.TEXT_XML);
setProperty(Property.REQUEST, buildRequest(GET, "writeHeaderEntityUsingWriter"));
setProperty(Property.STATUS_CODE, getStatusCode(Status.OK));
setProperty(Property.EXPECTED_HEADERS, ReadableWritableEntity.NAME + ":" + search);
invoke();
}
use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.
the class JAXRSProvidersClientIT method readEntityFromHeaderTest.
/*
* @testName: readEntityFromHeaderTest
*
* @assertion_ids: JAXRS:JAVADOC:271; JAXRS:JAVADOC:272; JAXRS:JAVADOC:138;
* JAXRS:JAVADOC:304; JAXRS:JAVADOC:282;
*
* @test_Strategy: Put entity to header and read it using reader
*/
@Test
public void readEntityFromHeaderTest() throws Fault {
ReadableWritableEntity entity;
entity = new ReadableWritableEntity(EnumProvider.JAXRS.name());
String header = ReadableWritableEntity.NAME + ":" + entity.toXmlString();
setProperty(Property.REQUEST_HEADERS, "Content-Type: " + MediaType.TEXT_XML);
setProperty(Property.REQUEST_HEADERS, header);
setProperty(Property.REQUEST, buildRequest("POST", "readEntityFromHeader"));
setProperty(Property.STATUS_CODE, getStatusCode(Status.OK));
invoke();
}
use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.
the class ProvidersServlet method isRegisteredWriterXml.
@GET
@Path("isRegisteredMessageWriterXml")
public Response isRegisteredWriterXml() {
MessageBodyWriter<ReadableWritableEntity> entity;
entity = providers.getMessageBodyWriter(ReadableWritableEntity.class, null, getMethodAnnotations("writeBodyEntityUsingWriter"), MediaType.TEXT_XML_TYPE);
Status status = entity == null ? Status.NOT_ACCEPTABLE : Status.OK;
return Response.status(status).build();
}
use of ee.jakarta.tck.ws.rs.ee.rs.ext.messagebodyreaderwriter.ReadableWritableEntity in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method clientAnyWriterUsageTest.
/*
* @testName: clientAnyWriterUsageTest
*
* @assertion_ids: JAXRS:SPEC:69;
*
* @test_Strategy: JAX-RS implementations are REQUIRED to use entity providers
*/
@Test
public void clientAnyWriterUsageTest() throws Fault {
ReadableWritableEntity entity = new ReadableWritableEntity(String.valueOf(serialVersionUID));
addProvider(new EntityMessageWriter());
setProperty(Property.REQUEST, buildRequest(Request.POST, "writerprovider"));
setProperty(Property.REQUEST_HEADERS, buildAccept(MediaType.TEXT_XML_TYPE));
setRequestContentEntity(entity);
setProperty(Property.SEARCH_STRING, entity.toXmlString());
invoke();
}
Aggregations