/** * Test that the binary appears in the parent container. */ @Test @DisplayName("Test that the binary appears in the parent container") default void testBinaryIsInContainer() { final RDF rdf = getInstance(); // Test the root container, verifying that the containment triple exists try (final Response res = target().request().get()) { assertAll("Check binary in container", checkRdfResponse(res, LDP.BasicContainer, null)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.contains(rdf.createIRI(getBaseURL()), LDP.contains, rdf.createIRI(getResourceLocation())), "Check for an ldp:contains triple"); } }
/** * Test that the binary appears in the parent container. */ @Test @DisplayName("Test that the binary appears in the parent container") default void testBinaryIsInContainer() { final RDF rdf = getInstance(); // Test the root container, verifying that the containment triple exists try (final Response res = target().request().get()) { assertAll("Check binary in container", checkRdfResponse(res, LDP.BasicContainer, null)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.contains(rdf.createIRI(getBaseURL()), LDP.contains, rdf.createIRI(getResourceLocation())), "Check for an ldp:contains triple"); } }
/** * Test fetching a binary description. */ @Test @DisplayName("Test fetching a binary description") default void testGetBinaryDescription() { final EntityTag etag = getETag(getResourceLocation()); // Fetch the description try (final Response res = target(getResourceLocation()).request().accept("text/turtle").get()) { assertAll("Check binary description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.size() >= 0L, "Assert that the graph isn't empty"); assertTrue(res.getEntityTag().isWeak(), "Check for a weak ETag"); assertNotEquals(etag, res.getEntityTag(), "Check for different ETag values"); } }
/** * Test fetching a binary description. */ @Test @DisplayName("Test fetching a binary description") default void testGetBinaryDescription() { final EntityTag etag = getETag(getResourceLocation()); // Fetch the description try (final Response res = target(getResourceLocation()).request().accept("text/turtle").get()) { assertAll("Check binary description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.size() >= 0L, "Assert that the graph isn't empty"); assertTrue(res.getEntityTag().isWeak(), "Check for a weak ETag"); assertNotEquals(etag, res.getEntityTag(), "Check for different ETag values"); } }
assertAll("Check an LDP-NR description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); size = g.size(); entity("INSERT { <> <http://purl.org/dc/terms/title> \"Title\" } WHERE {}", APPLICATION_SPARQL_UPDATE))) { assertAll("Check PATCHing LDP-NR description", checkRdfResponse(res, LDP.RDFSource, null)); assertAll("Check the new LDP-NR description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.size() > size, "Check the graph size is greater than " + size);
assertAll("Check an LDP-NR description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); size = g.size(); entity("INSERT { <> <http://purl.org/dc/terms/title> \"Title\" } WHERE {}", APPLICATION_SPARQL_UPDATE))) { assertAll("Check PATCHing LDP-NR description", checkRdfResponse(res, LDP.RDFSource, null)); assertAll("Check the new LDP-NR description", checkRdfResponse(res, LDP.RDFSource, TEXT_TURTLE_TYPE)); final Graph g = readEntityAsGraph(res.getEntity(), getBaseURL(), TURTLE); assertTrue(g.size() > size, "Check the graph size is greater than " + size);