use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoTimeGateTests method testOriginalLinkHeader.
/**
* Test the presence of a rel=original Link header.
*/
default void testOriginalLinkHeader() {
try (final Response res = target(getResourceLocation()).request().get()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response");
assertTrue(getLinks(res).stream().anyMatch(l -> l.getRels().contains("original") && l.getUri().toString().equals(getResourceLocation())), "Check for a rel=original Link header");
}
}
use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoBinaryTests method testCanonicalHeaderDescriptions.
/**
* Check the link headers on a binary description Memento.
*/
default void testCanonicalHeaderDescriptions() {
getMementos().forEach((memento, date) -> {
final String description = getDescription(memento);
if (description == null) {
fail("Could not find description link header!");
}
try (final Response res = target(description).request().accept("text/turtle").head()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a valid response");
assertTrue(getLinks(res).stream().filter(link -> link.getRels().contains("canonical")).anyMatch(link -> link.getUri().toString().equals(memento + "&ext=description")), "Check for a rel=canonical Link header");
assertTrue(getLinks(res).stream().filter(link -> link.getRels().contains("describes")).anyMatch(link -> link.getUri().toString().equals(memento)), "Check for a rel=describes Link header");
}
});
}
use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoBinaryTests method testCanonicalHeader.
/**
* Check the link headers on a binary Memento.
*/
default void testCanonicalHeader() {
getMementos().forEach((memento, date) -> {
try (final Response res = target(memento).request().head()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a valid response");
assertTrue(getLinks(res).stream().filter(link -> link.getRels().contains("canonical")).anyMatch(link -> link.getUri().toString().equals(memento)), "Check for a rel=canonical Link header");
assertTrue(getLinks(res).stream().filter(link -> link.getRels().contains("describedby")).anyMatch(link -> link.getUri().toString().equals(memento + "&ext=description")), "Check for a rel=describedby Link header");
}
});
}
use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoTimeGateTests method testTimeGateLinkHeader.
/**
* Test the presence of a rel=timegate Link header.
*/
default void testTimeGateLinkHeader() {
try (final Response res = target(getResourceLocation()).request().get()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful response");
assertTrue(getLinks(res).stream().anyMatch(l -> l.getRels().contains("timegate") && l.getUri().toString().equals(getResourceLocation())), "Check for a rel=timegate Link header");
}
}
use of javax.ws.rs.core.Response.Status.Family.SUCCESSFUL in project trellis by trellis-ldp.
the class MementoTimeMapTests method testTimeMapLinkHeader.
/**
* Test the presence of a rel=timemap Link header.
*/
default void testTimeMapLinkHeader() {
try (final Response res = target(getResourceLocation()).request().get()) {
assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful timemap response");
assertTrue(getLinks(res).stream().anyMatch(l -> l.getRels().contains("timemap") && l.getUri().toString().equals(getResourceLocation() + TIMEMAP_QUERY_ARG)), "Check for a rel=timemap Link header");
}
}
Aggregations