jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r583628 [1/3] - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test: java/org/apache/jackrabbit/ocm/ java/org/apache/jackrabbit/ocm/manager/inheritance/ java/org/apache/jackrabbit/ocm/manager/interfaces/ java/org/apache...
Date Wed, 10 Oct 2007 21:48:57 GMT
Author: clombart
Date: Wed Oct 10 14:48:46 2007
New Revision: 583628

URL: http://svn.apache.org/viewvc?rev=583628&view=rev
Log:
Add more unit tests for the annotation support

Added:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceConcreteClassTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceHierarchyTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationInterfaceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterConcreteClassTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterInterfaceHierarchyTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrNodeTypeTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrPropertyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrNodeTypeTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrNodeTypeTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrPropertyTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrPropertyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AnnotationLockTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/DigesterLockTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/ObjectContentManagerLockTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AnnotationProxyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/DigesterProxyTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/ProxyTest.java
Removed:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceConcreteClassTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceHierarchyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrNodeTypeTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrPropertyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/ObjectContentManagerLockTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/ProxyTest.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/File.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Folder.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/HierarchyNode.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Lockable.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/PropertyTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Resource.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Ancestor.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/AnotherDescendant.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Descendant.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/SubDescendant.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/CmsObjectImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/ContentImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentExtImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentStream.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/FolderImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/AnotherInterface.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/CmsObject.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Content.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Document.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Folder.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Interface.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Detail.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Main.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTDetail.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTMain.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-jcrnodetypes.xml

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java Wed Oct 10 14:48:46 2007
@@ -34,22 +34,35 @@
 import org.apache.jackrabbit.ocm.testmodel.DFull;
 import org.apache.jackrabbit.ocm.testmodel.Default;
 import org.apache.jackrabbit.ocm.testmodel.E;
+import org.apache.jackrabbit.ocm.testmodel.File;
+import org.apache.jackrabbit.ocm.testmodel.HierarchyNode;
+import org.apache.jackrabbit.ocm.testmodel.Lockable;
 import org.apache.jackrabbit.ocm.testmodel.MultiValue;
 import org.apache.jackrabbit.ocm.testmodel.Page;
 import org.apache.jackrabbit.ocm.testmodel.Paragraph;
+import org.apache.jackrabbit.ocm.testmodel.PropertyTest;
 import org.apache.jackrabbit.ocm.testmodel.Residual;
+import org.apache.jackrabbit.ocm.testmodel.Resource;
 import org.apache.jackrabbit.ocm.testmodel.Residual.ResidualNodes;
 import org.apache.jackrabbit.ocm.testmodel.Residual.ResidualProperties;
-import org.apache.jackrabbit.ocm.testmodel.auto.CmsObject;
-import org.apache.jackrabbit.ocm.testmodel.auto.Content;
-import org.apache.jackrabbit.ocm.testmodel.auto.Document;
-import org.apache.jackrabbit.ocm.testmodel.auto.Folder;
-import org.apache.jackrabbit.ocm.testmodel.auto.impl.CmsObjectImpl;
-import org.apache.jackrabbit.ocm.testmodel.auto.impl.ContentImpl;
-import org.apache.jackrabbit.ocm.testmodel.auto.impl.DocumentImpl;
-import org.apache.jackrabbit.ocm.testmodel.auto.impl.FolderImpl;
 import org.apache.jackrabbit.ocm.testmodel.collection.Element;
 import org.apache.jackrabbit.ocm.testmodel.collection.Main;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.Ancestor;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.Descendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.SubDescendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.ContentImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentExtImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentStream;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.AnotherInterface;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Content;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Document;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Folder;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Interface;
 
 /**
  * Base class for testcases. Provides priviledged access to the jcr test
@@ -102,6 +115,40 @@
 		classes.add(Residual.class); 
 		classes.add(ResidualProperties.class);
 		classes.add(ResidualNodes.class);
+		
+		classes.add(CmsObject.class);
+		classes.add(Content.class);
+		classes.add(Document.class);
+		classes.add(Folder.class);
+		classes.add(CmsObjectImpl.class);
+		classes.add(ContentImpl.class);
+		classes.add(DocumentImpl.class);
+		classes.add(DocumentExtImpl.class);
+		classes.add(DocumentStream.class);
+		classes.add(FolderImpl.class);
+		
+		classes.add(Ancestor.class);
+		classes.add(Descendant.class);
+		classes.add(AnotherDescendant.class);
+		classes.add(SubDescendant.class);
+		classes.add(Interface.class);
+		classes.add(AnotherInterface.class);
+		
+		classes.add(HierarchyNode.class);
+		classes.add(File.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.Folder.class);
+		classes.add(Resource.class);
+		classes.add(PropertyTest.class);
+		
+		classes.add(Lockable.class);
+		
+		classes.add(org.apache.jackrabbit.ocm.testmodel.proxy.Main.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.proxy.Detail.class);
+		
+		classes.add(org.apache.jackrabbit.ocm.testmodel.proxy.NTMain.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.proxy.NTDetail.class);
+		
+		
 		Mapper mapper = new AnnotationMapperImpl(classes);
 		ocm = new ObjectContentManagerImpl(session, mapper);
 		

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AllTests.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AllTests.java Wed Oct 10 14:48:46 2007
@@ -36,8 +36,10 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.inheritance");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerInheritanceConcreteClassTest.class);
-        suite.addTestSuite(ObjectContentManagerInheritanceHierarchyTest.class);        
+        suite.addTestSuite(AnnotationInheritanceConcreteClassTest.class);
+        suite.addTestSuite(AnnotationInheritanceHierarchyTest.class);
+        suite.addTestSuite(DigesterInheritanceConcreteClassTest.class);
+        suite.addTestSuite(DigesterInheritanceHierarchyTest.class);        
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceConcreteClassTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceConcreteClassTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceConcreteClassTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceConcreteClassTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,447 @@
+/*
+ * 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.manager.inheritance;
+
+import java.util.Collection;
+
+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.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.exception.JcrMappingException;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.query.Filter;
+import org.apache.jackrabbit.ocm.query.Query;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.testmodel.Atomic;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.ContentImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentExtImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentStream;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Folder;
+
+/**
+ * Test inheritance with node type per concrete class (without  discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationInheritanceConcreteClassTest extends AnnotationTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationInheritanceConcreteClassTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationInheritanceConcreteClassTest(String testName) throws Exception {
+		super(testName);
+
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new RepositoryLifecycleTestSetup(new TestSuite(
+				AnnotationInheritanceConcreteClassTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+
+	}
+
+
+	public void testRetrieveSingleton() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Insert a  Document
+			//---------------------------------------------------------------------------------------------------------
+            DocumentImpl document = new DocumentImpl();
+            document.setPath("/document1");
+            document.setName("document name");
+            document.setContentType("plain/text");
+            DocumentStream documentStream = new DocumentStream();
+            documentStream.setEncoding("utf-8");
+            documentStream.setContent("Test Content".getBytes());
+            document.setDocumentStream(documentStream);
+
+            ocm.insert(document);
+			ocm.save();
+
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve a document object
+			//---------------------------------------------------------------------------------------------------------
+
+			document = (DocumentImpl) ocm.getObject( "/document1");
+			assertEquals("Document path is invalid", document.getPath(), "/document1");
+			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8"));
+
+
+			//---------------------------------------------------------------------------------------------------------
+			// Update  a descendant object
+			//---------------------------------------------------------------------------------------------------------
+			document.setName("anotherName");
+			ocm.update(document);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the updated descendant object
+			//---------------------------------------------------------------------------------------------------------
+			document = (DocumentImpl) ocm.getObject( "/document1");
+			assertEquals("document name is incorrect", document.getName(), "anotherName");
+			assertEquals("Document path is invalid", document.getPath(), "/document1");
+			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8"));
+
+			CmsObjectImpl cmsObject = (CmsObjectImpl) ocm.getObject( "/document1");
+			assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName");
+			assertEquals("cmsObject path is invalid", cmsObject.getPath(), "/document1");
+
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+	}
+
+
+	public void testRetrieveCollection() {
+		ObjectContentManager ocm = this.getObjectContentManager();
+
+		//---------------------------------------------------------------------------------------------------------
+		// Insert cmsobjects
+		//---------------------------------------------------------------------------------------------------------
+        DocumentImpl document = new DocumentImpl();
+        document.setPath("/document1");
+        document.setName("document name 1");
+        document.setContentType("plain/text");
+        DocumentStream documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content".getBytes());
+        document.setDocumentStream(documentStream);
+        ocm.insert(document);
+
+        document = new DocumentImpl();
+        document.setPath("/document2");
+        document.setName("document name 2");
+        document.setContentType("plain/text");
+        documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content".getBytes());
+        document.setDocumentStream(documentStream);
+        ocm.insert(document);
+
+        document = new DocumentImpl();
+        document.setPath("/document3");
+        document.setName("document 3");
+        document.setContentType("plain/text");
+        documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content 3".getBytes());
+        document.setDocumentStream(documentStream);
+        ocm.insert(document);
+
+        FolderImpl folder = new FolderImpl();
+        folder.setPath("/folder1");
+        folder.setName("folder1");
+        ocm.insert(folder);
+
+
+        document = new DocumentImpl();
+        document.setName("document4");
+        document.setContentType("plain/text");
+        documentStream = new DocumentStream();
+        documentStream.setEncoding("utf-8");
+        documentStream.setContent("Test Content 4".getBytes());
+        document.setDocumentStream(documentStream);
+
+        FolderImpl subFolder = new FolderImpl();
+        subFolder.setName("subfolder");
+
+        folder = new FolderImpl();
+        folder.setPath("/folder2");
+        folder.setName("folder2");
+        folder.addChild(document);
+        folder.addChild(subFolder);
+        ocm.insert(folder);
+
+
+		Atomic a = new Atomic();
+		a.setPath("/atomic");
+		a.setBooleanPrimitive(true);
+		ocm.insert(a);
+
+		ocm.save();
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve Folders found on the root level
+		//---------------------------------------------------------------------------------------------------------
+		QueryManager queryManager = ocm.getQueryManager();
+		Filter filter = queryManager.createFilter(FolderImpl.class);
+		Query query = queryManager.createQuery(filter);
+		filter.setScope("/");
+		Collection result = ocm.getObjects(query);
+		assertEquals("Invalid number of folders found", result.size(), 2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2", FolderImpl.class));
+
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve Documents
+		//---------------------------------------------------------------------------------------------------------
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(DocumentImpl.class);
+
+		filter.addLike("name", "document name%");
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid number of documents  found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve folder2
+		//---------------------------------------------------------------------------------------------------------
+		FolderImpl folder2 = (FolderImpl) ocm.getObject( "/folder2");
+		assertNotNull("folder 2 is null", folder2);
+		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,2);
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));
+
+
+		CmsObjectImpl cmsObject = (CmsObjectImpl) ocm.getObject( "/folder2");
+		assertNotNull("folder 2 is null", cmsObject);
+		assertTrue("Invalid instance for folder 2",  cmsObject instanceof FolderImpl);
+		assertEquals("Invalid number of documents  found in folder2 children",  folder2.getChildren().size(),2);
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve Contents (ancestor of Documents)
+		//---------------------------------------------------------------------------------------------------------
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(ContentImpl.class);
+		filter.addLike("name", "document name%");
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid number of documents  found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve all cmsobjects found on the root level
+		//---------------------------------------------------------------------------------------------------------
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(CmsObjectImpl.class);
+		filter.setScope("/");
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid ancestor object found", result.size(),5);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class));
+
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve all cmsobjects found anywhere
+		//---------------------------------------------------------------------------------------------------------
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(CmsObjectImpl.class);
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid ancestor object found", result.size(),7);
+		assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2/document4", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/folder2/subfolder",FolderImpl.class));
+
+	}
+
+	public void testBeanCollection() {
+		ObjectContentManager ocm = this.getObjectContentManager();
+
+		//---------------------------------------------------------------------------------------------------------
+		// Insert cmsobjects
+		//---------------------------------------------------------------------------------------------------------
+		 FolderImpl folder = new FolderImpl();
+	     folder.setPath("/mainfolder");
+	     folder.setName("Main folder");
+
+	     for (int i=1; i<=100;i++)
+	     {
+	         DocumentImpl document = new DocumentImpl();
+	         document.setName("document" + i);
+	         document.setContentType("plain/text");
+	         DocumentStream documentStream = new DocumentStream();
+	         documentStream.setEncoding("utf-8");
+	         documentStream.setContent("Test Content".getBytes());
+	         document.setDocumentStream(documentStream);
+	         folder.addChild(document);
+
+	         FolderImpl subFolder = new FolderImpl();
+	         subFolder.setName("folder" + i);
+	         subFolder.addChild(document);
+	         folder.addChild(subFolder);
+
+	     }
+	     log.debug("Save the folder and its 200 children");
+	     ocm.insert(folder);
+	     ocm.save();
+	     log.debug("End - Save the folder and its 200 children");
+
+		//---------------------------------------------------------------------------------------------------------
+		// Retrieve Folder
+		//---------------------------------------------------------------------------------------------------------
+		folder  = (FolderImpl) ocm.getObject("/mainfolder");
+		assertNotNull("Folder is null",folder);
+		Collection children = folder.getChildren();
+		assertEquals("Invalid number of children", children.size(), 200);
+	     for (int i=1; i<=100;i++)
+	     {
+		     assertTrue("Invalid item in the collection : " +"/mainfolder/document" + i , this.contains(children, "/mainfolder/document" + i,DocumentImpl.class));
+		    assertTrue("Invalid item in the collection : " + "/mainfolder/folder" + i, this.contains(children, "/mainfolder/folder" + i, FolderImpl.class));
+	     }
+
+
+	}
+
+
+	public void testRetrieveExtension() {
+
+	    try {
+	        ObjectContentManager ocm = this.getObjectContentManager();
+
+	        //---------------------------------------------------------------------------------------------------------
+	        // Insert a  Document
+	        //---------------------------------------------------------------------------------------------------------
+	        DocumentImpl document = new DocumentImpl();
+	        document.setPath("/document1");
+	        document.setName("document name");
+	        document.setContentType("plain/text");
+	        DocumentStream documentStream = new DocumentStream();
+	        documentStream.setEncoding("utf-8");
+	        documentStream.setContent("Test Content".getBytes());
+	        document.setDocumentStream(documentStream);
+
+	        ocm.insert(document);
+	        ocm.save();
+
+
+	        //---------------------------------------------------------------------------------------------------------
+	        // Retrieve a document object
+	        //---------------------------------------------------------------------------------------------------------
+
+	        CmsObject cmsObject = (CmsObject) ocm.getObject( CmsObject.class, "/document1" );
+	        assertNotNull("Document not loaded", cmsObject);
+	        assertTrue("Document of wrong type " + cmsObject.getClass().getName(), cmsObject instanceof DocumentImpl);
+
+	        document = (DocumentImpl) cmsObject;
+	        assertEquals("Document path is invalid", document.getPath(), "/document1");
+	        assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+	        assertNotNull("document stream is null", document.getDocumentStream());
+	        assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8"));
+
+
+	        //---------------------------------------------------------------------------------------------------------
+	        // Retrieve a document object
+	        //---------------------------------------------------------------------------------------------------------
+
+	        try {
+	            Class clazz = Folder.class;
+	            cmsObject = (CmsObject) ocm.getObject( clazz, "/document1" );
+	            fail("Unexpected Mapping for DocumentImpl node to " + clazz);
+	        } catch (JcrMappingException jme) {
+	            // this is expected as class should not be acceptable
+	        }
+
+	    } catch (Exception e) {
+	        e.printStackTrace();
+	        fail();
+	    }
+
+	}
+
+
+    public void testRetrieveExtensionMissingExtends() {
+
+        try {
+            ObjectContentManager ocm = this.getObjectContentManager();
+
+            //---------------------------------------------------------------------------------------------------------
+            // Insert a  Document
+            //---------------------------------------------------------------------------------------------------------
+            DocumentExtImpl document = new DocumentExtImpl();
+            document.setPath("/document1");
+            document.setExtInfo("ext info");
+            document.setName("document name");
+            document.setContentType("plain/text");
+            DocumentStream documentStream = new DocumentStream();
+            documentStream.setEncoding("utf-8");
+            documentStream.setContent("Test Content".getBytes());
+            document.setDocumentStream(documentStream);
+
+            ocm.insert(document);
+            ocm.save();
+
+
+            //---------------------------------------------------------------------------------------------------------
+            // Retrieve a document object
+            //---------------------------------------------------------------------------------------------------------
+
+            CmsObject cmsObject = (CmsObject) ocm.getObject( CmsObject.class, "/document1" );
+            assertNotNull("Document not loaded", cmsObject);
+            assertTrue("Document of wrong type " + cmsObject.getClass().getName(), cmsObject instanceof DocumentExtImpl);
+
+            document = (DocumentExtImpl) cmsObject;
+            assertEquals("Document path is invalid", document.getPath(), "/document1");
+            assertEquals("Ext Info is invalid", document.getExtInfo(), "ext info");
+            assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+            assertNotNull("document stream is null", document.getDocumentStream());
+            assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8"));
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+
+    }
+}
\ No newline at end of file

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceHierarchyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceHierarchyTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceHierarchyTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/AnnotationInheritanceHierarchyTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,247 @@
+/*
+ * 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.manager.inheritance;
+
+import java.util.Collection;
+
+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.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.query.Filter;
+import org.apache.jackrabbit.ocm.query.Query;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.testmodel.Atomic;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.Ancestor;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.Descendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.SubDescendant;
+
+/**
+ * Test inheritance with node type per hierarchy stategy (with discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationInheritanceHierarchyTest extends AnnotationTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationInheritanceHierarchyTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationInheritanceHierarchyTest(String testName) throws Exception {
+		super(testName);
+
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new RepositoryLifecycleTestSetup(new TestSuite(
+				AnnotationInheritanceHierarchyTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+
+	public void testRetrieveSingleton() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Insert a descendant object
+			//---------------------------------------------------------------------------------------------------------			
+			Descendant descendant = new Descendant();
+			descendant.setDescendantField("descendantValue");
+			descendant.setAncestorField("ancestorValue");
+			descendant.setIntField(200);
+			descendant.setPath("/test");
+			ocm.insert(descendant);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve a descendant object
+			//---------------------------------------------------------------------------------------------------------						
+			descendant = null;
+			descendant = (Descendant) ocm.getObject(	 "/test");
+			assertEquals("Descendant path is invalid", descendant.getPath(), "/test");
+			assertEquals("Descendant ancestorField is invalid", descendant.getAncestorField(), "ancestorValue");
+			assertEquals("Descendant descendantField is invalid", descendant.getDescendantField(), "descendantValue");
+			assertEquals("Descendant intField is invalid", descendant.getIntField(), 200);
+
+			//---------------------------------------------------------------------------------------------------------
+			// Update  a descendant object
+			//---------------------------------------------------------------------------------------------------------						
+			descendant.setAncestorField("anotherAncestorValue");
+			descendant.setIntField(123);
+			ocm.update(descendant);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the updated descendant object
+			//---------------------------------------------------------------------------------------------------------						
+			descendant = null;
+			descendant = (Descendant) ocm.getObject(	 "/test");
+			assertEquals("Descendant path is invalid", descendant.getPath(), "/test");
+			assertEquals("Descendant ancestorField is invalid", descendant.getAncestorField(), "anotherAncestorValue");
+			assertEquals("Descendant descendantField is invalid", descendant	.getDescendantField(), "descendantValue");
+			assertEquals("Descendant intField is invalid", descendant.getIntField(), 123);
+
+			Ancestor ancestor = (Ancestor) ocm.getObject("/test");
+			assertTrue("Invalid object instance", ancestor instanceof Descendant );
+			assertEquals("Ancestor  path is invalid", ancestor.getPath(), "/test");
+			assertEquals("Ancestor ancestorField is invalid", ancestor.getAncestorField(), "anotherAncestorValue");
+			
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+	}
+
+	
+	public void testRetrieveCollection() {
+		ObjectContentManager ocm = this.getObjectContentManager();
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Insert  descendant objects
+		//---------------------------------------------------------------------------------------------------------			
+		Descendant descendant = new Descendant();
+		descendant.setDescendantField("descendantValue");
+		descendant.setAncestorField("ancestorValue");
+		descendant.setPath("/descendant1");
+		ocm.insert(descendant);
+
+		descendant = new Descendant();
+		descendant.setDescendantField("descendantValue2");
+		descendant.setAncestorField("ancestorValue2");
+		descendant.setPath("/descendant2");
+		ocm.insert(descendant);
+
+		SubDescendant subDescendant = new SubDescendant();
+		subDescendant.setDescendantField("descendantValue2");
+		subDescendant.setAncestorField("ancestorValue2");
+		subDescendant.setPath("/subdescendant");
+		subDescendant.setSubDescendantField("subdescendantvalue");
+		ocm.insert(subDescendant);		
+
+		 subDescendant = new SubDescendant();
+		subDescendant.setDescendantField("descendantValue3");
+		subDescendant.setAncestorField("ancestorValue2");
+		subDescendant.setPath("/subdescendant2");
+		subDescendant.setSubDescendantField("subdescendantvalue1");
+		ocm.insert(subDescendant);		
+		
+		
+		AnotherDescendant anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
+		anotherDescendant.setAncestorField("ancestorValue3");
+		anotherDescendant.setPath("/anotherdescendant1");
+		ocm.insert(anotherDescendant);
+
+		anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
+		anotherDescendant.setAncestorField("ancestorValue4");
+		anotherDescendant.setPath("/anotherdescendant2");
+		ocm.insert(anotherDescendant);
+
+		anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue2");
+		anotherDescendant.setAncestorField("ancestorValue5");
+		anotherDescendant.setPath("/anotherdescendant3");
+		ocm.insert(anotherDescendant);
+
+		
+		Atomic a = new Atomic();
+		a.setPath("/atomic");
+		a.setBooleanPrimitive(true);
+		ocm.insert(a);
+
+		ocm.save();
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve Descendant class
+		//---------------------------------------------------------------------------------------------------------			
+		QueryManager queryManager = ocm.getQueryManager();
+		Filter filter = queryManager.createFilter(Descendant.class);
+		Query query = queryManager.createQuery(filter);
+
+		Collection result = ocm.getObjects(query);
+		assertEquals("Invalid number of Descendant found", result.size(), 4);
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2", SubDescendant.class));
+		
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve AnotherDescendant class
+		//---------------------------------------------------------------------------------------------------------			
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(AnotherDescendant.class);
+		filter.addEqualTo("anotherDescendantField", "anotherDescendantValue");
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid number of AnotherDescendant found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class));
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve some descendants & subdescendants
+		//---------------------------------------------------------------------------------------------------------			
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(Descendant.class);		
+		filter.addEqualTo("descendantField","descendantValue2");
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid ancestor object found", result.size(),2);
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
+		
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve all class
+		//---------------------------------------------------------------------------------------------------------			
+		queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(Ancestor.class);		
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid ancestor object found", result.size(),7);
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant", SubDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2", SubDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant3", AnotherDescendant.class));		
+
+ 
+	}
+	    
+}
\ No newline at end of file

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceConcreteClassTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceConcreteClassTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceConcreteClassTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceConcreteClassTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceConcreteClassTest.java&r1=580157&r2=583628&rev=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceConcreteClassTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceConcreteClassTest.java Wed Oct 10 14:48:46 2007
@@ -45,14 +45,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerInheritanceConcreteClassTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerInheritanceConcreteClassTest.class);
+public class DigesterInheritanceConcreteClassTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterInheritanceConcreteClassTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerInheritanceConcreteClassTest(String testName) throws Exception {
+	public DigesterInheritanceConcreteClassTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -60,7 +60,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerInheritanceConcreteClassTest.class));
+				DigesterInheritanceConcreteClassTest.class));
 	}
 
 	public void tearDown() throws Exception {

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceHierarchyTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceHierarchyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceHierarchyTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceHierarchyTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceHierarchyTest.java&r1=580157&r2=583628&rev=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/ObjectContentManagerInheritanceHierarchyTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/inheritance/DigesterInheritanceHierarchyTest.java Wed Oct 10 14:48:46 2007
@@ -40,14 +40,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerInheritanceHierarchyTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerInheritanceHierarchyTest.class);
+public class DigesterInheritanceHierarchyTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterInheritanceHierarchyTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerInheritanceHierarchyTest(String testName) throws Exception {
+	public DigesterInheritanceHierarchyTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -55,7 +55,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerInheritanceHierarchyTest.class));
+				DigesterInheritanceHierarchyTest.class));
 	}
 
 	public void tearDown() throws Exception {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AllTests.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AllTests.java Wed Oct 10 14:48:46 2007
@@ -36,8 +36,10 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.interfaces");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerInterfaceConcreteClassTest.class);
-        suite.addTestSuite(ObjectContentManagerInterfaceHierarchyTest.class);        
+        suite.addTestSuite(AnnotationConcreteClassTest.class);
+        suite.addTestSuite(DigesterConcreteClassTest.class);
+        suite.addTestSuite(AnnotationInterfaceHierarchyTest.class);
+        suite.addTestSuite(DigesterInterfaceHierarchyTest.class);        
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationConcreteClassTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationConcreteClassTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationConcreteClassTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationConcreteClassTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,355 @@
+/*
+ * 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.manager.interfaces;
+
+import java.util.Collection;
+
+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.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.query.Filter;
+import org.apache.jackrabbit.ocm.query.Query;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.testmodel.Atomic;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentStream;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Content;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Document;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Folder;
+
+/**
+ * Test interface (with discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationConcreteClassTest extends AnnotationTestBase 
+{
+	private final static Log log = LogFactory.getLog(AnnotationConcreteClassTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationConcreteClassTest(String testName) throws Exception {
+		super(testName);
+
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new RepositoryLifecycleTestSetup(new TestSuite(
+				AnnotationConcreteClassTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+
+	public void testRetrieveSingleton() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Insert 
+			//---------------------------------------------------------------------------------------------------------			
+            DocumentImpl documentImpl = new DocumentImpl();
+            documentImpl.setPath("/document1");
+            documentImpl.setName("document name");
+            documentImpl.setContentType("plain/text"); 
+            DocumentStream documentStream = new DocumentStream();
+            documentStream.setEncoding("utf-8");
+            documentStream.setContent("Test Content".getBytes());
+            documentImpl.setDocumentStream(documentStream);
+            Document document = documentImpl;
+            
+            ocm.insert(document);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve 
+			//---------------------------------------------------------------------------------------------------------						
+			document = (Document) ocm.getObject( "/document1");
+			assertTrue("Invalid implementation for Document", document instanceof DocumentImpl);
+			assertEquals("Document path is invalid", document.getPath(), "/document1");
+			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8"));
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Update  a document
+			//---------------------------------------------------------------------------------------------------------						
+			document.setName("anotherName");
+			ocm.update(document);
+			ocm.save();
+			
+             //	---------------------------------------------------------------------------------------------------------
+			// Retrieve the updated descendant object
+			//---------------------------------------------------------------------------------------------------------						
+			document = (Document) ocm.getObject( "/document1");
+			assertTrue("Invalid implementation for Document", document instanceof DocumentImpl);
+			assertEquals("document name is incorrect", document.getName(), "anotherName");
+			assertEquals("Document path is invalid", document.getPath(), "/document1");
+			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
+			assertNotNull("document stream is null", document.getDocumentStream());
+			assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8"));
+
+			CmsObject cmsObject = (CmsObject) ocm.getObject( "/document1");
+			assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName");
+			assertEquals("cmsObject path is invalid", cmsObject.getPath(), "/document1");			
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+	}
+	
+	
+	public void testRetrieveCollection() {
+	ObjectContentManager ocm = this.getObjectContentManager();
+
+	//---------------------------------------------------------------------------------------------------------
+	// Insert cmsobjects
+	//---------------------------------------------------------------------------------------------------------			
+    DocumentImpl document = new DocumentImpl();
+    document.setPath("/document1");
+    document.setName("document name 1");
+    document.setContentType("plain/text"); 
+    DocumentStream documentStream = new DocumentStream();
+    documentStream.setEncoding("utf-8");
+    documentStream.setContent("Test Content".getBytes());
+    document.setDocumentStream(documentStream);        
+    ocm.insert(document);
+    
+    document = new DocumentImpl();
+    document.setPath("/document2");        
+    document.setName("document name 2");
+    document.setContentType("plain/text"); 
+    documentStream = new DocumentStream();
+    documentStream.setEncoding("utf-8");
+    documentStream.setContent("Test Content".getBytes());
+    document.setDocumentStream(documentStream);       
+    ocm.insert(document);
+
+    document = new DocumentImpl();
+    document.setPath("/document3");        
+    document.setName("document 3");
+    document.setContentType("plain/text"); 
+    documentStream = new DocumentStream();
+    documentStream.setEncoding("utf-8");
+    documentStream.setContent("Test Content 3".getBytes());
+    document.setDocumentStream(documentStream);       
+    ocm.insert(document);
+    
+    FolderImpl folder = new FolderImpl();
+    folder.setPath("/folder1");
+    folder.setName("folder1");
+    ocm.insert(folder);
+
+
+    document = new DocumentImpl();        
+    document.setName("document4");
+    document.setContentType("plain/text"); 
+    documentStream = new DocumentStream();
+    documentStream.setEncoding("utf-8");
+    documentStream.setContent("Test Content 4".getBytes());
+    document.setDocumentStream(documentStream);       
+
+    FolderImpl subFolder = new FolderImpl();
+    subFolder.setName("subfolder");
+    
+    folder = new FolderImpl();
+    folder.setPath("/folder2");
+    folder.setName("folder2");        
+    folder.addChild(document);
+    folder.addChild(subFolder);
+    ocm.insert(folder);               		
+
+    
+	Atomic a = new Atomic();
+	a.setPath("/atomic");
+	a.setBooleanPrimitive(true);
+	ocm.insert(a);
+
+	ocm.save();
+
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve Folders found on the root level
+	//---------------------------------------------------------------------------------------------------------			
+	QueryManager queryManager = ocm.getQueryManager();
+	Filter filter = queryManager.createFilter(Folder.class);
+	Query query = queryManager.createQuery(filter);
+	filter.setScope("/");
+	Collection result = ocm.getObjects(query);
+	assertEquals("Invalid number of folders found", result.size(), 2);
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder2", FolderImpl.class));		
+	
+
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve Documents 
+	//---------------------------------------------------------------------------------------------------------			
+	queryManager = ocm.getQueryManager();
+	filter = queryManager.createFilter(Document.class);
+	
+	filter.addLike("name", "document name%");
+	query = queryManager.createQuery(filter);
+
+	result = ocm.getObjects(query);
+	assertEquals("Invalid number of documents  found", result.size(),2);
+	assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+
+	
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve folder2 
+	//---------------------------------------------------------------------------------------------------------	
+	Folder folder2 = (Folder) ocm.getObject( "/folder2");
+	assertNotNull("folder 2 is null", folder2);
+	assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,2);
+	assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));
+	
+	
+	CmsObject cmsObject = (CmsObject) ocm.getObject( "/folder2");
+	assertNotNull("folder 2 is null", cmsObject);
+	assertTrue("Invalid instance for folder 2",  cmsObject instanceof FolderImpl);
+	assertEquals("Invalid number of documents  found in folder2 children",  folder2.getChildren().size(),2);
+	assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));
+	
+	Folder childFolder = (Folder) ocm.getObject( "/folder2/subfolder");
+	Folder parenFolder  = childFolder.getParentFolder();
+	assertNotNull("parent folder  is null", parenFolder);
+	assertTrue("Invalid instance for parent folder",  parenFolder instanceof FolderImpl);
+	assertEquals("Invalid number of documents  found in folder2 children",  parenFolder.getChildren().size(),2);
+	assertTrue("Invalid item in the collection", this.contains(parenFolder.getChildren(), "/folder2/document4", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(parenFolder.getChildren(), "/folder2/subfolder", FolderImpl.class));
+	
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve Contents (ancestor of Documents) 
+	//---------------------------------------------------------------------------------------------------------			
+	queryManager = ocm.getQueryManager();
+	filter = queryManager.createFilter(Content.class);
+	filter.addLike("name", "document name%");
+	query = queryManager.createQuery(filter);
+
+	result = ocm.getObjects(query);
+	assertEquals("Invalid number of documents  found", result.size(),2);
+	assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));
+	
+			
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve all cmsobjects found on the root level
+	//---------------------------------------------------------------------------------------------------------					
+	queryManager = ocm.getQueryManager();
+	filter = queryManager.createFilter(CmsObject.class);
+	filter.setScope("/");
+	query = queryManager.createQuery(filter);
+
+	result = ocm.getObjects(query);
+	assertEquals("Invalid ancestor object found", result.size(),5);
+	assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));	
+	assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class));		
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));	
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class));
+
+	
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve all cmsobjects found anywhere
+	//---------------------------------------------------------------------------------------------------------					
+	queryManager = ocm.getQueryManager();
+	filter = queryManager.createFilter(CmsObject.class);		
+	query = queryManager.createQuery(filter);
+
+	result = ocm.getObjects(query);
+	assertEquals("Invalid ancestor object found", result.size(),7);
+	assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class));	
+	assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder2/document4", DocumentImpl.class));		
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class));	
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class));
+	assertTrue("Invalid item in the collection", this.contains(result, "/folder2/subfolder",FolderImpl.class));
+	
+}
+ 
+
+public void testBeanCollection() {
+	ObjectContentManager ocm = this.getObjectContentManager();
+
+	//---------------------------------------------------------------------------------------------------------
+	// Insert cmsobjects
+	//---------------------------------------------------------------------------------------------------------
+	 Folder folder = new FolderImpl();		
+     folder.setPath("/mainfolder");
+     folder.setName("Main folder");        
+    
+     for (int i=1; i<=100;i++)
+     {
+         Document document = new DocumentImpl();	        
+         document.setName("document" + i);
+         document.setContentType("plain/text"); 
+         DocumentStream documentStream = new DocumentStream();
+         documentStream.setEncoding("utf-8");
+         documentStream.setContent("Test Content".getBytes());
+         document.setDocumentStream(documentStream);
+         folder.addChild(document);
+         
+         Folder subFolder = new FolderImpl();
+         subFolder.setName("folder" + i);
+         subFolder.addChild(document);
+         folder.addChild(subFolder);
+         	    	 
+     }
+     log.debug("Save the folder and its 200 children");   
+     ocm.insert(folder);
+     ocm.save();
+     log.debug("End - Save the folder and its 200 children");
+
+	//---------------------------------------------------------------------------------------------------------	
+	// Retrieve Folder
+	//---------------------------------------------------------------------------------------------------------			
+	folder  = (Folder) ocm.getObject("/mainfolder");
+	assertNotNull("Folder is null",folder);		
+	Collection children = folder.getChildren();
+	assertEquals("Invalid number of children", children.size(), 200);
+     for (int i=1; i<=100;i++)
+     {
+    	   
+        assertTrue("Invalid item in the collection : " +"/mainfolder/document" + i , this.contains(children, "/mainfolder/document" + i,DocumentImpl.class));
+	    assertTrue("Invalid item in the collection : " + "/mainfolder/folder" + i, this.contains(children, "/mainfolder/folder" + i, FolderImpl.class));
+     }
+}
+
+
+	
+}
\ No newline at end of file

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationInterfaceHierarchyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationInterfaceHierarchyTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationInterfaceHierarchyTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/AnnotationInterfaceHierarchyTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,195 @@
+/*
+ * 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.manager.interfaces;
+
+import java.util.Collection;
+
+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.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.query.Filter;
+import org.apache.jackrabbit.ocm.query.Query;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.testmodel.Atomic;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.Descendant;
+import org.apache.jackrabbit.ocm.testmodel.inheritance.SubDescendant;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.AnotherInterface;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Interface;
+
+/**
+ * Test interface (with discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationInterfaceHierarchyTest extends AnnotationTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationInterfaceHierarchyTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationInterfaceHierarchyTest(String testName) throws Exception {
+		super(testName);
+
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new RepositoryLifecycleTestSetup(new TestSuite(
+				AnnotationInterfaceHierarchyTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+
+	public void testRetrieveSingleton() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Insert 
+			//---------------------------------------------------------------------------------------------------------			
+			AnotherDescendant  anotherDescendant = new AnotherDescendant();
+			anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
+			anotherDescendant.setAncestorField("ancestorValue");
+			anotherDescendant.setPath("/test");
+			ocm.insert(anotherDescendant);
+
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve 
+			//---------------------------------------------------------------------------------------------------------						
+			Interface result =  (Interface) ocm.getObject("/test");
+			assertNotNull("Object is null", result);
+			anotherDescendant = (AnotherDescendant) result; 
+			
+			assertEquals("Descendant path is invalid", anotherDescendant.getPath(), "/test");
+			assertEquals("Descendant ancestorField is invalid", anotherDescendant.getAncestorField(), "ancestorValue");
+			assertEquals("Descendant descendantField is invalid", anotherDescendant	.getAnotherDescendantField(), "anotherDescendantValue");
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+	}
+	
+	
+	public void testRetrieveCollection() {
+		
+		ObjectContentManager ocm = this.getObjectContentManager();
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Insert  descendant objects
+		//---------------------------------------------------------------------------------------------------------			
+		Descendant descendant = new Descendant();
+		descendant.setDescendantField("descendantValue");
+		descendant.setAncestorField("ancestorValue");
+		descendant.setPath("/descendant1");
+		ocm.insert(descendant);
+
+		descendant = new Descendant();
+		descendant.setDescendantField("descendantValue2");
+		descendant.setAncestorField("ancestorValue2");
+		descendant.setPath("/descendant2");
+		ocm.insert(descendant);
+
+		SubDescendant subDescendant = new SubDescendant();
+		subDescendant.setDescendantField("descendantValue2");
+		subDescendant.setAncestorField("ancestorValue2");
+		subDescendant.setPath("/subdescendant");
+		subDescendant.setSubDescendantField("subdescendantvalue");
+		ocm.insert(subDescendant);		
+
+		 subDescendant = new SubDescendant();
+		subDescendant.setDescendantField("descendantValue3");
+		subDescendant.setAncestorField("ancestorValue2");
+		subDescendant.setPath("/subdescendant2");
+		subDescendant.setSubDescendantField("subdescendantvalue1");
+		ocm.insert(subDescendant);		
+		
+		
+		AnotherDescendant anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
+		anotherDescendant.setAncestorField("ancestorValue3");
+		anotherDescendant.setPath("/anotherdescendant1");
+		ocm.insert(anotherDescendant);
+
+		anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue");
+		anotherDescendant.setAncestorField("ancestorValue4");
+		anotherDescendant.setPath("/anotherdescendant2");
+		ocm.insert(anotherDescendant);
+
+		anotherDescendant = new AnotherDescendant();
+		anotherDescendant.setAnotherDescendantField("anotherDescendantValue2");
+		anotherDescendant.setAncestorField("ancestorValue5");
+		anotherDescendant.setPath("/anotherdescendant3");
+		ocm.insert(anotherDescendant);
+
+		
+		Atomic a = new Atomic();
+		a.setPath("/atomic");
+		a.setBooleanPrimitive(true);
+		ocm.insert(a);
+
+		ocm.save();
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve Descendant class (implements  Interface.class)
+		//---------------------------------------------------------------------------------------------------------			
+		QueryManager queryManager = ocm.getQueryManager();
+		Filter filter = queryManager.createFilter(Interface.class);
+		Query query = queryManager.createQuery(filter);
+
+		Collection result = ocm.getObjects(query);
+		assertEquals("Invalid number of  interface  found", result.size(),3);
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant3", AnotherDescendant.class));
+		
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve Descendant class and its children (implements  AnotherInterface.class)
+		//---------------------------------------------------------------------------------------------------------			
+	    queryManager = ocm.getQueryManager();
+		filter = queryManager.createFilter(AnotherInterface.class);
+		query = queryManager.createQuery(filter);
+
+		result = ocm.getObjects(query);
+		assertEquals("Invalid number of  interface  found", result.size(),4);
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class));
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant",SubDescendant.class));		
+		assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2",SubDescendant.class));
+
+	}
+	
+}
\ No newline at end of file

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterConcreteClassTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceConcreteClassTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterConcreteClassTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterConcreteClassTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceConcreteClassTest.java&r1=580157&r2=583628&rev=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceConcreteClassTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterConcreteClassTest.java Wed Oct 10 14:48:46 2007
@@ -23,14 +23,13 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
 import org.apache.jackrabbit.ocm.DigesterTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
 import org.apache.jackrabbit.ocm.query.Filter;
 import org.apache.jackrabbit.ocm.query.Query;
 import org.apache.jackrabbit.ocm.query.QueryManager;
 import org.apache.jackrabbit.ocm.testmodel.Atomic;
-import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl;
 import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentImpl;
 import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentStream;
 import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.FolderImpl;
@@ -44,14 +43,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerInterfaceConcreteClassTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerInterfaceConcreteClassTest.class);
+public class DigesterConcreteClassTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterConcreteClassTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerInterfaceConcreteClassTest(String testName) throws Exception {
+	public DigesterConcreteClassTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -59,7 +58,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerInterfaceConcreteClassTest.class));
+				DigesterConcreteClassTest.class));
 	}
 
 	public void tearDown() throws Exception {



Mime
View raw message