use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method baseUriURITest.
/*
* @testName: baseUriURITest
*
* @assertion_ids: JAXRS:JAVADOC:1125; JAXRS:JAVADOC:1053;
*
* @test_Strategy: Set the base URI for resolution of relative URIs.
*
* jakarta.ws.rs.ext.RuntimeDelegate.createLinkBuilder
*/
@Test
public void baseUriURITest() throws Fault {
URI uri = null;
try {
uri = new URI(url());
} catch (URISyntaxException use) {
fault(use);
}
Builder linkBuilder = RuntimeDelegate.getInstance().createLinkBuilder();
linkBuilder = linkBuilder.baseUri(uri);
URI createdUri = linkBuilder.uri("/a/b/c").build().getUri();
logMsg("Created URI", createdUri.toASCIIString());
assertContains(createdUri.toASCIIString(), uri.toASCIIString());
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getLinkBuilderForTheNotPresentRelationTest.
/*
* @testName: getLinkBuilderForTheNotPresentRelationTest
*
* @assertion_ids: JAXRS:JAVADOC:854;
*
* @test_Strategy: returns null if not present.
*/
@Test
public void getLinkBuilderForTheNotPresentRelationTest() throws Fault {
Response response = Response.ok().build();
Builder builder = response.getLinkBuilder("anyrelation");
assertTrue(builder == null, "#getLinkBuilder('relation') returned unexpected builder" + builder);
logMsg("#getLinkBuilder returned null as expected");
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getLinkBuilderForTheNotPresentRelationTest.
/*
* @testName: getLinkBuilderForTheNotPresentRelationTest
*
* @assertion_ids: JAXRS:JAVADOC:854;
*
* @test_Strategy: returns null if not present.
*/
@Test
public void getLinkBuilderForTheNotPresentRelationTest() throws Fault {
Response response = invokeGet("entity");
Builder builder = response.getLinkBuilder("anyrelation");
assertNull(builder, "#getLinkBuilder('relation') returned unexpected builder", builder);
logMsg("#getLinkBuilder returned null as expected");
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method uriBuilderTest.
/*
* @testName: uriBuilderTest
*
* @assertion_ids: JAXRS:JAVADOC:1006; JAXRS:JAVADOC:1053;
*
* @test_Strategy: Set underlying URI builder representing the URI template for
* the link being constructed.
*
* jakarta.ws.rs.ext.RuntimeDelegate.createLinkBuilder
*/
@Test
public void uriBuilderTest() throws Fault {
String segment = "goto/label/ten/";
Link link = Link.fromUri(uri(segment)).build();
UriBuilder uriBuilder = link.getUriBuilder();
Builder linkBuilder = RuntimeDelegate.getInstance().createLinkBuilder().uriBuilder(uriBuilder);
String sBuilder = uriBuilder.build().toASCIIString();
String sFromBuilder = linkBuilder.build().getUri().toASCIIString();
assertContains(sFromBuilder, sBuilder, "Original builder", sBuilder, "not found in #fromUriBuilder", sFromBuilder);
logMsg("#fromUriBuilder", sFromBuilder, "contains the original", sBuilder);
}
use of jakarta.ws.rs.core.Link.Builder in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method uriStringTest.
/*
* @testName: uriStringTest
*
* @assertion_ids: JAXRS:JAVADOC:813; JAXRS:JAVADOC:1053;
*
* @test_Strategy: Set underlying string representing URI template for the link
* being constructed.
*
* jakarta.ws.rs.ext.RuntimeDelegate.createLinkBuilder
*/
@Test
public void uriStringTest() throws Fault {
Link.Builder builder = RuntimeDelegate.getInstance().createLinkBuilder().uri(url());
Link link = builder.build();
assertTrue(link.toString().contains(url()), "uri(String) " + url() + " not used in " + link);
logMsg("#uri(String) affected link", link, "as expected");
}
Aggregations