incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apope...@apache.org
Subject svn commit: r375381 - in /incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr: ./ persistence/atomicconverter/ persistence/collectionconverter/impl/ persistence/impl/ query/impl/ repository/
Date Mon, 06 Feb 2006 21:33:24 GMT
Author: apopescu
Date: Mon Feb  6 13:33:22 2006
New Revision: 375381

URL: http://svn.apache.org/viewcvs?rev=375381&view=rev
Log:
refactored tests to use RepositoryLifecycleTestSetup

Added:
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AllTests.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/AllTests.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java
Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerMultiValueQueryTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerRemoveTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/query/impl/QueryManagerTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java?rev=375381&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java Mon Feb  6 13:33:22 2006
@@ -0,0 +1,52 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.portals.graffito.jcr;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.portals.graffito.jcr.mapper.DigesterMapperImplTest;
+import org.apache.portals.graffito.jcr.query.impl.QueryManagerTest;
+import org.apache.portals.graffito.jcr.repository.RepositoryUtilTest;
+
+
+/**
+ * OCM suite definition. Bundles together all independent and package level test suites.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+    public static Test suite() throws Exception {
+        return new RepositoryLifecycleTestSetup(buildSuite());
+    }
+
+    public static Test buildSuite() throws Exception {
+        TestSuite suite= new TestSuite("Graffito OCM Tests");
+        // individual tests
+        suite.addTestSuite(DigesterMapperImplTest.class);
+        suite.addTestSuite(RepositoryUtilTest.class);
+        suite.addTestSuite(QueryManagerTest.class);
+        
+        // package level tests
+        suite.addTest(org.apache.portals.graffito.jcr.persistence.atomicconverter.AllTests.buildSuite());
+        suite.addTest(org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.AllTests.buildSuite());
+        suite.addTest(org.apache.portals.graffito.jcr.persistence.impl.AllTests.buildSuite());
+
+        return suite;
+    }
+}

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java?rev=375381&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java Mon Feb  6 13:33:22 2006
@@ -0,0 +1,53 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.portals.graffito.jcr;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
+/**
+ * A TestSetup that opens/close the JCR repository.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class RepositoryLifecycleTestSetup extends TestSetup {
+    public RepositoryLifecycleTestSetup(Test test) {
+        super(test);
+    }
+
+    /**
+     * @see junit.extensions.TestSetup#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        System.out.println("registering repository ... ");
+        RepositoryUtil.registerRepository("repositoryTest", 
+                "./src/test-config/repository-derby.xml", "./target/repository");
+    }
+
+    /**
+     * @see junit.extensions.TestSetup#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        RepositoryUtil.unRegisterRepository("repositoryTest");
+        System.out.println("repository shutdown");
+        super.tearDown();
+    }
+    
+    
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java Mon Feb  6 13:33:22 2006
@@ -20,6 +20,7 @@
 import java.io.BufferedOutputStream;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.sql.Timestamp;
 import java.util.Calendar;
@@ -31,10 +32,17 @@
 import javax.jcr.Repository;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Workspace;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeTypeManager;
 
 import junit.framework.TestCase;
 
-import org.apache.portals.graffito.jcr.exception.RepositoryException;
+import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
+import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
+import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.portals.graffito.jcr.mapper.impl.DigesterMapperImpl;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.BinaryTypeConverterImpl;
@@ -58,6 +66,7 @@
  * repository.
  * 
  * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  * @version $Id: Exp $
  */
 public abstract class TestBase extends TestCase
@@ -71,7 +80,7 @@
 
 	DigesterMapperImpl mapper;
 
-	private static boolean isInit = false;
+	private boolean isInit = false;
 
 	/**
 	 * <p>
@@ -84,21 +93,6 @@
 	public TestBase(String testName)
 	{
 		super(testName);
-
-		try
-		{
-			if (!isInit)
-			{
-				RepositoryUtil.registerRepository("repositoryTest", "./src/test-config/repository-derby.xml", "./target/repository");
-				isInit = true;
-			}
-
-		}
-		catch (Exception e)
-		{
-			e.printStackTrace();
-			fail("Impossible to init the repository");
-		}
 	}
 
 	/**
@@ -109,6 +103,12 @@
 	protected void setUp() throws Exception
 	{
 		super.setUp();
+        
+        if (!isInit) {
+            initPersistenceManager();
+            registerNodeTypes(getSession());
+            isInit = true;
+        }
 	}
 
 	/**
@@ -131,6 +131,7 @@
 			if (persistenceManager == null)
 			{
 				initPersistenceManager();
+                registerNodeTypes(getSession());
 			}
 			return persistenceManager;
 		}
@@ -141,27 +142,53 @@
 		}
 	}
 
+    protected void registerNodeTypes(Session session) 
+    throws InvalidNodeTypeDefException, javax.jcr.RepositoryException, IOException {
+        InputStream xml = new FileInputStream(
+                "./src/test-config/repository/repository/nodetypes/custom_nodetypes.xml");
+
+        // HINT: throws InvalidNodeTypeDefException, IOException
+        NodeTypeDef[] types = NodeTypeReader.read(xml);
+
+        Workspace workspace = session.getWorkspace();
+        NodeTypeManager ntMgr = workspace.getNodeTypeManager();
+        NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
+
+        for (int j = 0; j < types.length; j++) {
+            NodeTypeDef def = types[j];
+
+            try {
+                ntReg.getNodeTypeDef(def.getName());
+            }
+            catch (NoSuchNodeTypeException nsne) {
+                // HINT: if not already registered than register custom node type
+                ntReg.registerNodeType(def);
+            }
+
+        }
+    }
+    
 	protected void initPersistenceManager() throws UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
 	{
 		Repository repository = RepositoryUtil.getRepository("repositoryTest");
 		String[] files = { "./src/test-config/jcrmapping.xml", "./src/test-config/jcrmapping-atomic.xml" };
-		session = RepositoryUtil.login(repository, "superuser", "superuser");		
+		session = RepositoryUtil.login(repository, "superuser", "superuser");
 		HashMap atomicTypeConverters = new HashMap();
-		atomicTypeConverters.put(String.class, new StringTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(InputStream.class, new BinaryTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(long.class, new LongTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Long.class, new LongTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(int.class, new IntTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Integer.class, new IntTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(double.class, new DoubleTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Double.class, new DoubleTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(boolean.class, new BooleanTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Boolean.class, new BooleanTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Calendar.class, new CalendarTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(GregorianCalendar.class, new CalendarTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Date.class, new UtilDateTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(byte[].class, new ByteArrayTypeConverterImpl(session.getValueFactory()));
-		atomicTypeConverters.put(Timestamp.class, new TimestampTypeConverterImpl(session.getValueFactory()));
+		atomicTypeConverters.put(String.class, new StringTypeConverterImpl());
+		atomicTypeConverters.put(InputStream.class, new BinaryTypeConverterImpl());
+		atomicTypeConverters.put(long.class, new LongTypeConverterImpl());
+		atomicTypeConverters.put(Long.class, new LongTypeConverterImpl());
+		atomicTypeConverters.put(int.class, new IntTypeConverterImpl());
+		atomicTypeConverters.put(Integer.class, new IntTypeConverterImpl());
+		atomicTypeConverters.put(double.class, new DoubleTypeConverterImpl());
+		atomicTypeConverters.put(Double.class, new DoubleTypeConverterImpl());
+		atomicTypeConverters.put(boolean.class, new BooleanTypeConverterImpl());
+		atomicTypeConverters.put(Boolean.class, new BooleanTypeConverterImpl());
+		atomicTypeConverters.put(Calendar.class, new CalendarTypeConverterImpl());
+		atomicTypeConverters.put(GregorianCalendar.class, new CalendarTypeConverterImpl());
+		atomicTypeConverters.put(Date.class, new UtilDateTypeConverterImpl());
+		atomicTypeConverters.put(byte[].class, new ByteArrayTypeConverterImpl());
+		atomicTypeConverters.put(Timestamp.class, new TimestampTypeConverterImpl());
 		
 		mapper = new DigesterMapperImpl(files);						
 		queryManager = new QueryManagerImpl(mapper, atomicTypeConverters);

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AllTests.java?rev=375381&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AllTests.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AllTests.java Mon Feb  6 13:33:22 2006
@@ -0,0 +1,45 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.portals.graffito.jcr.persistence.atomicconverter;
+
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * Package level tests.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+    public static Test suite() {
+        return new RepositoryLifecycleTestSetup(buildSuite());
+    }
+
+    public static Test buildSuite() {
+        TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.persistence.atomicconverter");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(AtomicTest.class);
+        suite.addTestSuite(NullAtomicTest.class);
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java Mon Feb  6 13:33:22 2006
@@ -26,6 +26,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.Atomic;
@@ -51,7 +52,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(AtomicTest.class);
+        return new RepositoryLifecycleTestSetup(new TestSuite(AtomicTest.class));
     }
 
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java Mon Feb  6 13:33:22 2006
@@ -25,6 +25,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.Atomic;
@@ -50,7 +51,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(NullAtomicTest.class);
+        return new RepositoryLifecycleTestSetup(new TestSuite(NullAtomicTest.class));
     }
     
 

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/AllTests.java?rev=375381&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/AllTests.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/AllTests.java Mon Feb  6 13:33:22 2006
@@ -0,0 +1,47 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.portals.graffito.jcr.persistence.collectionconverter.impl;
+
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * Package level tests.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+    public static Test suite() {
+        return new RepositoryLifecycleTestSetup(buildSuite());
+    }
+
+    public static Test buildSuite() {
+        TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.persistence.collectionconverter.impl");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(DefaultCollectionConverterImplTest.class);
+        suite.addTestSuite(HashMapTest.class);
+        suite.addTestSuite(MultiValueCollectionConverterImplTest.class);
+        suite.addTestSuite(NTCollectionConverterImplTest.class);
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java Mon Feb  6 13:33:22 2006
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
@@ -50,7 +51,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(DefaultCollectionConverterImplTest.class);
+        return new RepositoryLifecycleTestSetup(new TestSuite(DefaultCollectionConverterImplTest.class));
     }
 
     

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java Mon Feb  6 13:33:22 2006
@@ -21,6 +21,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.hashmap.Element;
@@ -48,7 +49,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(HashMapTest.class);
+        return new RepositoryLifecycleTestSetup(new TestSuite(HashMapTest.class));
     }
 
     

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java Mon Feb  6 13:33:22 2006
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
@@ -53,7 +54,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(MultiValueCollectionConverterImplTest.class);
+        return new RepositoryLifecycleTestSetup(new TestSuite(MultiValueCollectionConverterImplTest.class));
     }
 
     

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java Mon Feb  6 13:33:22 2006
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
@@ -52,7 +53,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(NTCollectionConverterImplTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(NTCollectionConverterImplTest.class));
     }
     
     

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java?rev=375381&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java Mon Feb  6 13:33:22 2006
@@ -0,0 +1,52 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * 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.portals.graffito.jcr.persistence.impl;
+
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * Package level tests.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+    public static Test suite() {
+        return new RepositoryLifecycleTestSetup(buildSuite());
+    }
+
+    public static Test buildSuite() {
+        TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.persistence.impl");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(PersistenceManagerAtomicQueryTest.class);
+        suite.addTestSuite(PersistenceManagerBasicVersionningTest.class);
+        suite.addTestSuite(PersistenceManagerIteratorQueryTest.class);
+        suite.addTestSuite(PersistenceManagerMultiValueQueryTest.class);
+        suite.addTestSuite(PersistenceManagerRemoveTest.class);
+        suite.addTestSuite(PersistenceManagerSameNameSiblingTest.class);
+        suite.addTestSuite(PersistenceManagerScopeQueryTest.class);
+        suite.addTestSuite(PersistenceManagerSimpleQueryTest.class);
+        suite.addTestSuite(PersistenceManagerTest.class);
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java Mon Feb  6 13:33:22 2006
@@ -27,6 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.query.Filter;
@@ -57,7 +58,7 @@
 	public static Test suite()
 	{
 		// All methods starting with "test" will be executed in the test suite.
-		return new TestSuite(PersistenceManagerAtomicQueryTest.class);
+		return new RepositoryLifecycleTestSetup(new TestSuite(PersistenceManagerAtomicQueryTest.class));
 	}
 	
     

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java Mon Feb  6 13:33:22 2006
@@ -8,6 +8,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.Page;
@@ -38,7 +39,8 @@
 	public static Test suite()
 	{
 		// All methods starting with "test" will be executed in the test suite.
-		return new TestSuite(PersistenceManagerBasicVersionningTest.class);
+		return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerBasicVersionningTest.class));
 	}
 
     public void tearDown() throws Exception

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java Mon Feb  6 13:33:22 2006
@@ -29,6 +29,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
@@ -60,7 +61,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(PersistenceManagerIteratorQueryTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerIteratorQueryTest.class));
     }
 
     /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerMultiValueQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerMultiValueQueryTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerMultiValueQueryTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerMultiValueQueryTest.java Mon Feb  6 13:33:22 2006
@@ -27,6 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.query.Filter;
@@ -55,7 +56,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(PersistenceManagerMultiValueQueryTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerMultiValueQueryTest.class));
     }
 
     /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerRemoveTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerRemoveTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerRemoveTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerRemoveTest.java Mon Feb  6 13:33:22 2006
@@ -27,6 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.query.Filter;
@@ -57,7 +58,8 @@
 	public static Test suite()
 	{
 		// All methods starting with "test" will be executed in the test suite.
-		return new TestSuite(PersistenceManagerRemoveTest.class);
+		return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerRemoveTest.class));
 	}
 
     /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java Mon Feb  6 13:33:22 2006
@@ -27,6 +27,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
@@ -60,7 +61,8 @@
 	public static Test suite()
 	{
 		// All methods starting with "test" will be executed in the test suite.
-		return new TestSuite(PersistenceManagerSameNameSiblingTest.class);
+		return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerSameNameSiblingTest.class));
 	}
 
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java Mon Feb  6 13:33:22 2006
@@ -28,6 +28,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
@@ -59,7 +60,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(PersistenceManagerScopeQueryTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerScopeQueryTest.class));
     }
 
     /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java Mon Feb  6 13:33:22 2006
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
@@ -55,7 +56,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(PersistenceManagerSimpleQueryTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerSimpleQueryTest.class));
     }
 
     /**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java Mon Feb  6 13:33:22 2006
@@ -24,6 +24,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
@@ -51,7 +52,8 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(PersistenceManagerTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(PersistenceManagerTest.class));
     }
 
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/query/impl/QueryManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/query/impl/QueryManagerTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/query/impl/QueryManagerTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/query/impl/QueryManagerTest.java Mon Feb  6 13:33:22 2006
@@ -21,6 +21,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
 import org.apache.portals.graffito.jcr.TestBase;
 import org.apache.portals.graffito.jcr.query.Filter;
 import org.apache.portals.graffito.jcr.query.Query;
@@ -44,18 +45,17 @@
     public QueryManagerTest(String testName)  throws Exception
     {
         super(testName);
-        initPersistenceManager();
     }
 
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(QueryManagerTest.class);
+        return new RepositoryLifecycleTestSetup(
+                new TestSuite(QueryManagerTest.class));
     }
 
     public void testBuildExpression1()
     {
-
     	try
     	{
     	      QueryManager queryManager = this.getQueryManager();
@@ -68,9 +68,6 @@
     	      String jcrExpression = queryManager.buildJCRExpression(query);
     	      assertNotNull("jcrExpression is null", jcrExpression);
     	      assertTrue("Invalid JcrExpression", jcrExpression.equals("/jcr:root/test//element(*, graffito:C) [@graffito:name = 'a test value' and @graffito:id = 1]"));
-    	      
-    	      
-            
         }
         catch (Exception e)
         {
@@ -94,9 +91,6 @@
     	      String jcrExpression = queryManager.buildJCRExpression(query);
     	      assertNotNull("jcrExpression is null", jcrExpression);
     	      assertTrue("Invalid JcrExpression", jcrExpression.equals("//element(*, graffito:C) [@graffito:name = 'a test value' and @graffito:id = 1]"));
-    	      
-    	      
-            
         }
         catch (Exception e)
         {

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java?rev=375381&r1=375380&r2=375381&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/repository/RepositoryUtilTest.java Mon Feb  6 13:33:22 2006
@@ -23,6 +23,7 @@
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.transaction.UserTransaction;
 
+import junit.extensions.TestSetup;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -34,6 +35,7 @@
 /** Testcase for RepositoryUtil.
  * 
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
 public class RepositoryUtilTest extends TestCase
 {
@@ -54,11 +56,6 @@
     protected void setUp() throws Exception
     {
         super.setUp();
-        if (! isInit)
-        {
-            RepositoryUtil.registerRepository("repositoryTest", "src/test-config/repository-xml.xml", "target/repository");
-            isInit = true;
-        }
     }
 
     /**
@@ -71,8 +68,20 @@
 
     public static Test suite()
     {
+        TestSuite suite = new TestSuite(RepositoryUtilTest.class); 
         // All methods starting with "test" will be executed in the test suite.
-        return new TestSuite(RepositoryUtilTest.class);
+        return new TestSetup(suite) {
+            protected void setUp() throws Exception {
+                super.setUp();
+                RepositoryUtil.registerRepository("repositoryTest", "src/test-config/repository-xml.xml", "target/repository");
+            }
+
+            protected void tearDown() throws Exception {
+                RepositoryUtil.unRegisterRepository("repositoryTest");
+                super.tearDown();
+            }
+            
+        };
     }
 
     /**



Mime
View raw message