[dna-commits] DNA SVN: r757 - in trunk/dna-jcr/src/test: resources and 1 other directory.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Mar 5 09:55:09 EST 2009


Author: rhauch
Date: 2009-03-05 09:55:09 -0500 (Thu, 05 Mar 2009)
New Revision: 757

Added:
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelOneTestSuite.java
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelTwoTestSuite.java
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckOptionalTestSuite.java
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
Removed:
   trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java
Modified:
   trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
Log:
DNA-194 Implement update JCR capability

Refactored the TCK unit tests to make it easy to add Level 2 and Optional unit tests from the Jackrabbit TCK unit tests.

Deleted: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java	2009-03-04 22:18:45 UTC (rev 756)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java	2009-03-05 14:55:09 UTC (rev 757)
@@ -1,229 +0,0 @@
-/*
- * JBoss DNA (http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership.  Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of 
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.dna.jcr;
-
-import java.io.File;
-import java.net.URI;
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.util.Collections;
-import java.util.Properties;
-import javax.jcr.Credentials;
-import javax.jcr.Repository;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.jackrabbit.test.JCRTestSuite;
-import org.apache.jackrabbit.test.RepositoryStub;
-import org.jboss.dna.graph.DnaLexicon;
-import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.Graph;
-import org.jboss.dna.graph.GraphImporter;
-import org.jboss.dna.graph.JcrNtLexicon;
-import org.jboss.dna.graph.Location;
-import org.jboss.dna.graph.connector.RepositoryConnection;
-import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
-import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
-import org.jboss.dna.graph.property.Path;
-
-/**
- * Test suite to wrap Apache Jackrabbit JCR technology compatibility kit (TCK) tests.
- */
-public class JackrabbitJcrTckTest {
-
-    /**
-     * Wrapper so that the Jackrabbit TCK test suite gets picked up by the DNA Maven test target.
-     * 
-     * @return a new instance of {@link JCRTestSuite}.
-     */
-    public static Test suite() {
-        // Uncomment this to execute all tests
-        // return new JCRTestSuite();
-
-        // Uncomment this to execute level one tests only
-        return new JcrLevelOneTestSuite();
-    }
-
-    /** Test suite that includes all of the Jackrabbit TCK API tests <b>except</b> the level two tests. */
-    private static class JcrLevelOneTestSuite extends TestSuite {
-        public JcrLevelOneTestSuite() {
-            super("JCR 1.0 Level 1 API tests");
-
-            // We currently don't pass the tests in those suites that are commented out
-            // See https://jira.jboss.org/jira/browse/DNA-285
-
-            addTestSuite(org.apache.jackrabbit.test.api.RootNodeTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NodeReadMethodsTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.PropertyTypeTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NodeDiscoveringNodeTypesTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.BinaryPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.BooleanPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.DatePropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.DoublePropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.LongPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NamePropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.PathPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.ReferencePropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.StringPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.UndefinedPropertyTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NamespaceRegistryReadMethodsTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NamespaceRemappingTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.NodeIteratorTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.PropertyReadMethodsTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.RepositoryDescriptorTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.SessionReadMethodsTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.WorkspaceReadMethodsTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.ReferenceableRootNodesTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.ExportSysViewTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.ExportDocViewTest.class);
-            addTestSuite(org.apache.jackrabbit.test.api.RepositoryLoginTest.class);
-
-            // These might not all be level one tests
-            // addTestSuite(org.apache.jackrabbit.test.api.query.XPathPosIndexTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.XPathDocOrderTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.XPathOrderByTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.XPathJcrPathTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.GetLanguageTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.GetPersistentQueryPathLevel1Test.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.GetStatementTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.GetSupportedQueryLanguagesTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.GetPropertyNamesTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.PredicatesTest.class);
-            // addTestSuite(org.apache.jackrabbit.test.api.query.SimpleSelectionTest.class);
-
-            // The tests in this suite are level one
-            // addTest(org.apache.jackrabbit.test.api.nodetype.TestAll.suite());
-        }
-
-    }
-
-    /**
-     * Concrete implementation of {@link RepositoryStub} based on DNA-specific configuration.
-     */
-    public static class InMemoryRepositoryStub extends RepositoryStub {
-        private Repository repository;
-        protected RepositoryConnection connection;
-        protected AccessControlContext accessControlContext = AccessController.getContext();
-
-        private Credentials credentials = new Credentials() {
-            private static final long serialVersionUID = 1L;
-
-            @SuppressWarnings( "unused" )
-            public AccessControlContext getAccessControlContext() {
-                return accessControlContext;
-            }
-        };
-
-        protected ExecutionContext executionContext = new ExecutionContext() {
-
-            @Override
-            public ExecutionContext create( AccessControlContext accessControlContext ) {
-                return executionContext;
-            }
-        };
-
-        protected RepositoryConnectionFactory connectionFactory = new RepositoryConnectionFactory() {
-            public RepositoryConnection createConnection( String sourceName ) {
-                return connection;
-            }
-        };
-
-        public InMemoryRepositoryStub( Properties env ) {
-            super(env);
-
-            // Create the in-memory (DNA) repository
-            InMemoryRepositorySource source = new InMemoryRepositorySource();
-
-            // Various calls will fail if you do not set a non-null name for the source
-            source.setName("TestRepositorySource");
-
-            // Wrap a connection to the in-memory (DNA) repository in a (JCR) repository
-            connection = source.getConnection();
-            repository = new JcrRepository(Collections.<String, String>emptyMap(), executionContext.create(accessControlContext),
-                                           connectionFactory, source.getName());
-
-            // Make sure the path to the namespaces exists ...
-            Graph graph = Graph.create(source.getName(), connectionFactory, executionContext);
-            graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces");
-
-            // Set up some sample nodes in the graph to match the expected test configuration
-            try {
-
-                // TODO: Should there be an easier way to define these since they will be needed for all JCR repositories?
-                executionContext.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX, DnaLexicon.Namespace.URI);
-                executionContext.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX, JcrLexicon.Namespace.URI);
-                executionContext.getNamespaceRegistry().register(JcrNtLexicon.Namespace.PREFIX, JcrNtLexicon.Namespace.URI);
-                executionContext.getNamespaceRegistry().register("sv", "http://www.jcp.org/jcr/sv/1.0");
-
-                Path destinationPath = executionContext.getValueFactories().getPathFactory().create("/");
-                GraphImporter importer = new GraphImporter(graph);
-
-                URI xmlContent = new File("src/test/resources/repositoryJackrabbitTck.xml").toURI();
-                Graph.Batch batch = importer.importXml(xmlContent, Location.create(destinationPath));
-                batch.execute();
-
-            } catch (Exception ex) {
-                // The TCK tries to quash this exception. Print it out to be more obvious.
-                ex.printStackTrace();
-                throw new IllegalStateException("Repository initialization failed.", ex);
-            }
-        }
-
-        /**
-         * {@inheritDoc}
-         * 
-         * @see org.apache.jackrabbit.test.RepositoryStub#getSuperuserCredentials()
-         */
-        @Override
-        public Credentials getSuperuserCredentials() {
-            // TODO: Why must we override this method? The default TCK implementation just returns a particular instance of
-            // SimpleCredentials.
-            return credentials;
-        }
-
-        /**
-         * {@inheritDoc}
-         * 
-         * @see org.apache.jackrabbit.test.RepositoryStub#getReadOnlyCredentials()
-         */
-        @Override
-        public Credentials getReadOnlyCredentials() {
-            // TODO: Why must we override this method? The default TCK implementation just returns a particular instance of
-            // SimpleCredentials.
-            return credentials;
-        }
-
-        /**
-         * {@inheritDoc}
-         * 
-         * @see org.apache.jackrabbit.test.RepositoryStub#getRepository()
-         */
-        @Override
-        public Repository getRepository() {
-            return repository;
-        }
-
-    }
-
-}

Added: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelOneTestSuite.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelOneTestSuite.java	                        (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelOneTestSuite.java	2009-03-05 14:55:09 UTC (rev 757)
@@ -0,0 +1,95 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * Unless otherwise indicated, all code in JBoss DNA is licensed
+ * to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes the Level 1 JCR TCK API tests from the Jackrabbit project.
+ * 
+ * @see JcrTckLevelTwoTestSuite
+ * @see JcrTckOptionalTestSuite
+ * @see JcrTckTest
+ */
+public class JcrTckLevelOneTestSuite extends TestCase {
+
+    /**
+     * Returns a <code>Test</code> suite that executes all tests inside this package.
+     * 
+     * @return a <code>Test</code> suite that executes all tests inside this package.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("JCR 1.0 Level 1 API tests");
+
+        // We currently don't pass the tests in those suites that are commented out
+        // See https://jira.jboss.org/jira/browse/DNA-285
+
+        suite.addTestSuite(org.apache.jackrabbit.test.api.RootNodeTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NodeReadMethodsTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.PropertyTypeTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NodeDiscoveringNodeTypesTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.BinaryPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.BooleanPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.DatePropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.DoublePropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.LongPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NamePropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.PathPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.ReferencePropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.StringPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.UndefinedPropertyTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NamespaceRegistryReadMethodsTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NamespaceRemappingTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.NodeIteratorTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.PropertyReadMethodsTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.RepositoryDescriptorTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.SessionReadMethodsTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.WorkspaceReadMethodsTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.ReferenceableRootNodesTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.ExportSysViewTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.ExportDocViewTest.class);
+        suite.addTestSuite(org.apache.jackrabbit.test.api.RepositoryLoginTest.class);
+
+        // These might not all be level one tests
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.XPathPosIndexTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.XPathDocOrderTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.XPathOrderByTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.XPathJcrPathTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.GetLanguageTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.GetPersistentQueryPathLevel1Test.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.GetStatementTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.GetSupportedQueryLanguagesTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.GetPropertyNamesTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.PredicatesTest.class);
+        // suite.addTestSuite(org.apache.jackrabbit.test.api.query.SimpleSelectionTest.class);
+
+        // The tests in this suite are level one
+        // suite.addTest(org.apache.jackrabbit.test.api.nodetype.TestAll.suite());
+
+        return suite;
+    }
+}


Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelOneTestSuite.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelTwoTestSuite.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelTwoTestSuite.java	                        (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelTwoTestSuite.java	2009-03-05 14:55:09 UTC (rev 757)
@@ -0,0 +1,178 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * Unless otherwise indicated, all code in JBoss DNA is licensed
+ * to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.jackrabbit.test.api.AddNodeTest;
+import org.apache.jackrabbit.test.api.CheckPermissionTest;
+import org.apache.jackrabbit.test.api.DocumentViewImportTest;
+import org.apache.jackrabbit.test.api.ImpersonateTest;
+import org.apache.jackrabbit.test.api.NamespaceRegistryTest;
+import org.apache.jackrabbit.test.api.NodeAddMixinTest;
+import org.apache.jackrabbit.test.api.NodeCanAddMixinTest;
+import org.apache.jackrabbit.test.api.NodeItemIsModifiedTest;
+import org.apache.jackrabbit.test.api.NodeItemIsNewTest;
+import org.apache.jackrabbit.test.api.NodeOrderableChildNodesTest;
+import org.apache.jackrabbit.test.api.NodeRemoveMixinTest;
+import org.apache.jackrabbit.test.api.NodeTest;
+import org.apache.jackrabbit.test.api.NodeUUIDTest;
+import org.apache.jackrabbit.test.api.PropertyItemIsModifiedTest;
+import org.apache.jackrabbit.test.api.PropertyItemIsNewTest;
+import org.apache.jackrabbit.test.api.PropertyTest;
+import org.apache.jackrabbit.test.api.ReferencesTest;
+import org.apache.jackrabbit.test.api.RepositoryLoginTest;
+import org.apache.jackrabbit.test.api.SerializationTest;
+import org.apache.jackrabbit.test.api.SessionTest;
+import org.apache.jackrabbit.test.api.SessionUUIDTest;
+import org.apache.jackrabbit.test.api.SetPropertyAssumeTypeTest;
+import org.apache.jackrabbit.test.api.SetPropertyBooleanTest;
+import org.apache.jackrabbit.test.api.SetPropertyCalendarTest;
+import org.apache.jackrabbit.test.api.SetPropertyConstraintViolationExceptionTest;
+import org.apache.jackrabbit.test.api.SetPropertyDoubleTest;
+import org.apache.jackrabbit.test.api.SetPropertyInputStreamTest;
+import org.apache.jackrabbit.test.api.SetPropertyLongTest;
+import org.apache.jackrabbit.test.api.SetPropertyNodeTest;
+import org.apache.jackrabbit.test.api.SetPropertyStringTest;
+import org.apache.jackrabbit.test.api.SetPropertyValueTest;
+import org.apache.jackrabbit.test.api.SetValueBinaryTest;
+import org.apache.jackrabbit.test.api.SetValueBooleanTest;
+import org.apache.jackrabbit.test.api.SetValueConstraintViolationExceptionTest;
+import org.apache.jackrabbit.test.api.SetValueDateTest;
+import org.apache.jackrabbit.test.api.SetValueDoubleTest;
+import org.apache.jackrabbit.test.api.SetValueLongTest;
+import org.apache.jackrabbit.test.api.SetValueReferenceTest;
+import org.apache.jackrabbit.test.api.SetValueStringTest;
+import org.apache.jackrabbit.test.api.SetValueValueFormatExceptionTest;
+import org.apache.jackrabbit.test.api.SetValueVersionExceptionTest;
+import org.apache.jackrabbit.test.api.ValueFactoryTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneTest;
+import org.apache.jackrabbit.test.api.WorkspaceCloneVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyBetweenWorkspacesVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopySameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyTest;
+import org.apache.jackrabbit.test.api.WorkspaceCopyVersionableTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveReferenceableTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveSameNameSibsTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveTest;
+import org.apache.jackrabbit.test.api.WorkspaceMoveVersionableTest;
+
+/**
+ * Test suite that includes the Level 2 JCR TCK API tests from the Jackrabbit project.
+ * 
+ * @see JcrTckLevelOneTestSuite
+ * @see JcrTckOptionalTestSuite
+ * @see JcrTckTest
+ */
+public class JcrTckLevelTwoTestSuite extends TestCase {
+
+    /**
+     * Returns a <code>Test</code> suite that executes all tests inside this package.
+     * 
+     * @return a <code>Test</code> suite that executes all tests inside this package.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("JCR 1.0 Level 2 API tests");
+
+        // We currently don't pass the tests in those suites that are commented out
+        // See https://jira.jboss.org/jira/browse/DNA-285
+
+        // level 2 tests
+        suite.addTestSuite(AddNodeTest.class);
+        suite.addTestSuite(NamespaceRegistryTest.class);
+        suite.addTestSuite(ReferencesTest.class);
+        suite.addTestSuite(SessionTest.class);
+        suite.addTestSuite(SessionUUIDTest.class);
+        suite.addTestSuite(NodeTest.class);
+        suite.addTestSuite(NodeUUIDTest.class);
+        suite.addTestSuite(NodeOrderableChildNodesTest.class);
+        suite.addTestSuite(PropertyTest.class);
+
+        suite.addTestSuite(SetValueBinaryTest.class);
+        suite.addTestSuite(SetValueBooleanTest.class);
+        suite.addTestSuite(SetValueDateTest.class);
+        suite.addTestSuite(SetValueDoubleTest.class);
+        suite.addTestSuite(SetValueLongTest.class);
+        suite.addTestSuite(SetValueReferenceTest.class);
+        suite.addTestSuite(SetValueStringTest.class);
+        suite.addTestSuite(SetValueConstraintViolationExceptionTest.class);
+        suite.addTestSuite(SetValueValueFormatExceptionTest.class);
+        suite.addTestSuite(SetValueVersionExceptionTest.class);
+
+        suite.addTestSuite(SetPropertyBooleanTest.class);
+        suite.addTestSuite(SetPropertyCalendarTest.class);
+        suite.addTestSuite(SetPropertyDoubleTest.class);
+        suite.addTestSuite(SetPropertyInputStreamTest.class);
+        suite.addTestSuite(SetPropertyLongTest.class);
+        suite.addTestSuite(SetPropertyNodeTest.class);
+        suite.addTestSuite(SetPropertyStringTest.class);
+        suite.addTestSuite(SetPropertyValueTest.class);
+        suite.addTestSuite(SetPropertyConstraintViolationExceptionTest.class);
+        suite.addTestSuite(SetPropertyAssumeTypeTest.class);
+
+        suite.addTestSuite(NodeItemIsModifiedTest.class);
+        suite.addTestSuite(NodeItemIsNewTest.class);
+        suite.addTestSuite(PropertyItemIsModifiedTest.class);
+        suite.addTestSuite(PropertyItemIsNewTest.class);
+
+        suite.addTestSuite(NodeAddMixinTest.class);
+        suite.addTestSuite(NodeCanAddMixinTest.class);
+        suite.addTestSuite(NodeRemoveMixinTest.class);
+
+        suite.addTestSuite(WorkspaceCloneReferenceableTest.class);
+        suite.addTestSuite(WorkspaceCloneSameNameSibsTest.class);
+        suite.addTestSuite(WorkspaceCloneTest.class);
+        suite.addTestSuite(WorkspaceCloneVersionableTest.class);
+        suite.addTestSuite(WorkspaceCopyBetweenWorkspacesReferenceableTest.class);
+        suite.addTestSuite(WorkspaceCopyBetweenWorkspacesSameNameSibsTest.class);
+        suite.addTestSuite(WorkspaceCopyBetweenWorkspacesTest.class);
+        suite.addTestSuite(WorkspaceCopyBetweenWorkspacesVersionableTest.class);
+        suite.addTestSuite(WorkspaceCopyReferenceableTest.class);
+        suite.addTestSuite(WorkspaceCopySameNameSibsTest.class);
+        suite.addTestSuite(WorkspaceCopyTest.class);
+        suite.addTestSuite(WorkspaceCopyVersionableTest.class);
+        suite.addTestSuite(WorkspaceMoveReferenceableTest.class);
+        suite.addTestSuite(WorkspaceMoveSameNameSibsTest.class);
+        suite.addTestSuite(WorkspaceMoveTest.class);
+        suite.addTestSuite(WorkspaceMoveVersionableTest.class);
+
+        suite.addTestSuite(RepositoryLoginTest.class);
+        suite.addTestSuite(ImpersonateTest.class);
+        suite.addTestSuite(CheckPermissionTest.class);
+
+        suite.addTestSuite(DocumentViewImportTest.class);
+        suite.addTestSuite(SerializationTest.class);
+
+        suite.addTestSuite(ValueFactoryTest.class);
+
+        return suite;
+    }
+}


Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckLevelTwoTestSuite.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckOptionalTestSuite.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckOptionalTestSuite.java	                        (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckOptionalTestSuite.java	2009-03-05 14:55:09 UTC (rev 757)
@@ -0,0 +1,57 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * Unless otherwise indicated, all code in JBoss DNA is licensed
+ * to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite that includes the Optional JCR TCK API tests from the Jackrabbit project.
+ * 
+ * @see JcrTckLevelOneTestSuite
+ * @see JcrTckLevelTwoTestSuite
+ * @see JcrTckTest
+ */
+public class JcrTckOptionalTestSuite extends TestCase {
+
+    /**
+     * Returns a <code>Test</code> suite that executes all tests inside this package.
+     * 
+     * @return a <code>Test</code> suite that executes all tests inside this package.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("JCR 1.0 Optional API tests");
+
+        // We currently don't pass the tests in those suites that are commented out
+        // See https://jira.jboss.org/jira/browse/DNA-285
+
+        suite.addTest(org.apache.jackrabbit.test.api.observation.TestAll.suite());
+        suite.addTest(org.apache.jackrabbit.test.api.version.TestAll.suite());
+        suite.addTest(org.apache.jackrabbit.test.api.lock.TestAll.suite());
+        suite.addTest(org.apache.jackrabbit.test.api.util.TestAll.suite());
+
+        return suite;
+    }
+}


Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckOptionalTestSuite.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java (from rev 756, trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java)
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java	                        (rev 0)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java	2009-03-05 14:55:09 UTC (rev 757)
@@ -0,0 +1,184 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership.  Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of 
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import java.io.File;
+import java.net.URI;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.util.Collections;
+import java.util.Properties;
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.jackrabbit.test.JCRTestSuite;
+import org.apache.jackrabbit.test.RepositoryStub;
+import org.jboss.dna.graph.DnaLexicon;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.GraphImporter;
+import org.jboss.dna.graph.JcrNtLexicon;
+import org.jboss.dna.graph.Location;
+import org.jboss.dna.graph.connector.RepositoryConnection;
+import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.property.Path;
+
+/**
+ * Test suite to wrap Apache Jackrabbit JCR technology compatibility kit (TCK) unit tests.
+ * 
+ * @see JcrTckLevelOneTestSuite
+ * @see JcrTckLevelTwoTestSuite
+ * @see JcrTckOptionalTestSuite
+ */
+public class JcrTckTest {
+
+    /**
+     * Wrapper so that the Jackrabbit TCK test suite gets picked up by the DNA Maven test target.
+     * 
+     * @return a new instance of {@link JCRTestSuite}.
+     */
+    public static Test suite() {
+        // Uncomment this to execute all tests
+        // return new JCRTestSuite();
+
+        // Or uncomment the following lines to execute the different sets/suites of tests ...
+        TestSuite suite = new TestSuite("JCR 1.0 API tests");
+        suite.addTest(JcrTckLevelOneTestSuite.suite());
+        // suite.addTest(JcrTckLevelTwoTestSuite.suite());
+        // suite.addTest(JcrTckOptionalTestSuite.suite());
+
+        return suite;
+    }
+
+    /**
+     * Concrete implementation of {@link RepositoryStub} based on DNA-specific configuration.
+     */
+    public static class InMemoryRepositoryStub extends RepositoryStub {
+        private Repository repository;
+        protected RepositoryConnection connection;
+        protected AccessControlContext accessControlContext = AccessController.getContext();
+
+        private Credentials credentials = new Credentials() {
+            private static final long serialVersionUID = 1L;
+
+            @SuppressWarnings( "unused" )
+            public AccessControlContext getAccessControlContext() {
+                return accessControlContext;
+            }
+        };
+
+        protected ExecutionContext executionContext = new ExecutionContext() {
+
+            @Override
+            public ExecutionContext create( AccessControlContext accessControlContext ) {
+                return executionContext;
+            }
+        };
+
+        protected RepositoryConnectionFactory connectionFactory = new RepositoryConnectionFactory() {
+            public RepositoryConnection createConnection( String sourceName ) {
+                return connection;
+            }
+        };
+
+        public InMemoryRepositoryStub( Properties env ) {
+            super(env);
+
+            // Create the in-memory (DNA) repository
+            InMemoryRepositorySource source = new InMemoryRepositorySource();
+
+            // Various calls will fail if you do not set a non-null name for the source
+            source.setName("TestRepositorySource");
+
+            // Wrap a connection to the in-memory (DNA) repository in a (JCR) repository
+            connection = source.getConnection();
+            repository = new JcrRepository(Collections.<String, String>emptyMap(), executionContext.create(accessControlContext),
+                                           connectionFactory, source.getName());
+
+            // Make sure the path to the namespaces exists ...
+            Graph graph = Graph.create(source.getName(), connectionFactory, executionContext);
+            graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces");
+
+            // Set up some sample nodes in the graph to match the expected test configuration
+            try {
+
+                // TODO: Should there be an easier way to define these since they will be needed for all JCR repositories?
+                executionContext.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX, DnaLexicon.Namespace.URI);
+                executionContext.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX, JcrLexicon.Namespace.URI);
+                executionContext.getNamespaceRegistry().register(JcrNtLexicon.Namespace.PREFIX, JcrNtLexicon.Namespace.URI);
+                executionContext.getNamespaceRegistry().register("sv", "http://www.jcp.org/jcr/sv/1.0");
+
+                Path destinationPath = executionContext.getValueFactories().getPathFactory().create("/");
+                GraphImporter importer = new GraphImporter(graph);
+
+                URI xmlContent = new File("src/test/resources/repositoryJackrabbitTck.xml").toURI();
+                Graph.Batch batch = importer.importXml(xmlContent, Location.create(destinationPath));
+                batch.execute();
+
+            } catch (Exception ex) {
+                // The TCK tries to quash this exception. Print it out to be more obvious.
+                ex.printStackTrace();
+                throw new IllegalStateException("Repository initialization failed.", ex);
+            }
+        }
+
+        /**
+         * {@inheritDoc}
+         * 
+         * @see org.apache.jackrabbit.test.RepositoryStub#getSuperuserCredentials()
+         */
+        @Override
+        public Credentials getSuperuserCredentials() {
+            // TODO: Why must we override this method? The default TCK implementation just returns a particular instance of
+            // SimpleCredentials.
+            return credentials;
+        }
+
+        /**
+         * {@inheritDoc}
+         * 
+         * @see org.apache.jackrabbit.test.RepositoryStub#getReadOnlyCredentials()
+         */
+        @Override
+        public Credentials getReadOnlyCredentials() {
+            // TODO: Why must we override this method? The default TCK implementation just returns a particular instance of
+            // SimpleCredentials.
+            return credentials;
+        }
+
+        /**
+         * {@inheritDoc}
+         * 
+         * @see org.apache.jackrabbit.test.RepositoryStub#getRepository()
+         */
+        @Override
+        public Repository getRepository() {
+            return repository;
+        }
+
+    }
+
+}


Property changes on: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrTckTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties	2009-03-04 22:18:45 UTC (rev 756)
+++ trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties	2009-03-05 14:55:09 UTC (rev 757)
@@ -1,4 +1,4 @@
-javax.jcr.tck.repository_stub_impl=org.jboss.dna.jcr.JackrabbitJcrTckTest$InMemoryRepositoryStub
+javax.jcr.tck.repository_stub_impl=org.jboss.dna.jcr.JcrTckTest$InMemoryRepositoryStub
 javax.jcr.tck.testroot=/testroot
 javax.jcr.tck.nodename1=node1
 javax.jcr.tck.nodename2=node2




More information about the dna-commits mailing list