lambdora-service/src/test/java/org/fcrepo/lambdora/service/aws/AwsLambdoraApplicationIT.java
/**
     * Tests creation, existence and retrieval of a new container
     */
Tests creation, existence and retrieval of a new container
Tests creation existence and retrieval of a new container
@Test
    public void testContainerServiceRoundTrip() {
        final ContainerService containerService = application.containerService();
        final URI identifier = URI.create(INTERNAL_URI_PREFIX + "/test");
        final URI parent = URI.create(INTERNAL_URI_PREFIX + "/");
        assertFalse("identifier should not exist", containerService.exists(identifier));
        final Container container = containerService.findOrCreate(identifier);
        assertEquals("identifiers are equal", identifier, container.getIdentifier());
        final AtomicInteger count = new AtomicInteger(0);
        assertTrue("object is ldp:Container",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                    triple.getPredicate().getURI().equals(TYPE.getURI()) &&
                    triple.getObject().getURI().equals(CONTAINER.getURI())
            ));
        assertTrue("object is ldp#RDFSource",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                triple.getPredicate().getURI().equals(TYPE.getURI()) &&
                triple.getObject().getURI().equals(RDF_SOURCE.getURI())
            ));
        assertTrue("object is fedora#Container",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                triple.getPredicate().getURI().equals(TYPE.getURI()) &&
                triple.getObject().getURI().equals(FEDORA_CONTAINER.getURI())
            ));
        assertTrue("object is fedora#Resource",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                triple.getPredicate().getURI().equals(TYPE.getURI()) &&
                triple.getObject().getURI().equals(FEDORA_RESOURCE.getURI())
            ));
        assertTrue("object has fedora#created date",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                triple.getPredicate().getURI().equals(CREATED_DATE.getURI())
            ));
        assertTrue("object has fedora#hasParent",
            container.getTriples().anyMatch(triple -> triple.getSubject().getURI().equals(identifier.toString()) &&
                triple.getPredicate().getURI().equals(HAS_PARENT.getURI()) &&
                triple.getObject().getURI().equals(parent.toString())
            ));
        assertTrue("identifier should exist", containerService.exists(identifier));
    }
@ Test public void testContainerServiceRoundTrip ( ) { final ContainerService containerService = application . containerService ( ) ; final URI identifier = URI . create ( INTERNAL_URI_PREFIX + "/test" ) ; final URI parent = URI . create ( INTERNAL_URI_PREFIX + "/" ) ; assertFalse ( "identifier should not exist" , containerService . exists ( identifier ) ) ; final Container container = containerService . findOrCreate ( identifier ) ; assertEquals ( "identifiers are equal" , identifier , container . getIdentifier ( ) ) ; final AtomicInteger count = new AtomicInteger ( 0 ) ; assertTrue ( "object is ldp:Container" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( TYPE . getURI ( ) ) && triple . getObject ( ) . getURI ( ) . equals ( CONTAINER . getURI ( ) ) ) ) ; assertTrue ( "object is ldp#RDFSource" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( TYPE . getURI ( ) ) && triple . getObject ( ) . getURI ( ) . equals ( RDF_SOURCE . getURI ( ) ) ) ) ; assertTrue ( "object is fedora#Container" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( TYPE . getURI ( ) ) && triple . getObject ( ) . getURI ( ) . equals ( FEDORA_CONTAINER . getURI ( ) ) ) ) ; assertTrue ( "object is fedora#Resource" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( TYPE . getURI ( ) ) && triple . getObject ( ) . getURI ( ) . equals ( FEDORA_RESOURCE . getURI ( ) ) ) ) ; assertTrue ( "object has fedora#created date" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( CREATED_DATE . getURI ( ) ) ) ) ; assertTrue ( "object has fedora#hasParent" , container . getTriples ( ) . anyMatch ( triple -> triple . getSubject ( ) . getURI ( ) . equals ( identifier . toString ( ) ) && triple . getPredicate ( ) . getURI ( ) . equals ( HAS_PARENT . getURI ( ) ) && triple . getObject ( ) . getURI ( ) . equals ( parent . toString ( ) ) ) ) ; assertTrue ( "identifier should exist" , containerService . exists ( identifier ) ) ; }
Tests creation, existence and retrieval of a new container
Tests creation existence and retrieval of a new container
// Check for all system-generated triples for a Container