/** * Check the activity of a resource and its parent. * @param resource the resource IRI * @param agent the agent IRI * @param activityType the activity type * @param resourceType the resource type * @return a stream of tests */ default Stream<Executable> checkResourceParentLdpBC(final String resource, final String agent, final IRI activityType, final IRI resourceType) { return checkResourceParentActivity(resource, getContainerLocation(), agent, activityType, resourceType, LDP.BasicContainer); }
/** * Check the activity of a resource and its parent. * @param resource the resource IRI * @param agent the agent IRI * @param activityType the activity type * @param resourceType the resource type * @return a stream of tests */ default Stream<Executable> checkResourceParentLdpBC(final String resource, final String agent, final IRI activityType, final IRI resourceType) { return checkResourceParentActivity(resource, getContainerLocation(), agent, activityType, resourceType, LDP.BasicContainer); }
/** * Test receiving a creation event message. */ @Test @DisplayName("Test receiving a JMS creation message") default void testReceiveCreateMessage() { await().atMost(15, SECONDS).until(() -> getMessages().stream().anyMatch(checkEventGraph(getContainerLocation(), Trellis.AdministratorAgent, AS.Create, LDP.BasicContainer))); }
/** * Test receiving a creation event message. */ @Test @DisplayName("Test receiving a JMS creation message") default void testReceiveCreateMessage() { await().atMost(15, SECONDS).until(() -> getMessages().stream().anyMatch(checkEventGraph(getContainerLocation(), Trellis.AdministratorAgent, AS.Create, LDP.BasicContainer))); }
/** * Test receiving an update message. */ @Test @DisplayName("Test receiving an update message") default void testReceiveChildMessage() { final String agent = "https://people.apache.org/~acoburn/#i"; // POST an LDP-RS try (final Response res = target(getContainerLocation()).request() .header(AUTHORIZATION, buildJwt(agent, getJwtSecret())).post(entity("", TEXT_TURTLE))) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS POST response"); assertAll("Check the resource parent", checkResourceParentLdpBC(res.getLocation().toString(), agent, AS.Create, LDP.RDFSource)); } }
/** * Test receiving an update message. */ @Test @DisplayName("Test receiving an update message") default void testReceiveChildMessage() { final String agent = "https://people.apache.org/~acoburn/#i"; // POST an LDP-RS try (final Response res = target(getContainerLocation()).request() .header(AUTHORIZATION, buildJwt(agent, getJwtSecret())).post(entity("", TEXT_TURTLE))) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS POST response"); assertAll("Check the resource parent", checkResourceParentLdpBC(res.getLocation().toString(), agent, AS.Create, LDP.RDFSource)); } }
/** * Test receiving a delete message. */ @Test @DisplayName("Test receiving a delete message") default void testReceiveDeleteMessage() { final String resource; final String agent1 = "https://madison.example.com/profile#me"; // POST an LDP-RS try (final Response res = target(getContainerLocation()).request() .header(AUTHORIZATION, buildJwt(agent1, getJwtSecret())).post(entity("", TEXT_TURTLE))) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS POST response"); resource = res.getLocation().toString(); assertAll("Check the resource parent", checkResourceParentLdpBC(resource, agent1, AS.Create, LDP.RDFSource)); } final String agent2 = "https://pat.example.com/profile#me"; // DELETE the LDP-RS try (final Response res = target(resource).request().header(AUTHORIZATION, buildJwt(agent2, getJwtSecret())) .delete()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS DELETE response"); assertAll("Check the LDP-BC parent", checkResourceParentLdpBC(resource, agent2, AS.Delete, LDP.Resource)); } }
/** * Test receiving a delete message. */ @Test @DisplayName("Test receiving a delete message") default void testReceiveDeleteMessage() { final String resource; final String agent1 = "https://madison.example.com/profile#me"; // POST an LDP-RS try (final Response res = target(getContainerLocation()).request() .header(AUTHORIZATION, buildJwt(agent1, getJwtSecret())).post(entity("", TEXT_TURTLE))) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS POST response"); resource = res.getLocation().toString(); assertAll("Check the resource parent", checkResourceParentLdpBC(resource, agent1, AS.Create, LDP.RDFSource)); } final String agent2 = "https://pat.example.com/profile#me"; // DELETE the LDP-RS try (final Response res = target(resource).request().header(AUTHORIZATION, buildJwt(agent2, getJwtSecret())) .delete()) { assertEquals(SUCCESSFUL, res.getStatusInfo().getFamily(), "Verify a successful LDP-RS DELETE response"); assertAll("Check the LDP-BC parent", checkResourceParentLdpBC(resource, agent2, AS.Delete, LDP.Resource)); } }
try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.Container.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(containerContent, TEXT_TURTLE))) { try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.DirectContainer.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(directContainerContent, TEXT_TURTLE))) { try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.IndirectContainer.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(indirectContainerContent, TEXT_TURTLE))) {
try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.Container.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(containerContent, TEXT_TURTLE))) { try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.DirectContainer.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(directContainerContent, TEXT_TURTLE))) { try (final Response res = target(getContainerLocation()).request() .header(LINK, fromUri(LDP.IndirectContainer.getIRIString()).rel(TYPE).build()) .header(AUTHORIZATION, jwt).post(entity(indirectContainerContent, TEXT_TURTLE))) {