Package org.apache.stanbol.cmsadapter.servicesapi.model.web

Examples of org.apache.stanbol.cmsadapter.servicesapi.model.web.CMSObject


        offlineAccess.getNodeByPath("/", new Object());
    }

    @Test
    public void testGetNodeById() throws RepositoryAccessException {
        CMSObject expected = (CMSObject) repository.get(0);
        List<CMSObject> real = offlineAccess.getNodeById(expected.getUniqueRef(), null);

        assertEquals(1, real.size());
        assertSame(expected, real.get(0));

        expectedException.expect(RepositoryAccessException.class);
View Full Code Here


    }

    @Test
    public void testGetNodeByName() throws RepositoryAccessException {
        CMSObject c11 = (CMSObject) repository.get(1);
        CMSObject c13 = (CMSObject) repository.get(3);

        List<CMSObject> real = offlineAccess.getNodeByName(c11.getLocalname(), null);
        assertEquals(2, real.size());
        assertSame(c11, real.get(0));
        assertSame(c13, real.get(1));
View Full Code Here

        offlineAccess.getNodeByName(UUID.randomUUID().toString(), new Object());
    }

    @Test
    public void testGetFirstNodeByPath() throws RepositoryAccessException {
        CMSObject real = offlineAccess.getFirstNodeByPath("/", null);
        // Check only the root is returned
        assertSame(repository.get(0), real);

        CMSObject all = offlineAccess.getFirstNodeByPath("/%", null);
        assertNotNull(all);

        expectedException.expect(IllegalArgumentException.class);
        offlineAccess.getFirstNodeByPath("/", new Object());
    }
View Full Code Here

        offlineAccess.getFirstNodeByPath("/", new Object());
    }

    @Test
    public void testGetFirstNodeById() throws RepositoryAccessException {
        CMSObject expected = (CMSObject) repository.get(0);
        CMSObject real = offlineAccess.getFirstNodeById(expected.getUniqueRef(), null);

        assertSame(expected, real);

        expectedException.expect(RepositoryAccessException.class);
        real = offlineAccess.getFirstNodeById(UUID.randomUUID().toString(), null);
View Full Code Here

    }

    @Test
    public void testGetFirstNodeByName() throws RepositoryAccessException {
        CMSObject c11 = (CMSObject) repository.get(1);
        CMSObject c13 = (CMSObject) repository.get(3);

        CMSObject real = offlineAccess.getFirstNodeByName(c11.getLocalname(), null);
        assertTrue(c11 == real || c13 == real);

        expectedException.expect(IllegalArgumentException.class);
        offlineAccess.getNodeByName(UUID.randomUUID().toString(), new Object());
    }
View Full Code Here

        offlineAccess.getNodeByName(UUID.randomUUID().toString(), new Object());
    }

    @Test
    public void testGetObjectTypeDefinition() throws RepositoryAccessException {
        CMSObject root = (CMSObject) repository.get(0);
        ObjectTypeDefinition expected = (ObjectTypeDefinition) repository.get(5);
        ObjectTypeDefinition typeDef = offlineAccess.getObjectTypeDefinition(root.getObjectTypeRef(), null);
        assertSame(expected, typeDef);

        expectedException.expect(IllegalArgumentException.class);
        offlineAccess.getObjectTypeDefinition(UUID.randomUUID().toString(), new Object());
View Full Code Here

     *
     * @Test public void testGetAllowableTypeDef() {}
     */
    @Test
    public void testGetContainerObject() throws RepositoryAccessException {
        CMSObject root = (CMSObject) repository.get(0);
        Property p = root.getProperty().get(0);
        CMSObject real = offlineAccess.getContainerObject(p, null);
        assertSame(root, real);

        expectedException.expect(IllegalArgumentException.class);
        offlineAccess.getContainerObject(p, new Object());
    }
View Full Code Here

        offlineAccess.getContainerObject(p, new Object());
    }

    @Test
    public void testGetPropertyDefinition() throws RepositoryAccessException {
        CMSObject root = (CMSObject) repository.get(0);
        PropertyDefinition expected = (PropertyDefinition) repository.get(8);
        Property p = root.getProperty().get(0);
        PropertyDefinition propDef = offlineAccess.getPropertyDefinition(p, null);
        assertSame(expected, propDef);

    }
View Full Code Here

        offlineAccess.canRetrieve(null);
    }

    @Test
    public void testGetParentByNode() throws RepositoryAccessException {
        CMSObject child11 = (CMSObject) repository.get(1);
        CMSObject root = (CMSObject) repository.get(0);
        CMSObject parent = offlineAccess.getParentByNode(child11, null);
        assertSame(root, parent);

        expectedException.expect(IllegalArgumentException.class);
        offlineAccess.getParentByNode(child11, new Object());
    }
View Full Code Here

     *            JCR node to be transformed
     * @return transformed {@link CMSObject}
     * @throws RepositoryException
     */
    public static CMSObject getCMSObject(Node jcrNode) throws RepositoryException {
        CMSObject cmsObject = new CMSObject();
        cmsObject.setUniqueRef(jcrNode.getIdentifier());
        cmsObject.setLocalname(jcrNode.getName());
        cmsObject.setPath(jcrNode.getPath());
        cmsObject.setObjectTypeRef(jcrNode.getPrimaryNodeType().getName());
        try {
            // TODO For a quick fix parent ref is used for parent path
            cmsObject.setParentRef(jcrNode.getParent().getIdentifier());
        } catch (ItemNotFoundException e) {
            logger.info("Item has no parent. Can not set parent ref");
        } catch (AccessDeniedException e1) {
            logger.info("Item does not have permission to access parent. Can not set parent ref");
        }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.cmsadapter.servicesapi.model.web.CMSObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.