You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2005/03/23 14:31:47 UTC
svn commit: r158768 - in
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api:
ReferenceableRootNodesTest.java TestAll.java
Author: mreutegg
Date: Wed Mar 23 05:31:46 2005
New Revision: 158768
URL: http://svn.apache.org/viewcvs?view=rev&rev=158768
Log:
Test case for referenceable root node.
Added:
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java (with props)
Modified:
incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java
Added: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java?view=auto&rev=158768
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java (added)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java Wed Mar 23 05:31:46 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed 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;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+
+import javax.jcr.Session;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>ReferenceableRootNodesTest</code> contains tests with referenceable
+ * nodes between different workspaces.
+ *
+ * @test
+ * @sources ReferenceableRootNodesTest.java
+ * @executeClass org.apache.jackrabbit.test.api.ReferenceableRootNodesTest
+ * @keywords level1
+ */
+public class ReferenceableRootNodesTest extends AbstractJCRTest {
+
+ /**
+ * The read-only session for the second workspace
+ */
+ protected Session sessionW2;
+
+ /**
+ * The read-only session for the default workspace
+ */
+ protected Session session;
+
+ protected void setUp() throws Exception {
+ isReadOnly = true;
+ super.setUp();
+
+ session = helper.getReadOnlySession();
+ sessionW2 = helper.getReadOnlySession(workspaceName);
+ }
+
+ /**
+ * Releases the sessions aquired in {@link #setUp()}.
+ */
+ protected void tearDown() throws Exception {
+ if (sessionW2 != null) {
+ sessionW2.logout();
+ }
+ if (session != null) {
+ session.logout();
+ }
+ super.tearDown();
+ }
+
+ /**
+ * A repository implementation may make its workspace root nodes
+ * mix:referenceable. If so, then the root node of all workspaces must be
+ * referenceable, and all must have the same UUID.
+ */
+ public void testReferenceableRootNode()
+ throws RepositoryException, NotExecutableException {
+ // compare UUID of default workspace and a second workspace
+ Node rootNode = session.getRootNode();
+ if (rootNode.isNodeType(mixReferenceable)) {
+
+ // check if root node in second workspace is referenceable too
+ Node rootNodeW2 = sessionW2.getRootNode();
+ if (!rootNodeW2.isNodeType(mixReferenceable)) {
+ fail("Root node in second workspace is not referenceable.");
+ }
+
+ // check if all root nodes have the same UUID
+ assertEquals("Referenceable root nodes of different workspaces must have same UUID.",
+ rootNode.getUUID(),
+ rootNodeW2.getUUID());
+ } else {
+ throw new NotExecutableException("Root node is not referenceable");
+ }
+ }
+}
\ No newline at end of file
Propchange: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferenceableRootNodesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java?view=diff&r1=158767&r2=158768
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/TestAll.java Wed Mar 23 05:31:46 2005
@@ -62,6 +62,7 @@
suite.addTestSuite(RepositoryDescriptorTest.class);
suite.addTestSuite(SessionReadMethodsTest.class);
suite.addTestSuite(WorkspaceReadMethodsTest.class);
+ suite.addTestSuite(ReferenceableRootNodesTest.class);
suite.addTestSuite(ExportSysViewTest.class);