From 0164074c1310afa8dfefd68ee410f4b34312a232 Mon Sep 17 00:00:00 2001 From: Joel Richard Date: Thu, 30 Jul 2015 12:19:01 +0200 Subject: [PATCH] OAK-3166 - Apply adjustments for newly exported JackrabbitSession#getItemOrNull * Move documentation to JackrabbitSession interface * Reuse GetOrNullTest from jackrabbit-core --- .../jackrabbit/oak/jcr/session/SessionImpl.java | 28 ++--------------- .../jcr/session/JackrabbitSessionTestSuite.java | 35 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/session/JackrabbitSessionTestSuite.java diff --git a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java index 467f89e..21d3af8 100644 --- a/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java +++ b/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java @@ -165,14 +165,7 @@ public class SessionImpl implements JackrabbitSession { } } - /** - * Returns the node at the specified absolute path in the workspace or - * {@code null} if no such node exists. - * - * @param absPath An absolute path. - * @return the specified {@code Node} or {@code null}. - * @throws RepositoryException If another error occurs. - */ + @Override @CheckForNull public Node getNodeOrNull(final String absPath) throws RepositoryException { checkNotNull(absPath); @@ -188,14 +181,7 @@ public class SessionImpl implements JackrabbitSession { }); } - /** - * Returns the property at the specified absolute path in the workspace or - * {@code null} if no such node exists. - * - * @param absPath An absolute path. - * @return the specified {@code Property} or {@code null}. - * @throws RepositoryException if another error occurs. - */ + @Override @CheckForNull public Property getPropertyOrNull(final String absPath) throws RepositoryException { if (checkNotNull(absPath).equals("/")) { @@ -221,15 +207,7 @@ public class SessionImpl implements JackrabbitSession { } } - /** - * Returns the node at the specified absolute path in the workspace. If no - * such node exists, then it returns the property at the specified path. - * If no such property exists, then it return {@code null}. - * - * @param absPath An absolute path. - * @return the specified {@code Item} or {@code null}. - * @throws RepositoryException if another error occurs. - */ + @Override @CheckForNull public Item getItemOrNull(final String absPath) throws RepositoryException { checkNotNull(absPath); diff --git a/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/session/JackrabbitSessionTestSuite.java b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/session/JackrabbitSessionTestSuite.java new file mode 100644 index 0000000..69f7166 --- /dev/null +++ b/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/session/JackrabbitSessionTestSuite.java @@ -0,0 +1,35 @@ +/* + * 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.jcr.session; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import org.apache.jackrabbit.core.integration.GetOrNullTest; + +/** + * Reuse JackrabbitSession tests + */ +public class JackrabbitSessionTestSuite extends TestCase { + + public static Test suite() { + TestSuite testSuite = new TestSuite(); + testSuite.addTestSuite(GetOrNullTest.class); + return testSuite; + } + +} -- 2.3.6