Package javax.jcr.version

Examples of javax.jcr.version.VersionManager.checkin()


        Value[] nPredecessorsValue = versionableNode.getProperty(jcrPredecessors).getValues();

        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        Version v = versionManager.checkin(path);
        Value[] vPredecessorsValue = v.getProperty(jcrPredecessors).getValues();

        assertEquals("The versionable checked-out node's jcr:predecessors property is copied to the new version on checkin.", Arrays.asList(nPredecessorsValue), Arrays.asList(vPredecessorsValue));
    }
View Full Code Here


     */
    public void testMultipleCheckinHasNoEffectJcr2() throws RepositoryException {

        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        Version v = versionManager.checkin(path);
        try {
            Version v2 = versionManager.checkin(path);

            assertTrue("Calling VersionManager.checkin(P) must not have an if the path P resolves to a node that is already checked-in.", v.isSame(v2));
        } catch (RepositoryException e) {
View Full Code Here

        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        Version v = versionManager.checkin(path);
        try {
            Version v2 = versionManager.checkin(path);

            assertTrue("Calling VersionManager.checkin(P) must not have an if the path P resolves to a node that is already checked-in.", v.isSame(v2));
        } catch (RepositoryException e) {
            fail("Calling VersionManager.checkin(P) must not throw an exception if the path P resolves to a node that is already checked-in.");
        }
View Full Code Here

     * @throws RepositoryException
     */
    public void testBaseVersionAfterCheckinJcr2() throws RepositoryException {
        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        Version v = versionManager.checkin(path);
        Value baseVersionRef = versionableNode.getProperty(jcrBaseVersion).getValue();

        assertEquals("Checked-in node's jcr:baseVersion property is set to refer to the version created on checkin.", superuser.getValueFactory().createValue(v), baseVersionRef);
    }

View Full Code Here

        try {
            // modify node without calling save()
            versionableNode.setProperty(propertyName1, propertyValue);
            VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
            String path = versionableNode.getPath();
            versionManager.checkin(path);

            fail("InvalidItemStateException must be thrown on attempt to checkin a node having any unsaved changes pending.");
        } catch (InvalidItemStateException e) {
            // ok
        }
View Full Code Here

     * @throws RepositoryException
     */
    public void testIsNotCheckedOutJcr2() throws RepositoryException {
        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        versionManager.checkin(path);
        boolean isCheckedOut = versionManager.isCheckedOut(path);

        assertFalse("VersionManager.isCheckedOut(P) must return false after VersionManager.checkin(P).", isCheckedOut);
    }

View Full Code Here

    public void testCheckinCreatesNewVersionJcr2() throws RepositoryException {

        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
        String path = versionableNode.getPath();
        long initialNumberOfVersions = getNumberOfVersions(versionManager.getVersionHistory(path));
        versionManager.checkin(path);
        long numberOfVersions = getNumberOfVersions(versionManager.getVersionHistory(path));

        assertTrue("Checkin must create a new Version in the VersionHistory.", numberOfVersions == initialNumberOfVersions + 1);
    }
View Full Code Here

     */
    public void testCheckinNonVersionableNodeJcr2() throws RepositoryException {
        try {
            VersionManager versionManager = nonVersionableNode.getSession().getWorkspace().getVersionManager();
            String path = nonVersionableNode.getPath();
            versionManager.checkin(path);
            fail("VersionManager.checkin(P) must throw UnsupportedRepositoryOperationException if the path P resolves to a non-versionable node.");
        } catch (UnsupportedRepositoryOperationException e) {
            //success
        }
    }
View Full Code Here

        subNvNode.setProperty(propertyName1, subNvNode.getName());
        String path2 = subNvNode.getPath();

        // save default workspace
        testRootNode.getSession().save();
        versionManager.checkin(path);
        versionManager.checkin(path2);

        log.println("test nodes created successfully on " + workspace.getName());

        // clone the newly created node from src workspace into second workspace
View Full Code Here

        String path2 = subNvNode.getPath();

        // save default workspace
        testRootNode.getSession().save();
        versionManager.checkin(path);
        versionManager.checkin(path2);

        log.println("test nodes created successfully on " + workspace.getName());

        // clone the newly created node from src workspace into second workspace
        // todo clone on testRootNode does not seem to work.
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.