/** * Check the link headers on a binary description Memento. */ @Test @DisplayName("Test the link canonical header") default void testCanonicalHeaderDescriptions() { getMementos().forEach((memento, date) -> { final String description = getDescription(memento); if (isNull(description)) { 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.getRel().equals("canonical")) .anyMatch(link -> link.getUri().toString().equals(memento + "&ext=description")), "Check for a rel=canonical Link header"); assertTrue(getLinks(res).stream().filter(link -> link.getRel().equals("describes")) .anyMatch(link -> link.getUri().toString().equals(memento)), "Check for a rel=describes Link header"); } }); }
/** * Check the link headers on a binary description Memento. */ @Test @DisplayName("Test the link canonical header") default void testCanonicalHeaderDescriptions() { getMementos().forEach((memento, date) -> { final String description = getDescription(memento); if (isNull(description)) { 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.getRel().equals("canonical")) .anyMatch(link -> link.getUri().toString().equals(memento + "&ext=description")), "Check for a rel=canonical Link header"); assertTrue(getLinks(res).stream().filter(link -> link.getRel().equals("describes")) .anyMatch(link -> link.getUri().toString().equals(memento)), "Check for a rel=describes Link header"); } }); }
/** * Test that memento binary descriptions are also LDP resources. */ @Test @DisplayName("Test that memento binary descriptions are also LDP resources") default void testMementoBinaryDescriptionLdpResource() { getMementos().forEach((memento, date) -> { final String description = getDescription(memento); assertNotNull(description, "No describedby Link header!"); try (final Response res = target(description).request().accept("text/turtle").head()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.RDFSource)); } }); } }
/** * Test that memento binary descriptions are also LDP resources. */ @Test @DisplayName("Test that memento binary descriptions are also LDP resources") default void testMementoBinaryDescriptionLdpResource() { getMementos().forEach((memento, date) -> { final String description = getDescription(memento); assertNotNull(description, "No describedby Link header!"); try (final Response res = target(description).request().accept("text/turtle").head()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.RDFSource)); } }); } }