use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getTypeTest.
/*
* @testName: getTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:908; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Get Java type supported by corresponding message body
* provider.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void getTypeTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.GETTYPE);
Response fake = builder.build();
addProviders(fake);
setProperty(Property.SEARCH_STRING, String.class.getName());
invoke();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method removePropertyTest.
/*
* @testName: removePropertyTest
*
* @assertion_ids: JAXRS:JAVADOC:909; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Removes a property with the given name from the current
* request/response exchange context. After removal, subsequent calls to
* getProperty(java.lang.String) to retrieve the property value will return
* null.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void removePropertyTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.REMOVEPROPERTY);
Response fake = builder.build();
addProviders(fake);
setProperty(Property.SEARCH_STRING, TemplateInterceptorBody.NULL);
invoke();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method setTypeTest.
/*
* @testName: setTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:914; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Update Java type before calling message body provider.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void setTypeTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.SETTYPE);
ByteArrayInputStream bais = new ByteArrayInputStream(TemplateInterceptorBody.ENTITY.getBytes());
Reader reader = new InputStreamReader(bais);
Response fake = builder.entity(reader).build();
addProviders(fake);
addProvider(InputStreamReaderProvider.class);
invoke();
InputStreamReader isr = getResponseBody(InputStreamReader.class);
try {
String entity = JaxrsUtil.readFromReader(isr);
assertTrue(entity.contains(InputStreamReader.class.getName()), "Expected " + InputStreamReader.class.getName() + " not found");
logMsg("#setType set correct type", entity);
} catch (IOException e) {
throw new Fault(e);
}
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getMediaTypeTest.
/*
* @testName: getMediaTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:905; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Get media type of HTTP entity.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void getMediaTypeTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.GETMEDIATYPE);
Response fake = builder.type(MediaType.APPLICATION_JSON_TYPE).build();
addProviders(fake);
setProperty(Property.SEARCH_STRING, MediaType.APPLICATION_JSON);
invoke();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method setInputStreamTest.
/*
* @testName: setInputStreamTest
*
* @assertion_ids: JAXRS:JAVADOC:927; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Update the input stream of the object to be read.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void setInputStreamTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.SETINPUTSTREAM);
Response fake = builder.build();
addProviders(fake);
setProperty(Property.SEARCH_STRING, TemplateInterceptorBody.ENTITY2);
invoke();
}
Aggregations