Package javax.jcr.version

Examples of javax.jcr.version.Version


     * @throws RepositoryException
     * @see VersionHistory#getVersionByLabel(String)
     */
    public void testGetVersionByLabel() throws RepositoryException {
        vHistory.addVersionLabel(rootVersion.getName(), versionLabel, true);
        Version v = vHistory.getVersionByLabel(versionLabel);

        assertEquals("VersionHistory.getVersionByLabel(String) must retrieve the particular version that was specified in addVersionLabel call.", v, rootVersion);
    }
View Full Code Here


     */
    public void testGetVersionLabels() throws RepositoryException {

        HashSet testLabels = new HashSet(Arrays.asList(vHistory.getVersionLabels()));
        versionableNode.checkout();
        Version v = versionableNode.checkin();

        vHistory.addVersionLabel(v.getName(), versionLabel, false);
        testLabels.add(versionLabel);
        vHistory.addVersionLabel(rootVersion.getName(), versionLabel2, false);
        testLabels.add(versionLabel2);

        String[] labels = vHistory.getVersionLabels();
View Full Code Here

        vHistory.addVersionLabel(rootVersion.getName(), versionLabel, false);
        testLabels.add(versionLabel);

        // add a version label to another version (not added to the testLabel set)
        versionableNode.checkout();
        Version v = versionableNode.checkin();
        vHistory.addVersionLabel(v.getName(), versionLabel2, false);

        String[] labels = vHistory.getVersionLabels(rootVersion);
        for (int i = 0; i < labels.length; i++) {
            String l = labels[i];
            if (!testLabels.contains(l)) {
View Full Code Here

     * specified version is not in this version history.
     */
    public void testGetVersionLabelsForInvalidVersion() throws Exception {
        // build a second versionable node below the testroot to get it's version.
        Node versionableNode2 = createVersionableNode(testRootNode, nodeName2, versionableNodeType);
        Version invalidV = versionableNode2.checkin();

        try {
            vHistory.getVersionLabels(invalidV);
            fail("VersionHistory.getVersionLabels(Version) must throw a VersionException if the specified version is not in this version history");
        } catch (VersionException ve) {
View Full Code Here

     */
    public void testPredecessorIsCopiedToNewVersion() throws RepositoryException {

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

        Version v = versionableNode.checkin();
        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

     *
     * @throws RepositoryException
     */
    public void testMultipleCheckinHasNoEffect() throws RepositoryException {

        Version v = versionableNode.checkin();
        try {
            Version v2 = versionableNode.checkin();

            assertTrue("Calling checkin() on a node that is already checked-in must not have an effect.", v.equals(v2));
        } catch (RepositoryException e) {
            fail("Calling checkin() on a node that is already checked-in must not throw an exception.");
        }
View Full Code Here

     * the new version after checkin.
     *
     * @throws RepositoryException
     */
    public void testBaseVersionAfterCheckin() throws RepositoryException {
        Version v = versionableNode.checkin();
        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

     *
     * @throws javax.jcr.RepositoryException
     */
    public void testInitialBaseVersionPointsToRootVersion() throws RepositoryException {

        Version rV = versionableNode.getVersionHistory().getRootVersion();
        Version bV = versionableNode.getBaseVersion();

        assertEquals("After creation of a versionable node the node's baseVersion must point to the rootVersion in the version history.", rV, bV);
    }
View Full Code Here

     */
    public void testInitialNodePredecessors() throws RepositoryException {

        Property predecessors = versionableNode.getProperty(jcrPredecessors);
        Value[] values = predecessors.getValues();
        Version rV = versionableNode.getVersionHistory().getRootVersion();
        if (values.length != 1) {
            fail("The jcr:predecessors property of a versionable node must be initialized to contain a single value");
        }

        Value initialVal = values[0];
View Full Code Here

    protected VersionHistory vHistory;

    protected void setUp() throws Exception {
        super.setUp();

        Version testV = versionableNode.checkin(); // create 1.0
        versionableNode.checkout();
        versionableNode.checkin(); // create 1.1
        versionableNode.checkout();
        versionableNode.checkin(); // create 1.2
        try {
            versionableNode.getVersionHistory().removeVersion(testV.getName());
        } catch (UnsupportedRepositoryOperationException e) {
            throw new NotExecutableException("Removing version is not supported: " + e.getMessage());
        }

        versionableNode.checkout();
View Full Code Here

TOP

Related Classes of javax.jcr.version.Version

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.