/** * Test the presence of three mementos. */ @Test @DisplayName("Test the presence of three mementos") default void testMementosWereFound() { final Map<String, String> mementos = getMementos(); assertFalse(mementos.isEmpty(), "Check that mementos were found"); assertEquals(3, mementos.size(), "Check that 3 mementos were found"); }
/** * Test the presence of three mementos. */ @Test @DisplayName("Test the presence of three mementos") default void testMementosWereFound() { final Map<String, String> mementos = getMementos(); assertFalse(mementos.isEmpty(), "Check that mementos were found"); assertEquals(3, mementos.size(), "Check that 3 mementos were found"); }
/** * Test allowed methods on memento resources. */ @Test @DisplayName("Test allowed methods on memento resources") default void testMementoAllowedMethods() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertAll("Check allowed methods", checkMementoAllowedMethods(res)); } }); }
/** * Test allowed methods on memento resources. */ @Test @DisplayName("Test allowed methods on memento resources") default void testMementoAllowedMethods() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertAll("Check allowed methods", checkMementoAllowedMethods(res)); } }); }
/** * Test that memento resources are also LDP resources. */ @Test @DisplayName("Test that memento resources are also LDP resources") default void testMementoLdpResource() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.RDFSource)); } }); }
/** * Test that memento resources are also LDP resources. */ @Test @DisplayName("Test that memento resources are also LDP resources") default void testMementoLdpResource() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertAll("Check LDP headers", checkMementoLdpHeaders(res, LDP.RDFSource)); } }); }
/** * Test the presence of a datetime header for each memento. */ @Test @DisplayName("Test the presence of a datetime header for each memento") default void testMementoDateTimeHeader() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful memento request"); final ZonedDateTime zdt = ZonedDateTime.parse(date, RFC_1123_DATE_TIME); assertEquals(zdt, ZonedDateTime.parse(res.getHeaderString(MEMENTO_DATETIME), RFC_1123_DATE_TIME), "Check that the memento-datetime header is correct"); } }); }
/** * Test the presence of a datetime header for each memento. */ @Test @DisplayName("Test the presence of a datetime header for each memento") default void testMementoDateTimeHeader() { getMementos().forEach((memento, date) -> { try (final Response res = target(memento).request().get()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful memento request"); final ZonedDateTime zdt = ZonedDateTime.parse(date, RFC_1123_DATE_TIME); assertEquals(zdt, ZonedDateTime.parse(res.getHeaderString(MEMENTO_DATETIME), RFC_1123_DATE_TIME), "Check that the memento-datetime header is correct"); } }); }
/** * Test the presence of a datetime header for each memento. */ @Test @DisplayName("Test the presence of a datetime header for each memento") default void testMementoAcceptDateTimeHeader() { getMementos().forEach((memento, date) -> { final String location; try (final Response res = target(getResourceLocation()).request().header(ACCEPT_DATETIME, date).head()) { if (REDIRECTION.equals(res.getStatusInfo().getFamily())) { location = res.getLocation().toString(); } else { assumeTrue(SUCCESSFUL.equals(res.getStatusInfo().getFamily())); location = getResourceLocation(); } } try (final Response res = target(location).request().header(ACCEPT_DATETIME, date).head()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful memento request"); final ZonedDateTime zdt = ZonedDateTime.parse(date, RFC_1123_DATE_TIME); assertEquals(zdt, ZonedDateTime.parse(res.getHeaderString(MEMENTO_DATETIME), RFC_1123_DATE_TIME), "Check that the memento-datetime header is correct"); } }); }
/** * Test the presence of a datetime header for each memento. */ @Test @DisplayName("Test the presence of a datetime header for each memento") default void testMementoAcceptDateTimeHeader() { getMementos().forEach((memento, date) -> { final String location; try (final Response res = target(getResourceLocation()).request().header(ACCEPT_DATETIME, date).head()) { if (REDIRECTION.equals(res.getStatusInfo().getFamily())) { location = res.getLocation().toString(); } else { assumeTrue(SUCCESSFUL.equals(res.getStatusInfo().getFamily())); location = getResourceLocation(); } } try (final Response res = target(location).request().header(ACCEPT_DATETIME, date).head()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Check for a successful memento request"); final ZonedDateTime zdt = ZonedDateTime.parse(date, RFC_1123_DATE_TIME); assertEquals(zdt, ZonedDateTime.parse(res.getHeaderString(MEMENTO_DATETIME), RFC_1123_DATE_TIME), "Check that the memento-datetime header is correct"); } }); }
final RDF rdf = getInstance(); final Dataset dataset = rdf.createDataset(); final Map<String, String> mementos = getMementos(); mementos.forEach((memento, date) -> { try (final Response res = target(memento).request().get()) {
final RDF rdf = getInstance(); final Dataset dataset = rdf.createDataset(); final Map<String, String> mementos = getMementos(); mementos.forEach((memento, date) -> { try (final Response res = target(memento).request().get()) {