Package javax.jcr

Examples of javax.jcr.Node.addMixin()


    @Test // OAK-1244
    public void importUUIDCreateNew() throws Exception {
        Session session = getAdminSession();
        Node node = session.getRootNode().addNode("node");
        node.addMixin("mix:referenceable");
        session.save();
        String uuid = node.getIdentifier();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        session.exportSystemView("/node", out, true, false);
        node.remove();
View Full Code Here


        }
    }

    public void testUnsupportedProtectedNode() throws Exception {
        Node n = testRootNode.addNode(nodeName1);
        n.addMixin(mixVersionable);

        ProtectedNodeImporter piImporter = createImporter();
        piImporter.init(sImpl, sImpl, false, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, null);
        assertFalse(piImporter.start((NodeImpl) n));
    }
View Full Code Here

    @Test
    public void testCopyReferenceableNode() throws Exception {
        Session session = getAdminSession();

        Node toCopy = session.getNode(TEST_PATH + "/source/node");
        toCopy.addMixin(JcrConstants.MIX_REFERENCEABLE);
        session.save();

        session.getWorkspace().copy(TEST_PATH + "/source/node", TEST_PATH + "/target/copied");

        assertTrue(testNode.hasNode("source/node"));
View Full Code Here

    @Ignore("OAK-918") // FIXME
    @Test
    public void testCopyVersionableNode() throws Exception {
        Session session = getAdminSession();
        Node toCopy = session.getNode(TEST_PATH + "/source/node");
        toCopy.addMixin(JcrConstants.MIX_VERSIONABLE);
        session.save();

        Version baseV = toCopy.getBaseVersion();

        session.getWorkspace().copy(TEST_PATH + "/source/node", TEST_PATH + "/target/copied");
View Full Code Here

    @Ignore("OAK-919") // FIXME
    @Test
    public void testCopyLockedNode() throws Exception {
        Session session = getAdminSession();
        Node toCopy = session.getNode(TEST_PATH + "/source/node");
        toCopy.addMixin(JcrConstants.MIX_LOCKABLE);
        session.save();

        session.getWorkspace().getLockManager().lock(toCopy.getPath(), true, true, Long.MAX_VALUE, "my");
        session.getWorkspace().copy(TEST_PATH + "/source/node", TEST_PATH + "/target/copied");
View Full Code Here

        return true;
    }

    private Node createImportTarget() throws RepositoryException {
        Node target = testRootNode.addNode(nodeName1);
        target.addMixin("rep:AccessControllable");
        if (!isSessionImport()) {
            superuser.save();
        }
        return target;
    }
View Full Code Here

    }

    @Test
    public void getNodeByUUID() throws RepositoryException {
        Node node = getNode("/foo").addNode("boo");
        node.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertTrue(node.isNodeType(JcrConstants.MIX_REFERENCEABLE));
        String uuid = node.getUUID();
        assertNotNull(uuid);
        assertEquals(uuid, node.getIdentifier());
View Full Code Here

        Node nAgain = node.getSession().getNodeByUUID(uuid);
        assertTrue(nAgain.isSame(node));
        assertTrue(nAgain.isSame(node.getSession().getNodeByIdentifier(uuid)));

        Node childNode = node.addNode("boohoo");
        childNode.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertTrue(childNode.isNodeType(JcrConstants.MIX_REFERENCEABLE));
        String childUuid = childNode.getUUID();
        assertNotNull(childUuid);
        assertEquals(childUuid, childNode.getIdentifier());
View Full Code Here

        modify(path, REP_WRITE, true);
        modify(path, Privilege.JCR_VERSION_MANAGEMENT, true);

        Node testNode = testSession.getNode(path);
        Node newNode = testNode.addNode("versionable");
        newNode.addMixin("mix:versionable");
        testSession.save();
    }

    /**
     * @since oak
View Full Code Here

    @Test
    public void testVersionableChildNode() throws Exception {
        Node testNode = superuser.getNode(path).addNode("n1").addNode("n2").addNode("n3").addNode("jcr:content");
        superuser.save();

        testNode.addMixin("mix:versionable");
        superuser.save();

        assertTrue(testNode.isNodeType("mix:versionable"));
        VersionHistory vh = testNode.getVersionHistory();
        Property versionablePath = vh.getProperty(superuser.getWorkspace().getName());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.