blob: 43b171cac0f91f169adf73c8fd729c830c436ede [file] [log] [blame]
/*
* 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.oak.plugins.version;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collection;
import org.apache.jackrabbit.oak.api.PropertyState;
import org.apache.jackrabbit.oak.api.Tree;
import org.apache.jackrabbit.oak.spi.version.VersionConstants;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class ReadOnlyVersionManagerNtTest extends ReadOnlyVersionManagerTest {
@Parameterized.Parameters
public static Collection<String> oakReferenceableFrozenNode() {
return Arrays.asList("false", "true", null);
}
private final String oakReferenceableFrozenNode;
public ReadOnlyVersionManagerNtTest(String oakReferenceableFrozenNode) {
this.oakReferenceableFrozenNode = oakReferenceableFrozenNode;
if (oakReferenceableFrozenNode != null) {
System.setProperty("oak.referenceableFrozenNode", oakReferenceableFrozenNode);
} else {
System.clearProperty("oak.referenceableFrozenNode");
}
}
@Test
public void testNtFrozenNodeUuid() throws Exception {
Tree baseVersion = checkNotNull(versionManager.getBaseVersion(versionable));
Tree frozen = baseVersion.getChild(VersionConstants.JCR_FROZENNODE);
PropertyState uuid = frozen.getProperty("jcr:uuid");
if ("false".equals(oakReferenceableFrozenNode)) {
assertNull(uuid);
} else if (oakReferenceableFrozenNode == null ||
"true".equals(oakReferenceableFrozenNode)) {
assertNotNull(uuid);
} else {
fail("not supported");
}
}
}