/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.jackrabbit.test.api.version;

import javax.jcr.RepositoryException;
import javax.jcr.version.Version;

/**
 * <code>GetPredecessorsTest</code>  provides test methods covering {@link
 * javax.jcr.version.Version#getPredecessors()}.
 *
 * @test
 * @sources GetPredecessorsTest.java
 * @executeClass org.apache.jackrabbit.test.api.version.GetPredecessorsTest
 * @keywords versioning
 */
public class GetPredecessorsTest extends AbstractVersionTest {

    /**
     * Returns the predecessor versions of this version. This corresponds to
     * returning all the nt:version nodes whose jcr:successors property includes
     * a reference to the nt:version node that represents this version. A
     * RepositoryException is thrown if an error occurs.
     */
    public void testGetPredecessors() throws RepositoryException {
        // create a new version
        versionableNode.checkout();
        Version version = versionableNode.checkin();

        assertTrue("Version should have at minimum one predecessor version.", version.getPredecessors().length > 0);
    }
}
@@ -916,16 +916,57 @@
 Version;
+%0Aimport javax.jcr.version.VersionManager;
 %0A%0A/**%0A *
@@ -1041,34 +1041,51 @@
 link%0A * 
-javax.jcr.version.
+Version#getPredecessors()%7D, %7B@link 
 Version#
@@ -1079,32 +1079,38 @@
 link Version#get
+Linear
 Predecessors()%7D.
@@ -1104,17 +1104,60 @@
 decessor
-s
+()%7D and%0A * %7B@link Version#getLinearSuccessor
 ()%7D.%0A *%0A
@@ -1985,11 +1985,1200 @@
 0);%0A
-
     %7D%0A
+    %0A    /**%0A     * Checks ontaining the linear predecessor.%0A     * @since JCR 2.0%0A     */%0A    public void testGetLinearPredecessorSuccessor() throws RepositoryException %7B%0A%0A        String path = versionableNode.getPath();%0A        %0A        VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager();%0A        %0A        // get the previous version%0A        Version pred = vm.getBaseVersion(path);%0A%0A        // shouldn't have a successor yet%0A        assertNull(pred.getLinearSuccessor());%0A        %0A        // check root version%0A        Version root = vm.getVersionHistory(path).getRootVersion();%0A        assertNull(root.getLinearSuccessor());%0A        %0A        // create a new version%0A        vm.checkout(path);%0A        Version version = vm.checkin(path);%0A        %0A        // refresh the predecessor%0A        pred = (Version)versionableNode.getSession().getNode(pred.getPath());%0A%0A        assertTrue(%22linear predecessor of new version should be previous version%22,%0A                version.getLinearPredecessor().isSame(pred));%0A        assertTrue(%22linear successor of previous version should be new version%22,%0A                pred.getLinearSuccessor().isSame(version));%0A    %7D%0A%0A
 %7D

add TCK tests for Version.getLinear{Predecessors|Successors}