use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method checkCreatedResponseBuilderTest.
/*
* @testName: checkCreatedResponseBuilderTest
*
* @assertion_ids: JAXRS:JAVADOC:288;
*
* @test_Strategy: Check that RuntimeDelegate.createResponseBuilder makes no
* exception and is not null
*
*/
@Test
public void checkCreatedResponseBuilderTest() throws Fault {
ResponseBuilder builder = delegate.createResponseBuilder();
assertTrue(builder != null, "ResponseBuilderTest has not been created");
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getPropertyNamesIsReadOnlyTest.
/*
* @testName: getPropertyNamesIsReadOnlyTest
*
* @assertion_ids: JAXRS:JAVADOC:1007; JAXRS:JAVADOC:920; JAXRS:SPEC:85;
*
* @test_Strategy: Returns immutable java.util.Collection containing the
* property names available within the context of the current request/response
* exchange context.
*
* ReaderInterceptor.aroundReadFrom If abortWith is invoked, execution is
* aborted
*/
@Test
public void getPropertyNamesIsReadOnlyTest() throws Fault {
ResponseBuilder builder = createResponse(ContextOperation.GETPROPERTYNAMESISREADONLY);
Response fake = builder.build();
addProviders(fake);
setProperty(Property.UNORDERED_SEARCH_STRING, TemplateInterceptorBody.NULL);
invoke();
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method statusTest2.
/*
* @testName: statusTest2
*
* @assertion_ids: JAXRS:JAVADOC:131; JAXRS:JAVADOC:154; JAXRS:JAVADOC:141;
* JAXRS:JAVADOC:123; JAXRS:JAVADOC:124; JAXRS:JAVADOC:125;
*
* @test_Strategy: Create an instance of ResponseBuilder Response.ok();
* Setting status using ResponseBuilder.status(Status); verify that correct
* status code is returned
*/
@Test
public void statusTest2() throws Fault {
VerificationResult result = new VerificationResult();
Response resp = null;
ResponseBuilder respb = null;
for (int i = 0; i < status_codes.length - 1; i++) {
respb = Response.ok();
respb = respb.status(resp_status[i]);
resp = respb.build();
result.append(verifyStatus(resp, status_codes[i]));
}
logMsg(result);
assertTrue(result.pass);
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method allowStringArrayNullRemovesAllTest.
/*
* @testName: allowStringArrayNullRemovesAllTest
*
* @assertion_ids: JAXRS:JAVADOC:875;
*
* @test_Strategy: if null any existing allowed method list will be removed.
*/
@Test
public void allowStringArrayNullRemovesAllTest() throws Fault {
String[] methods = { Request.OPTIONS.name(), Request.GET.name() };
ResponseBuilder rb = RuntimeDelegate.getInstance().createResponseBuilder();
Response response = rb.allow(methods).allow((String[]) null).build();
Set<String> set = response.getAllowedMethods();
assertEqualsInt(0, set.size(), "No one allow method should be present");
logMsg("Allowed methods has been removed by null value as expected");
}
use of jakarta.ws.rs.core.Response.ResponseBuilder in project jaxrs-api by eclipse-ee4j.
the class BuilderClientIT method allowStringArrayTest.
/*
* @testName: allowStringArrayTest
*
* @assertion_ids: JAXRS:JAVADOC:875;
*
* @test_Strategy: Set the list of allowed methods for the resource.
*/
@Test
public void allowStringArrayTest() throws Fault {
String[] methods = { Request.OPTIONS.name(), Request.TRACE.name() };
ResponseBuilder rb = RuntimeDelegate.getInstance().createResponseBuilder();
Response response = rb.allow(methods).build();
Set<String> set = response.getAllowedMethods();
String responseMethods = JaxrsUtil.iterableToString(" ", set);
for (String method : methods) {
assertContains(responseMethods, method, "Expected allow method", method, "was not found in response allowed methods", responseMethods);
logMsg("Found expected allowed method", method);
}
}
Aggregations