use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method setStatusInfoTest.
/*
* @testName: setStatusInfoTest
*
* @assertion_ids: JAXRS:JAVADOC:478; JAXRS:JAVADOC:479; JAXRS:JAVADOC:480;
*
* @test_Strategy: Set the complete status information associated with the
* response.
*
* ClientResponseFilter.filter
*/
@Test
public void setStatusInfoTest() throws Fault {
ContextProvider in = new ContextProvider() {
@Override
protected void checkFilterContext(ClientRequestContext requestContext, ClientResponseContext responseContext) throws Fault {
StatusType info = new StatusType() {
@Override
public int getStatusCode() {
return Status.FOUND.getStatusCode();
}
@Override
public String getReasonPhrase() {
return null;
}
@Override
public Family getFamily() {
return null;
}
};
responseContext.setStatusInfo(info);
}
};
Response response = Response.ok().build();
invokeWithResponseAndAssertStatus(response, Status.FOUND, in);
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class ResponseFilter method setStatusInfo.
public void setStatusInfo() {
String entity = (String) responseContext.getEntity();
final int status = Integer.parseInt(entity);
StatusType type = new StatusType() {
@Override
public int getStatusCode() {
return status;
}
@Override
public String getReasonPhrase() {
return null;
}
@Override
public Family getFamily() {
return Family.familyOf(status);
}
};
responseContext.setStatusInfo(type);
resetStatusEntity(status);
}
use of jakarta.ws.rs.core.Response.StatusType in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getStatusInfoTest.
/*
* @testName: getStatusInfoTest
*
* @assertion_ids: JAXRS:JAVADOC:858;
*
* @test_Strategy: Get the complete status information associated with the
* response.
*/
@Test
public void getStatusInfoTest() throws Fault {
for (Status status : Status.values()) {
setProperty(Property.STATUS_CODE, getStatusCode(status));
Response response = invokePost("statusinfo", status.name());
StatusType info = response.getStatusInfo();
assertEqualsInt(info.getStatusCode(), status.getStatusCode(), "#getStatusInfo returned unexpected value", info);
}
logMsg("#getStatusInfo returned expected StatusTypes");
}
Aggregations