use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method fromUriTest.
/*
* @testName: fromUriTest
*
* @assertion_ids: JAXRS:JAVADOC:788;
*
* @test_Strategy: Create a new instance initialized from an existing URI.
*/
@Test
public void fromUriTest() throws Fault {
URI uri = uri(Request.GET.name());
Builder builder = Link.fromUri(uri);
Link link = builder.build();
assertContains(link.toString(), url());
assertContains(link.toString(), "resource");
assertContains(link.toString(), "get");
logMsg("Link", link, "has been created from URI", uri);
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getTypeTest.
/*
* @testName: getTypeTest
*
* @assertion_ids: JAXRS:JAVADOC:795;
*
* @test_Strategy: Returns the value associated with the link "type" param, or
* null if this param is not specified.
*/
@Test
public void getTypeTest() throws Fault {
Builder builder = Link.fromUri(uri("get"));
builder.rel("RELREL").title("TITLETITLE").type("TYPETYPE");
Link link = builder.build();
String type = link.getType();
assertTrue(type != null, "#getType() did NOT return expected title");
assertContains(type, "TYPETYPE");
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getLinkBuilderTest.
/*
* @testName: getLinkBuilderTest
*
* @assertion_ids: JAXRS:JAVADOC:468; JAXRS:JAVADOC:479; JAXRS:JAVADOC:480;
*
* @test_Strategy: Convenience method that returns a
* jakarta.ws.rs.core.Link.Builder for the relation. ClientResponseFilter.filter
*/
@Test
public void getLinkBuilderTest() throws Fault {
final String rel = "RELATION";
ContextProvider in = new ContextProvider() {
@Override
protected void checkFilterContext(ClientRequestContext requestContext, ClientResponseContext responseContext) throws Fault {
Builder builder = responseContext.getLinkBuilder(rel);
assertTrue(builder != null, "the #getLinkBuilder is null");
assertTrue(builder.build().getUri().toASCIIString().contains(getUrl()), "#getLinkBuilder.build was supposed to contain " + getUrl() + " but was " + builder.build().getUri().toASCIIString());
logMsg("Found #getLinkBuilder()=", builder.build().getUri().toASCIIString());
}
};
Response response = Response.ok().link(getUrl(), rel).build();
invokeWithResponseAndAssertStatus(response, Status.OK, in);
}
Aggregations