jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r573069 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm: ./ annotation/ annotation/atomic/ annotation/basic/
Date Wed, 05 Sep 2007 21:25:16 GMT
Author: clombart
Date: Wed Sep  5 14:25:15 2007
New Revision: 573069

URL: http://svn.apache.org/viewvc?rev=573069&view=rev
Log:
Reorganize the unit tests

Added:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/TestBase.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/AllTests.java
Removed:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/AllTests.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/AllTests.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/AllTests.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * 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("Jackrabbit OCM Annotation supportTests");
+        suite.addTest(org.apache.jackrabbit.ocm.annotation.basic.AllTests.buildSuite());
    
+        
+        return suite;
+    }
+}
+

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/RepositoryLifecycleTestSetup.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.apache.jackrabbit.ocm.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/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();
+    }
+    
+    
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/TestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/TestBase.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/TestBase.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/TestBase.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+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 javax.jcr.nodetype.PropertyDefinition;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.exception.RepositoryException;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
+import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Base class for testcases. Provides priviledged access to the jcr test
+ * repository.
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+public abstract class TestBase extends TestCase
+{
+
+	private final static Log log = LogFactory.getLog(TestBase.class);
+	
+	protected Session session;
+
+	protected ObjectContentManager ocm;
+
+	protected Mapper mapper;
+    
+
+	/**
+	 * <p>
+	 * Defines the test case name for junit.
+	 * </p>
+	 * 
+	 * @param testName
+	 *            The test case name.
+	 */
+	public TestBase(String testName)
+	{
+		super(testName);
+				
+	}
+
+
+	/**
+	 * @see junit.framework.TestCase#tearDown()
+	 */
+	public void tearDown() throws Exception
+	{
+		super.tearDown();
+		this.cleanUpRepisotory();
+	}
+
+
+
+    protected void registerNodeTypes(Session session) 
+    throws InvalidNodeTypeDefException, javax.jcr.RepositoryException, IOException {
+        InputStream xml = new FileInputStream(
+                "./src/test/test-config/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 ObjectContentManager initObjectContentManager(List<String> classNames) throws
Exception
+	{
+		Repository repository = RepositoryUtil.getRepository("repositoryTest");
+		session = RepositoryUtil.login(repository, "superuser", "superuser");
+		
+		Mapper mapper = new AnnotatedObjectMapper(classNames);
+		ocm = new ObjectContentManagerImpl(session, mapper);
+		registerNodeTypes(session);
+		return ocm;
+	}
+
+
+	public void exportDocument(String filePath, String nodePath, boolean skipBinary, boolean
noRecurse)
+	{
+		try
+		{
+			BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(filePath));
+			ContentHandler handler = new org.apache.xml.serialize.XMLSerializer(os, null).asContentHandler();
+			session.exportDocumentView(nodePath, handler, skipBinary, noRecurse);
+			os.flush();
+			os.close();
+		}
+		catch (Exception e)
+		{
+			System.out.println("Impossible to export the content from : " + nodePath);
+			e.printStackTrace();
+		}
+	}
+
+	public void importDocument(String filePath, String nodePath)
+	{
+		try
+		{
+			BufferedInputStream is = new BufferedInputStream(new FileInputStream(filePath));
+			session.importXML(nodePath, is, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
+			session.save();
+			is.close();
+		}
+		catch (Exception e)
+		{
+			System.out.println("Impossible to import the content from : " + nodePath);
+			e.printStackTrace();
+		}
+
+	}
+
+	protected Session getSession()
+	{
+		return this.session;
+	}
+
+	public QueryManager getQueryManager()
+	{
+		return ocm.getQueryManager();
+	}
+	
+    protected boolean contains(Collection result, String path, Class objectClass)
+    {
+            Iterator iterator = result.iterator();
+            while (iterator.hasNext())
+            {
+                Object  object = iterator.next();
+                String itemPath = (String)  ReflectionUtils.getNestedProperty(object, "path");
+                if (itemPath.equals(path))
+                {
+                    if (object.getClass() == objectClass)
+                    {
+                       return true;	
+                    }
+                    else
+                    {
+                    	   return false;
+                    }
+ 
+                }
+            }
+            return false;
+    }
+
+	
+	protected  void cleanUpRepisotory() {
+		try 
+		{
+				Session session = this.getSession();		
+				NodeIterator nodeIterator = session.getRootNode().getNodes();
+		
+				while (nodeIterator.hasNext())
+				{
+					Node node = nodeIterator.nextNode();
+					if (! node.getName().startsWith("jcr:"))
+					{
+					    log.debug("tearDown - remove : " + node.getPath());
+					    node.remove();
+					}
+				}
+				session.save();
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}
+
+    /**
+     * Returns true if a property was found in an array of property defintions.
+     * 
+     * @param definitions PropertyDefinition[]
+     * @param propertyName Name of property to find
+     * @return true/false
+     */
+//    public boolean containsPropertyDefintion(PropertyDefinition[] definitions, String propertyName)
{
+//        boolean found = false;
+//
+//        if (definitions != null && definitions.length > 0) {
+//            for (int i = 0; i < definitions.length; i++) {
+//                if (definitions[i].getName().equals(propertyName)) {
+//                    found = true;
+//                }
+//            }
+//        }
+//
+//        return found;
+//    }
+}
\ No newline at end of file

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/AllTests.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/AllTests.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/AllTests.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+
+
+/**
+ * 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.jackrabbit.ocm.annotation");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(CollectionTest.class);
+        suite.addTestSuite(UnstructuredMappingTest.class);
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java?rev=573069&r1=573068&r2=573069&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java
Wed Sep  5 14:25:15 2007
@@ -16,6 +16,12 @@
  */
 package org.apache.jackrabbit.ocm.annotation;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.TestBase;
+
 
 /**
  * 
@@ -26,12 +32,23 @@
  */
 public class CollectionTest extends TestBase {
 
+	
+	public CollectionTest(String testName) {
+		super(testName);
+		
+	}
 	public void tearDown() throws Exception {
 
 		//cleanUpRepisotory();
 		super.tearDown();
 		
 	}
+	
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new RepositoryLifecycleTestSetup(new TestSuite(CollectionTest.class));
+    }	
 	public void testBasicCollectionInsert() throws Exception {
 	/*
 		List<String> classNames = new ArrayList<String>();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java?rev=573069&r1=573068&r2=573069&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
Wed Sep  5 14:25:15 2007
@@ -19,13 +19,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.TestBase;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.UnstructuredAddress;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.UnstructuredPerson;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
-import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
 
 /**
  * 
@@ -37,6 +38,12 @@
  */
 public class UnstructuredMappingTest extends TestBase {
 	
+	
+	public UnstructuredMappingTest(String testName) {
+		super(testName);
+		
+	}
+
 	public void tearDown() throws Exception {
 
 		cleanUpRepisotory();
@@ -44,13 +51,18 @@
 		
 	}
 	
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new RepositoryLifecycleTestSetup(new TestSuite(UnstructuredMappingTest.class));
+    }	
+	
 	public void testBasic() throws Exception {
 		List<String> classNames = new ArrayList<String>();
 
 		classNames.add(UnstructuredAddress.class.getName());
 
-		ObjectContentManager objectContentManager = new ObjectContentManagerImpl(
-				session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+		ObjectContentManager objectContentManager = this.initObjectContentManager(classNames);
 
 		// -----------------------------------------------------------------------------
 		// Insert 
@@ -101,8 +113,7 @@
 			classNames.add(UnstructuredAddress.class.getName());
 			classNames.add(UnstructuredPerson.class.getName());
 
-			ObjectContentManager ocm = new ObjectContentManagerImpl(
-					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+			ObjectContentManager ocm = this.initObjectContentManager(classNames);
 
 			
 			// -----------------------------------------------------------------------------

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AllTests.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AllTests.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AllTests.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.atomic;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+
+
+/**
+ * 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.jackrabbit.ocm.annotation");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(AtomicTest.class);        
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java?rev=573069&r1=573068&r2=573069&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
Wed Sep  5 14:25:15 2007
@@ -23,15 +23,16 @@
 import java.util.Date;
 import java.util.List;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.ocm.annotation.TestBase;
-import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.TestBase;
+import org.apache.jackrabbit.ocm.annotation.UnstructuredMappingTest;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.Atomic;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
-import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
 
 /**
  * Test Atomic perisstence fields
@@ -44,12 +45,23 @@
 
 
 
+	public AtomicTest(String testName) {
+		super(testName);
+		
+	}
+
 	public void tearDown() throws Exception {
 
 		cleanUpRepisotory();
 		super.tearDown();
 		
 	}
+
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new RepositoryLifecycleTestSetup(new TestSuite(AtomicTest.class));
+    }
     
     public void testAtomicFields()
     {
@@ -60,8 +72,7 @@
 
     		classNames.add(Atomic.class.getName());
 
-    		ObjectContentManager ocm = new ObjectContentManagerImpl(
-    				session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+    		ObjectContentManager ocm = this.initObjectContentManager(classNames);
 
     		
         	Date date = new Date();

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/AllTests.java?rev=573069&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/AllTests.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/AllTests.java
Wed Sep  5 14:25:15 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.basic;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+
+
+/**
+ * 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.jackrabbit.ocm.annotation.basic");
+        //$JUnit-BEGIN$
+        suite.addTestSuite(ObjectContentManagerTest.class);
+        //$JUnit-END$
+
+        return suite;
+    }
+}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java?rev=573069&r1=573068&r2=573069&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java
Wed Sep  5 14:25:15 2007
@@ -20,18 +20,18 @@
 import java.util.Collection;
 import java.util.List;
 
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.ocm.annotation.TestBase;
-import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.TestBase;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.A;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.Atomic;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.B;
 import org.apache.jackrabbit.ocm.annotation.model.unstructured.C;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
-import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
 
 /**
  * Test JcrSession
@@ -41,6 +41,7 @@
 public class ObjectContentManagerTest extends TestBase {
 	private final static Log log = LogFactory.getLog(ObjectContentManagerTest.class);
 
+	
 	public void tearDown() throws Exception {
 
 		cleanUpRepisotory();
@@ -48,6 +49,18 @@
 
 	}
 
+    public static Test suite()
+    {
+        // All methods starting with "test" will be executed in the test suite.
+        return new RepositoryLifecycleTestSetup(new TestSuite(ObjectContentManagerTest.class));
+    }
+    
+	public ObjectContentManagerTest(String testName) {
+		super(testName);
+		
+	}
+
+
 	public void testClassA() {
 		try {
 
@@ -57,8 +70,7 @@
 			classNames.add(C.class.getName());
 			classNames.add(A.class.getName());
 
-			ObjectContentManager ocm = new ObjectContentManagerImpl(
-					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+			ObjectContentManager ocm = this.initObjectContentManager(classNames);
 
 
 			// --------------------------------------------------------------------------------
@@ -139,8 +151,7 @@
 
 			classNames.add(Atomic.class.getName());
 
-			ObjectContentManager ocm = new ObjectContentManagerImpl(
-					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+			ObjectContentManager ocm = this.initObjectContentManager(classNames);
 
 
 			assertTrue("Class A is not persistent ", ocm.isPersistent(Atomic.class));



Mime
View raw message