[dna-commits] DNA SVN: r1453 - in trunk/dna-integration-tests: src/test/java/org/jboss/dna/test/integration/jackrabbit and 1 other directory.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Thu Dec 17 20:53:09 EST 2009


Author: rhauch
Date: 2009-12-17 20:53:09 -0500 (Thu, 17 Dec 2009)
New Revision: 1453

Removed:
   trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitBasicFunctionTest.java
   trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitDerbyStressTest.java
   trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitInMemoryTest.java
   trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitTestUtil.java
Modified:
   trunk/dna-integration-tests/pom.xml
Log:
DNA-468 Removed the integration tests that used Jackrabbit, because Jackrabbit requires an older version of Lucene and pukes with the version we're using.  Now all unit and integration tests (including the TCK for the various connectors) all run successfully.  BTW, the Jackrabbit tests were really just verifying behavior and were not integrating DNA with Jackrabbit; therefore, it's okay they're gone.

Modified: trunk/dna-integration-tests/pom.xml
===================================================================
--- trunk/dna-integration-tests/pom.xml	2009-12-18 01:52:46 UTC (rev 1452)
+++ trunk/dna-integration-tests/pom.xml	2009-12-18 01:53:09 UTC (rev 1453)
@@ -145,44 +145,11 @@
 			<artifactId>jcr</artifactId>
 			<scope>test</scope>
 		</dependency>
-		<!-- Apache Jackrabbit (JCR Implementation) -->
+        <!-- 
+      JCR TCK unit tests
+    -->
 		<dependency>
 			<groupId>org.apache.jackrabbit</groupId>
-			<artifactId>jackrabbit-api</artifactId>
-			<version>1.4</version>
-			<scope>test</scope>
-			<!-- Exclude these since they are included in JDK 1.5 -->
-			<exclusions>
-				<exclusion>
-					<groupId>xml-apis</groupId>
-					<artifactId>xml-apis</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>xerces</groupId>
-					<artifactId>xercesImpl</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.jackrabbit</groupId>
-			<artifactId>jackrabbit-core</artifactId>
-			<version>1.4.5</version>
-			<scope>test</scope>
-			<!-- Exclude these since they are included in JDK 1.5 -->
-			<exclusions>
-				<exclusion>
-					<groupId>xml-apis</groupId>
-					<artifactId>xml-apis</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>xerces</groupId>
-					<artifactId>xercesImpl</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-
-		<dependency>
-			<groupId>org.apache.jackrabbit</groupId>
 			<artifactId>jackrabbit-jcr-tests</artifactId>
 		</dependency>
 		<!-- 

Deleted: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitBasicFunctionTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitBasicFunctionTest.java	2009-12-18 01:52:46 UTC (rev 1452)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitBasicFunctionTest.java	2009-12-18 01:53:09 UTC (rev 1453)
@@ -1,216 +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.test.integration.jackrabbit;
-
-import static org.junit.Assert.assertNotNull;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import javax.jcr.ImportUUIDBehavior;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.jboss.dna.common.i18n.MockI18n;
-import org.jboss.dna.common.util.FileUtil;
-import org.jboss.dna.common.util.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class JackrabbitBasicFunctionTest {
-
-    public static final String TESTATA_PATH = "./src/test/resources/";
-    public static final String JACKRABBIT_DATA_PATH = "./target/testdata/jackrabbittest/";
-    public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH + "repository";
-    public static final String REPOSITORY_CONFIG_PATH = TESTATA_PATH + "jackrabbitDerbyTestRepositoryConfig.xml";
-    public static final String DERBY_SYSTEM_HOME = JACKRABBIT_DATA_PATH + "/derby";
-
-    private Logger logger;
-    private Repository repository;
-
-    @Before
-    public void beforeEach() throws Exception {
-        // Clean up the test data ...
-        FileUtil.delete(JACKRABBIT_DATA_PATH);
-
-        // Set up Derby and the logger ...
-        System.setProperty("derby.system.home", DERBY_SYSTEM_HOME);
-        logger = Logger.getLogger(JackrabbitBasicFunctionTest.class);
-
-        // Set up the transient repository ...
-        this.repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
-    }
-
-    @After
-    public void afterEach() {
-        // Clean up the test data ...
-        FileUtil.delete(JACKRABBIT_DATA_PATH);
-    }
-
-    @Test
-    public void shouldConnectWithAnonymous() throws Exception {
-        Session session = null;
-        try {
-            session = this.repository.login();
-            assertNotNull(session);
-            String username = session.getUserID();
-            String name = repository.getDescriptor(Repository.REP_NAME_DESC);
-            logger.info(MockI18n.passthrough, "Logged in as " + username + " to a " + name + " repository");
-        } finally {
-            if (session != null) session.logout();
-        }
-    }
-
-    @Test
-    public void shouldConnectWithSimpleCredentials() throws Exception {
-        Session session = null;
-        try {
-            SimpleCredentials creds = new SimpleCredentials("jsmith", "password".toCharArray());
-            session = this.repository.login(creds);
-            assertNotNull(session);
-            String username = session.getUserID();
-            String name = repository.getDescriptor(Repository.REP_NAME_DESC);
-            logger.info(MockI18n.passthrough, "Logged in as " + username + " to a " + name + " repository");
-        } finally {
-            if (session != null) session.logout();
-        }
-    }
-
-    @Test
-    public void shouldSupportConcurrentSessionsForDifferentUsers() throws Exception {
-        List<Session> sessions = new ArrayList<Session>();
-        try {
-            for (int i = 0; i != 10; ++i) {
-                SimpleCredentials creds = new SimpleCredentials("user" + i, ("secret" + i).toCharArray());
-                Session session = this.repository.login(creds);
-                assertNotNull(session);
-                sessions.add(session);
-                logger.info(MockI18n.passthrough, "Logged in as " + session.getUserID());
-            }
-        } finally {
-            while (!sessions.isEmpty()) {
-                sessions.remove(0).logout();
-            }
-        }
-    }
-
-    @Test( expected = javax.jcr.AccessDeniedException.class )
-    public void shouldNotAllowAnonymousUserToCreateContent() throws Exception {
-        Session session = null;
-        try {
-            session = this.repository.login();
-            assertNotNull(session);
-            Node root = session.getRootNode();
-
-            // Store content
-            Node hello = root.addNode("hello");
-            Node world = hello.addNode("world");
-            world.setProperty("message", "Hello, World!");
-            session.save(); // Should fail
-        } finally {
-            if (session != null) session.logout();
-        }
-    }
-
-    @Test
-    public void shouldAllowAuthenticatedUserToCreateAndManipulateContent() throws Exception {
-        SimpleCredentials creds = new SimpleCredentials("user", "secret".toCharArray());
-        Session session = null;
-        try {
-            session = this.repository.login(creds);
-            assertNotNull(session);
-            Node root = session.getRootNode();
-
-            // Store content
-            Node hello = root.addNode("hello");
-            Node world = hello.addNode("world");
-            world.setProperty("message", "Hello, World!");
-            session.save();
-
-            // Retrieve content ...
-            Node node = root.getNode("hello/world");
-            this.logger.info(MockI18n.passthrough, "Node 'hello/world' has path: " + node.getPath());
-            this.logger.info(MockI18n.passthrough, "Node 'hello/world' has 'message' property: "
-                                                   + node.getProperty("message").getString());
-        } finally {
-            if (session != null) session.logout();
-        }
-
-        try {
-            session = this.repository.login(creds);
-            assertNotNull(session);
-            Node root = session.getRootNode();
-
-            // Retrieve content
-            Node node = root.getNode("hello/world");
-            this.logger.info(MockI18n.passthrough, "Node 'hello/world' has path: " + node.getPath());
-            this.logger.info(MockI18n.passthrough, "Node 'hello/world' has 'message' property: "
-                                                   + node.getProperty("message").getString());
-
-            // Remove content
-            this.logger.info(MockI18n.passthrough, "Node 'hello' is being removed");
-            root.getNode("hello").remove();
-            session.save();
-        } finally {
-            if (session != null) session.logout();
-        }
-    }
-
-    @Test
-    public void shouldImportFile() throws Exception {
-        SimpleCredentials creds = new SimpleCredentials("user", "secret".toCharArray());
-        Session session = null;
-        try {
-            session = this.repository.login(creds);
-            assertNotNull(session);
-
-            // Use the root node as a starting point
-            Node root = session.getRootNode();
-
-            // Import the XML file unless already imported
-            if (!root.hasNode("importxml")) {
-                System.out.print("Importing xml... ");
-                // Create an unstructured node under which to import the XML
-                Node node = root.addNode("importxml", "nt:unstructured");
-                // Import the file "test.xml" under the created node
-                FileInputStream xml = new FileInputStream(TESTATA_PATH + "jcr-import-test.xml");
-                try {
-                    session.importXML(node.getPath(), xml, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
-                } finally {
-                    xml.close();
-                }
-                // Save the changes to the repository
-                session.save();
-                System.out.println("done.");
-            }
-
-            JackrabbitTestUtil.dumpNode(root, System.out, true);
-        } finally {
-            if (session != null) session.logout();
-        }
-    }
-
-}

Deleted: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitDerbyStressTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitDerbyStressTest.java	2009-12-18 01:52:46 UTC (rev 1452)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitDerbyStressTest.java	2009-12-18 01:53:09 UTC (rev 1453)
@@ -1,250 +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.test.integration.jackrabbit;
-
-import static org.junit.Assert.assertNotNull;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.jboss.dna.common.i18n.MockI18n;
-import org.jboss.dna.common.statistic.HistogramTest;
-import org.jboss.dna.common.statistic.Stopwatch;
-import org.jboss.dna.common.util.FileUtil;
-import org.jboss.dna.common.util.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * These tests are designed to stress Jackrabbit in a variety of ways. Each test are independent of each other, and therefore each
- * test sets up a brand-new repository.
- */
-public class JackrabbitDerbyStressTest {
-
-    public static final String TESTATA_PATH = "./src/test/resources/";
-    public static final String JACKRABBIT_DATA_PATH = "./target/testdata/jackrabbittest/";
-    public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH + "repository";
-    public static final String REPOSITORY_CONFIG_PATH = TESTATA_PATH + "jackrabbitDerbyTestRepositoryConfig.xml";
-    public static final String DERBY_SYSTEM_HOME = JACKRABBIT_DATA_PATH + "/derby";
-    public static final String USERNAME = "jsmith";
-    public static final char[] PASSWORD = "secret".toCharArray();
-
-    private Logger logger;
-    private Repository repository;
-    private Session session;
-    private Stopwatch stopwatch = new Stopwatch();
-
-    @Before
-    public void beforeEach() throws Exception {
-        // Clean up the test data ...
-        FileUtil.delete(JACKRABBIT_DATA_PATH);
-
-        // Set up Derby and the logger ...
-        System.setProperty("derby.system.home", DERBY_SYSTEM_HOME);
-        logger = Logger.getLogger(JackrabbitDerbyStressTest.class);
-
-        // Set up the transient repository ...
-        logger.info(MockI18n.passthrough, "Creating test repository for stress test and logging in with user " + USERNAME);
-        this.repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
-
-        SimpleCredentials creds = new SimpleCredentials(USERNAME, PASSWORD);
-        session = this.repository.login(creds);
-        assertNotNull(session);
-    }
-
-    @After
-    public void afterEach() {
-        try {
-            if (session != null) session.logout();
-        } finally {
-            session = null;
-            repository = null;
-            logger = null;
-            // No matter what, clean up the test data ...
-            FileUtil.delete(JACKRABBIT_DATA_PATH);
-        }
-    }
-
-    @Test
-    public void shouldCreate100NodesWithNoChildrenAndNoProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 100; ++i) {
-            stopwatch.start();
-            rootNode.addNode("node" + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 100 nodes with no children and no properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    // NOTE: Most of these tests are @Ignored because they are just used to baseline Jackrabbit
-    // and are not needed to verify JBoss DNA in any way
-
-    @Ignore
-    @Test
-    public void shouldCreate1000NodesWithNoChildrenAndNoProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 1000; ++i) {
-            stopwatch.start();
-            rootNode.addNode("node" + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(1).setBucketCount(50),
-                                          80,
-                                          "create 1000 nodes with no children and no properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Ignore
-    @Test
-    public void shouldCreate5000NodesWithNoChildrenAndNoProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 5000; ++i) {
-            stopwatch.start();
-            rootNode.addNode("node" + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(1).setBucketCount(50),
-                                          80,
-                                          "create 5000 nodes with no children and no properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Ignore
-    @Test
-    public void shouldCreate10000NodesWithNoChildrenAndNoProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 10000; ++i) {
-            stopwatch.start();
-            rootNode.addNode("node" + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(1).setBucketCount(50),
-                                          80,
-                                          "create 10000 nodes with no children and no properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Test
-    public void shouldCreate100NodesWithNoChildrenAndSeveralProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 100; ++i) {
-            stopwatch.start();
-            Node child = rootNode.addNode("node" + i);
-            child.setProperty("jcr:name", "This is the name of node " + i);
-            child.setProperty("jcr:description", "This is the description of node " + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 100 nodes with no children and several properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Ignore
-    @Test
-    public void shouldCreate10000NodesWithNoChildrenAndSeveralProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 10000; ++i) {
-            stopwatch.start();
-            Node child = rootNode.addNode("node" + i);
-            child.setProperty("jcr:name", "This is the name of node " + i);
-            child.setProperty("jcr:description", "This is the description of node " + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 10000 nodes with no children and several properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Ignore
-    @Test
-    public void shouldCreate50000NodesWithNoChildrenAndSeveralProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 50000; ++i) {
-            stopwatch.start();
-            Node child = rootNode.addNode("node" + i);
-            child.setProperty("jcr:name", "This is the name of node " + i);
-            child.setProperty("jcr:description", "This is the description of node " + i);
-            stopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 50000 nodes with no children and several properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-
-    @Ignore
-    @Test
-    public void shouldCreate100000NodesWithNoChildrenAndSeveralProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        int index = 0;
-        stopwatch.start();
-        for (int j = 0; j != 100; ++j) {
-            for (int i = 0; i != 1000; ++i) {
-                ++index;
-                // stopwatch.start();
-                Node child = rootNode.addNode("node" + index);
-                child.setProperty("jcr:name", "This is the name of node " + index);
-                child.setProperty("jcr:description", "This is the description of node " + index);
-                // stopwatch.stop();
-            }
-            rootNode.save();
-        }
-        stopwatch.stop();
-        HistogramTest.writeHistogramToLog(logger,
-                                          stopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 100000 nodes (in 100 batches) with no children and several properties");
-        this.logger.info(MockI18n.passthrough, stopwatch.toString());
-    }
-}

Deleted: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitInMemoryTest.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitInMemoryTest.java	2009-12-18 01:52:46 UTC (rev 1452)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitInMemoryTest.java	2009-12-18 01:53:09 UTC (rev 1453)
@@ -1,186 +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.test.integration.jackrabbit;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import org.apache.jackrabbit.core.TransientRepository;
-import org.jboss.dna.common.i18n.MockI18n;
-import org.jboss.dna.common.statistic.HistogramTest;
-import org.jboss.dna.common.statistic.Stopwatch;
-import org.jboss.dna.common.util.FileUtil;
-import org.jboss.dna.common.util.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * These tests are designed to stress Jackrabbit in a variety of ways, using the in-memory persistence manager. Each test are
- * independent of each other, and therefore each test sets up a brand-new repository.
- */
-public class JackrabbitInMemoryTest {
-
-    public static final String TESTATA_PATH = "./src/test/resources/";
-    public static final String JACKRABBIT_DATA_PATH = "./target/testdata/jackrabbittest/";
-    public static final String REPOSITORY_DIRECTORY_PATH = JACKRABBIT_DATA_PATH + "repository";
-    public static final String REPOSITORY_CONFIG_PATH = TESTATA_PATH + "jackrabbitInMemoryTestRepositoryConfig.xml";
-    public static final String USERNAME = "jsmith";
-    public static final char[] PASSWORD = "secret".toCharArray();
-
-    private Logger logger;
-    private Repository repository;
-    private Session session;
-    private Stopwatch nodeStopwatch = new Stopwatch();
-    private Stopwatch saveStopwatch = new Stopwatch();
-
-    @Before
-    public void beforeEach() throws Exception {
-        // Clean up the test data ...
-        FileUtil.delete(JACKRABBIT_DATA_PATH);
-
-        // Set up the logger ...
-        logger = Logger.getLogger(JackrabbitInMemoryTest.class);
-
-        // Set up the transient repository ...
-        logger.info(MockI18n.passthrough, "Creating test repository for stress test and logging in with user " + USERNAME);
-        this.repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
-
-        SimpleCredentials creds = new SimpleCredentials(USERNAME, PASSWORD);
-        session = this.repository.login(creds);
-        assertNotNull(session);
-    }
-
-    @After
-    public void afterEach() {
-        try {
-            if (session != null) session.logout();
-        } finally {
-            session = null;
-            // No matter what, clean up the test data ...
-            FileUtil.delete(JACKRABBIT_DATA_PATH);
-        }
-    }
-
-    /**
-     * Create an evenly distributed tree of nodes, starting with the supplied parent.
-     * 
-     * @param parentNode the parent node of the tree; may not be null
-     * @param numberOfChildNodes the number of child nodes to create under the parent
-     * @param levelsToCreate the total number of levels in the tree to create
-     * @return the total number of child nodes created
-     * @throws Exception
-     */
-    public int createNodes( Node parentNode,
-                            int numberOfChildNodes,
-                            int levelsToCreate ) throws Exception {
-        int numberCreated = 0;
-        for (int i = 0; i < numberOfChildNodes; ++i) {
-            nodeStopwatch.start();
-            Node child = parentNode.addNode("node" + i);
-            child.setProperty("jcr:name", "This is the name of node " + i);
-            child.setProperty("jcr:description", "This is the description of node " + i);
-            nodeStopwatch.stop();
-            // this.logger.debug(" - " + child.getPath());
-            ++numberCreated;
-            if (levelsToCreate > 1) {
-                numberCreated += createNodes(child, numberOfChildNodes, levelsToCreate - 1);
-            }
-        }
-        return numberCreated;
-    }
-
-    @Test
-    public void shouldCreate10NodesWithNoChildrenAndNoProperties() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        rootNode.addNode("node"); // don't measure the first one
-        for (int i = 0; i != 10; ++i) {
-            nodeStopwatch.start();
-            rootNode.addNode("node" + i);
-            nodeStopwatch.stop();
-        }
-        rootNode.save();
-        HistogramTest.writeHistogramToLog(logger,
-                                          nodeStopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create 100 nodes with no children and no properties");
-        this.logger.info(MockI18n.passthrough, nodeStopwatch.toString());
-    }
-
-    @Test
-    public void shouldCreateTreeOfNodes2LevelsDeepWith10ChildrenAtEachNode() throws Exception {
-        Node rootNode = this.session.getRootNode();
-        Node parent = rootNode.addNode("node"); // don't measure the first one
-        int numNodes = this.createNodes(parent, 10, 2);
-        saveStopwatch.start();
-        rootNode.save();
-        saveStopwatch.stop();
-
-        HistogramTest.writeHistogramToLog(logger,
-                                          nodeStopwatch.getHistogram(3).setBucketCount(50),
-                                          80,
-                                          "create tree of " + numNodes + " nodes (2 deep, 10 children at every node)");
-        HistogramTest.writeHistogramToLog(logger, saveStopwatch.getHistogram(3).setBucketCount(50), 80, "1 save of 2x10 tree of "
-                                                                                                        + numNodes + " nodes");
-        this.logger.info(MockI18n.passthrough, "Node operation times: " + nodeStopwatch.toString());
-        this.logger.info(MockI18n.passthrough, "Save times: " + saveStopwatch.toString());
-    }
-
-    @Test
-    public void shouldExportSystemBranchToSystemView() throws Exception {
-        this.session.exportSystemView("/jcr:system", System.out, true, false);
-    }
-
-    @Test
-    public void shouldExportSystemBranchToDocumentView() throws Exception {
-        this.session.exportDocumentView("/jcr:system", System.out, true, false);
-    }
-
-    @Test
-    public void shouldNotHaveNamePropertyForNodes() throws Exception {
-        Node node = session.getRootNode().addNode("test");
-        assertThat(node, notNullValue());
-        assertThat(node.hasProperty("jcr:name"), is(false));
-    }
-
-    @Test
-    public void shouldNotHaveUuidPropertyForNonReferenceableNodes() throws Exception {
-        Node node = session.getRootNode().addNode("test");
-        assertThat(node, notNullValue());
-        assertThat(node.hasProperty("jcr:uuid"), is(false));
-    }
-
-    @Test
-    public void shouldHaveUuidPropertyForReferenceableNodes() throws Exception {
-        Node node = session.getRootNode().addNode("test");
-        node.addMixin("mix:referenceable");
-        assertThat(node, notNullValue());
-        assertThat(node.hasProperty("jcr:uuid"), is(true));
-    }
-}

Deleted: trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitTestUtil.java
===================================================================
--- trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitTestUtil.java	2009-12-18 01:52:46 UTC (rev 1452)
+++ trunk/dna-integration-tests/src/test/java/org/jboss/dna/test/integration/jackrabbit/JackrabbitTestUtil.java	2009-12-18 01:53:09 UTC (rev 1453)
@@ -1,76 +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.test.integration.jackrabbit;
-
-import java.io.PrintStream;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Value;
-
-public class JackrabbitTestUtil {
-
-    /**
-     * Recursively outputs the contents of the given node.
-     * @param node
-     * @param stream
-     * @param recursive
-     * @throws RepositoryException
-     */
-    public static void dumpNode( Node node, PrintStream stream, boolean recursive ) throws RepositoryException {
-        // First output the node path
-        System.out.println(node.getPath());
-        // Skip the virtual (and large!) jcr:system subtree
-        if (node.getName().equals("jcr:system")) {
-            return;
-        }
-
-        // Then output the properties
-        PropertyIterator properties = node.getProperties();
-        while (properties.hasNext()) {
-            Property property = properties.nextProperty();
-            if (property.getDefinition().isMultiple()) {
-                // A multi-valued property, print all values
-                Value[] values = property.getValues();
-                for (int i = 0; i < values.length; i++) {
-                    stream.println(property.getPath() + " = " + values[i].getString());
-                }
-            } else {
-                // A single-valued property
-                stream.println(property.getPath() + " = " + property.getString());
-            }
-        }
-
-        if (recursive) {
-            // Finally output all the child nodes recursively
-            NodeIterator nodes = node.getNodes();
-            while (nodes.hasNext()) {
-                dumpNode(nodes.nextNode(), stream, true);
-            }
-        }
-    }
-
-}



More information about the dna-commits mailing list