jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r584180 [2/2] - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm: ./ manager/query/ manager/uuid/ manager/version/ mapper/ querymanager/ testmodel/uuid/
Date Fri, 12 Oct 2007 15:09:20 GMT
Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/DigesterUuidTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/ObjectContentManagerUuidTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/DigesterUuidTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/DigesterUuidTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/ObjectContentManagerUuidTest.java&r1=580157&r2=584180&rev=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/ObjectContentManagerUuidTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/uuid/DigesterUuidTest.java Fri Oct 12 08:08:13 2007
@@ -38,15 +38,15 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerUuidTest extends DigesterTestBase
+public class DigesterUuidTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(ObjectContentManagerUuidTest.class);
+    private final static Log log = LogFactory.getLog(DigesterUuidTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public ObjectContentManagerUuidTest(String testName)  throws Exception
+    public DigesterUuidTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -55,7 +55,7 @@
     {
         // All methods starting with "test" will be executed in the test suite.
         return new RepositoryLifecycleTestSetup(
-                new TestSuite(ObjectContentManagerUuidTest.class));
+                new TestSuite(DigesterUuidTest.class));
     }
 
 
@@ -64,30 +64,7 @@
      */
     public void tearDown() throws Exception
     {
-    	if (getObjectContentManager().objectExists("/testB"))
-    	{
-    	   getObjectContentManager().remove("/testB");
-    	   getObjectContentManager().save();
-    	}
-    	
-    	if (getObjectContentManager().objectExists("/testB2"))
-    	{
-    	   getObjectContentManager().remove("/testB2");
-    	   getObjectContentManager().save();
-    	}
-    	
-    	if (getObjectContentManager().objectExists("/test"))
-    	{
-    	   getObjectContentManager().remove("/test");
-    	   getObjectContentManager().save();
-    	}
-    	
-    	if (getObjectContentManager().objectExists("/descendant"))
-    	{
-    	   getObjectContentManager().remove("/descendant");
-    	   getObjectContentManager().save();
-    	}
-    	
+    	cleanUpRepisotory();
         super.tearDown();
     }
     

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AllTests.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AllTests.java Fri Oct 12 08:08:13 2007
@@ -36,8 +36,8 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.version");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerBasicVersionningTest.class);
-       
+        suite.addTestSuite(AnnotationBasicVersionningTest.class);
+        suite.addTestSuite(DigesterBasicVersionningTest.class);
         
         //$JUnit-END$
 

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AnnotationBasicVersionningTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AnnotationBasicVersionningTest.java?rev=584180&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AnnotationBasicVersionningTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/AnnotationBasicVersionningTest.java Fri Oct 12 08:08:13 2007
@@ -0,0 +1,161 @@
+package org.apache.jackrabbit.ocm.manager.version;
+
+
+import java.util.Date;
+
+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.testmodel.Page;
+import org.apache.jackrabbit.ocm.testmodel.Paragraph;
+import org.apache.jackrabbit.ocm.version.Version;
+import org.apache.jackrabbit.ocm.version.VersionIterator;
+
+/**
+ * Test Query on atomic fields
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AnnotationBasicVersionningTest extends AnnotationTestBase
+{
+	private final static Log log = LogFactory.getLog(AnnotationBasicVersionningTest.class);
+		
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationBasicVersionningTest(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(AnnotationBasicVersionningTest.class));
+	}
+
+    public void tearDown() throws Exception
+    {
+        cleanUpRepisotory();       
+        super.tearDown();
+    }	
+
+	public void testSimpleVersion()
+	{
+		     ObjectContentManager ocm = getObjectContentManager();
+             try
+             {
+            	 
+            	 Page page = new Page();
+            	 page.setPath("/page");
+            	 page.setTitle("Page Title");            	 
+            	 page.addParagraph(new Paragraph("para1"));
+            	 page.addParagraph(new Paragraph("para2"));
+            	 ocm.insert(page);
+            	 ocm.save();
+            	 
+                 
+            	 page.addParagraph(new Paragraph("para3"));
+            	 ocm.checkout("/page");
+            	 ocm.update(page);
+            	 ocm.save();
+            	 ocm.checkin("/page");
+            	 
+            	 page.addParagraph(new Paragraph("para4"));
+            	 ocm.checkout("/page");
+            	 ocm.update(page);
+            	 ocm.save();
+            	 ocm.checkin("/page");            	 
+
+            	 VersionIterator versionIterator = ocm.getAllVersions("/page");
+            	 assertNotNull("VersionIterator is null", versionIterator);
+            	 assertTrue("Invalid number of versions found", versionIterator.getSize() == 3);
+            	 
+            	 while (versionIterator.hasNext())
+            	 {
+            		 Version version = (Version) versionIterator.next();
+            		 log.info("version found : "+ version.getName() + " - " + version.getPath() + " - " +  version.getCreated().getTime());
+            		 
+            	 }
+            	 
+            	 Version baseVersion = ocm.getBaseVersion("/page");
+            	 System.out.println("Base version : " + baseVersion.getName());
+
+            	 Version rootVersion = ocm.getRootVersion("/page");
+            	 System.out.println("Root version : " + rootVersion.getName());
+            	 //this.exportDocument("/home/christophe/export.xml", "/jcr:system/jcr:versionStorage", true, false);
+            	             	
+                 //Get the latest version 
+            	 page = (Page) ocm.getObject( "/page");
+            	 assertNotNull("Last version is nulll", page);
+            	 assertTrue("Invalid number of paragraph found in the last  version", page.getParagraphs().size() == 4);
+
+            	 
+            	 //Get the object matching to the first version 
+                 Page  page1 = (Page) ocm.getObject( "/page", "1.0");
+            	 assertNotNull("version 1.0 object is null", page1);
+            	 assertTrue("Invalid number of paragraph found in the root version", page1.getParagraphs().size() == 3);
+
+             }
+             catch(Exception e)
+             {
+            	 e.printStackTrace();
+            	 fail(e.getMessage());
+            	 
+             }
+	}
+
+	
+	public void testVersionLabels()
+	{
+		     ObjectContentManager ocm = getObjectContentManager();
+             try
+             {
+            	 
+            	 Page page = new Page();
+            	 page.setPath("/page");
+            	 page.setTitle("Page Title");            	 
+            	 page.addParagraph(new Paragraph("para1"));
+            	 page.addParagraph(new Paragraph("para2"));
+            	 ocm.insert(page);
+            	 ocm.save();
+            	 
+                 
+            	 page.addParagraph(new Paragraph("para3"));
+            	 ocm.checkout("/page");
+            	 ocm.update(page);
+            	 ocm.save();
+            	 ocm.checkin("/page", new String[] {"A", "B"});
+            	 
+            	 page.addParagraph(new Paragraph("para4"));
+            	 ocm.checkout("/page");
+            	 ocm.update(page);
+            	 ocm.save();
+            	 ocm.checkin("/page", new String[] {"C", "D"});         	 
+
+            	 String[] allLabels = ocm.getAllVersionLabels("/page");
+            	 assertTrue("Incorrect number of labels", allLabels.length == 4);
+
+            	 String[] versionLabels = ocm.getVersionLabels("/page", "1.1");
+            	 assertTrue("Incorrect number of labels", versionLabels.length == 2);
+            	 assertTrue("Incorrect label", versionLabels[0].equals("C") || versionLabels[0].equals("D"));
+            	 assertTrue("Incorrect label", versionLabels[1].equals("C") || versionLabels[0].equals("D"));
+            	
+
+             }
+             catch(Exception e)
+             {
+            	 e.printStackTrace();
+            	 fail(); 
+             }
+	}
+	
+}
\ No newline at end of file

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/DigesterBasicVersionningTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/ObjectContentManagerBasicVersionningTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/DigesterBasicVersionningTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/DigesterBasicVersionningTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/ObjectContentManagerBasicVersionningTest.java&r1=580157&r2=584180&rev=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/ObjectContentManagerBasicVersionningTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/version/DigesterBasicVersionningTest.java Fri Oct 12 08:08:13 2007
@@ -8,8 +8,8 @@
 
 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.testmodel.Page;
 import org.apache.jackrabbit.ocm.testmodel.Paragraph;
@@ -21,16 +21,16 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerBasicVersionningTest extends DigesterTestBase
+public class DigesterBasicVersionningTest extends DigesterTestBase
 {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerBasicVersionningTest.class);
-	private Date date = new Date();
+	private final static Log log = LogFactory.getLog(DigesterBasicVersionningTest.class);
+	
 	
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerBasicVersionningTest(String testName) throws Exception
+	public DigesterBasicVersionningTest(String testName) throws Exception
 	{
 		super(testName);
 		
@@ -40,13 +40,12 @@
 	{
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(
-                new TestSuite(ObjectContentManagerBasicVersionningTest.class));
+                new TestSuite(DigesterBasicVersionningTest.class));
 	}
 
     public void tearDown() throws Exception
     {
-    	ObjectContentManager ocm = getObjectContentManager();
-	    ocm.remove("/page");
+    	cleanUpRepisotory();
     	ocm.save();
        
         super.tearDown();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AllTests.java Fri Oct 12 08:08:13 2007
@@ -36,8 +36,8 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.mapper");
         //$JUnit-BEGIN$
+        suite.addTestSuite(AnnotationMapperImplTest.class);
         suite.addTestSuite(DigesterMapperImplTest.class);
-        
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AnnotationMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AnnotationMapperImplTest.java?rev=584180&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AnnotationMapperImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/AnnotationMapperImplTest.java Fri Oct 12 08:08:13 2007
@@ -0,0 +1,509 @@
+/*
+ * 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.mapper;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.ocm.exception.JcrMappingException;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl;
+import org.apache.jackrabbit.ocm.mapper.model.BeanDescriptor;
+import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
+import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
+import org.apache.jackrabbit.ocm.mapper.model.FieldDescriptor;
+import org.apache.jackrabbit.ocm.testmodel.A;
+import org.apache.jackrabbit.ocm.testmodel.B;
+import org.apache.jackrabbit.ocm.testmodel.C;
+import org.apache.jackrabbit.ocm.testmodel.PropertyTest;
+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.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Document;
+import org.apache.jackrabbit.ocm.testmodel.interfaces.Interface;
+import org.apache.jackrabbit.ocm.testmodel.proxy.Main;
+
+/**
+ * Test Annotation Mapper
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationMapperImplTest extends TestCase {
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationMapperImplTest(String testName) {
+		super(testName);
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new TestSuite(DigesterMapperImplTest.class);
+	}
+
+	/**
+	 * Simple test mapper
+	 *
+	 */
+	public void testMapper() {
+		try {
+
+			Mapper mapper = getMapper();
+					
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(A.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid classname", classDescriptor.getClassName().equals(A.class.getName()));
+			assertTrue("Invalid path field", classDescriptor.getPathFieldDescriptor().getFieldName().equals("path"));
+			assertEquals("Invalid mixins", "mix:lockable", classDescriptor.getJcrMixinTypes()[0]);
+
+			FieldDescriptor fieldDescriptor = classDescriptor	.getFieldDescriptor("a1");
+			assertNotNull("FieldDescriptor is null", fieldDescriptor);
+			assertTrue("Invalid jcrName for field a1", fieldDescriptor.getJcrName().equals("a1"));
+
+			BeanDescriptor beanDescriptor = classDescriptor.getBeanDescriptor("b");
+			assertNotNull("BeanDescriptor is null", beanDescriptor);
+			assertTrue("Invalid jcrName for field b", beanDescriptor	.getJcrName().equals("b"));			
+			assertNotNull("Invalid bean default converter", beanDescriptor.getConverter());
+			
+
+			CollectionDescriptor collectionDescriptor = classDescriptor.getCollectionDescriptor("collection");
+			assertNotNull("CollectionDescriptor is null", collectionDescriptor);
+			assertTrue("Invalid jcrName for field collection",collectionDescriptor.getJcrName().equals("collection"));
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+
+	/**
+	 * Simple test mapper
+	 *
+	 */
+	public void testUuid() {
+		try {
+
+			Mapper mapper = getMapper();
+					
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(org.apache.jackrabbit.ocm.testmodel.uuid.A.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid uuid field", classDescriptor.getUuidFieldDescriptor().getFieldName().equals("uuid"));
+
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 * Simple test mapper
+	 *
+	 */
+	public void testDiscriminatorSetting() {
+		try {
+
+			Mapper mapper = getMapper();
+
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByNodeType("ocm:C");
+			//ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(C.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid classname", classDescriptor.getClassName().equals(C.class.getName()));			
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 * Test optional mapping properties
+	 *
+	 */
+	public void testMapperOptionalProperties() {
+		try {
+
+			Mapper mapper = getMapper();			
+			
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(B.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid classname", classDescriptor.getClassName()
+					.equals(B.class.getName()));
+			assertEquals(classDescriptor.getJcrSuperTypes(), "nt:base");
+
+			FieldDescriptor b1Field = classDescriptor.getFieldDescriptor("b1");
+			assertNotNull("FieldDescriptor is null", b1Field);
+			assertEquals(b1Field.getFieldName(), "b1");
+			assertEquals(b1Field.getJcrType(), "String");
+			assertFalse(b1Field.isJcrAutoCreated());
+			assertFalse(b1Field.isJcrMandatory());
+			assertFalse(b1Field.isJcrProtected());
+			assertFalse(b1Field.isJcrMultiple());
+			assertEquals(b1Field.getJcrOnParentVersion(), "IGNORE");
+
+			FieldDescriptor b2Field = classDescriptor.getFieldDescriptor("b2");
+			assertNotNull("FieldDescriptor is null", b2Field);
+			assertEquals(b2Field.getFieldName(), "b2");
+			assertEquals(b2Field.getJcrType(), "String");
+			assertFalse(b2Field.isJcrAutoCreated());
+			assertFalse(b2Field.isJcrMandatory());
+			assertFalse(b2Field.isJcrProtected());
+			assertFalse(b2Field.isJcrMultiple());
+			assertEquals(b2Field.getJcrOnParentVersion(), "IGNORE");
+
+			ClassDescriptor classDescriptor2 = mapper
+					.getClassDescriptorByClass(A.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor2);
+			assertTrue("Invalid classname", classDescriptor2.getClassName()
+					.equals(A.class.getName()));
+
+			BeanDescriptor beanDescriptor = classDescriptor2
+					.getBeanDescriptor("b");
+			assertNotNull(beanDescriptor);
+			assertEquals(beanDescriptor.getFieldName(), "b");
+			assertEquals(beanDescriptor.getJcrType(), "nt:unstructured");
+			assertFalse(beanDescriptor.isJcrAutoCreated());
+			assertFalse(beanDescriptor.isJcrMandatory());
+			assertFalse(beanDescriptor.isJcrProtected());
+			assertFalse(beanDescriptor.isJcrSameNameSiblings());
+			assertEquals(beanDescriptor.getJcrOnParentVersion(), "IGNORE");
+
+			CollectionDescriptor collectionDescriptor = classDescriptor2
+					.getCollectionDescriptor("collection");
+			assertNotNull(collectionDescriptor);
+			assertEquals(collectionDescriptor.getJcrType(), "ocm:C");
+			assertFalse(collectionDescriptor.isJcrAutoCreated());
+			assertFalse(collectionDescriptor.isJcrMandatory());
+			assertFalse(collectionDescriptor.isJcrProtected());
+			assertFalse(collectionDescriptor.isJcrSameNameSiblings());
+			assertEquals(collectionDescriptor.getJcrOnParentVersion(), "IGNORE");
+			
+			classDescriptor = mapper.getClassDescriptorByClass(PropertyTest.class);
+			assertNotNull(classDescriptor);
+			FieldDescriptor fieldDescriptor = classDescriptor.getFieldDescriptor("requiredWithConstraintsProp");
+			assertNotNull(fieldDescriptor.getJcrValueConstraints());
+			assertTrue("Invalid constaint", fieldDescriptor.getJcrValueConstraints()[0].equals("abc") );
+			assertTrue("Invalid constaint", fieldDescriptor.getJcrValueConstraints()[1].equals("def") );
+			assertTrue("Invalid constaint", fieldDescriptor.getJcrValueConstraints()[2].equals("ghi") );
+			
+			fieldDescriptor = classDescriptor.getFieldDescriptor("autoCreatedProp");
+			assertNotNull(fieldDescriptor.getJcrDefaultValue());
+			assertTrue("Invalid default value", fieldDescriptor.getJcrDefaultValue().equals("aaa") );
+			
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 *
+	 * Test Node Type per hierarchy setting
+	 */
+	public void testMapperNtHierarchy() {
+		try {
+			Mapper mapper = getMapper();
+			
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper
+					.getClassDescriptorByClass(Ancestor.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertEquals("Incorrect path field", classDescriptor
+					.getPathFieldDescriptor().getFieldName(), "path");
+			assertTrue("The ancestor class has no discriminator",
+					classDescriptor.hasDiscriminator());
+			assertTrue("The ancestor class is not abstract", classDescriptor
+					.isAbstract());
+			assertNull("The ancestor class has an ancestor", classDescriptor
+					.getSuperClassDescriptor());
+			assertTrue(
+					"Ancestor class doesn't have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertFalse(
+					"Ancestor class  have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerConcreteClassStrategy());
+
+			Collection descendandDescriptors = classDescriptor
+					.getDescendantClassDescriptors();
+			assertEquals("Invalid number of descendants", descendandDescriptors
+					.size(), 2);
+
+			classDescriptor = mapper.getClassDescriptorByClass(Descendant.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertEquals("Incorrect path field", classDescriptor
+					.getPathFieldDescriptor().getFieldName(), "path");
+			assertTrue("The descendant  class has no discriminator",
+					classDescriptor.hasDiscriminator());
+			assertNotNull("ancerstorField is null in the descendant class",
+					classDescriptor.getFieldDescriptor("ancestorField"));
+			assertFalse("The descendant class is abstract", classDescriptor
+					.isAbstract());
+			assertNotNull("The descendant class has not an ancestor",
+					classDescriptor.getSuperClassDescriptor());
+			assertEquals("Invalid ancestor class for the descendant class",
+					classDescriptor.getSuperClassDescriptor().getClassName(),
+					"org.apache.jackrabbit.ocm.testmodel.inheritance.Ancestor");
+			descendandDescriptors = classDescriptor
+					.getDescendantClassDescriptors();
+			assertEquals("Invalid number of descendants", descendandDescriptors
+					.size(), 1);
+			assertTrue(
+					"Descendant  class doesn't have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertFalse(
+					"Descendant class  have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerConcreteClassStrategy());
+
+			classDescriptor = mapper.getClassDescriptorByClass(SubDescendant.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertEquals("Incorrect path field", classDescriptor
+					.getPathFieldDescriptor().getFieldName(), "path");
+			assertTrue("The subdescendant  class has no discriminator",
+					classDescriptor.hasDiscriminator());
+			assertNotNull("ancestorField is null in the descendant class",
+					classDescriptor.getFieldDescriptor("ancestorField"));
+			assertFalse("The subdescendant class is abstract", classDescriptor
+					.isAbstract());
+			assertNotNull("The subdescendant class has not an ancestor",
+					classDescriptor.getSuperClassDescriptor());
+			assertEquals("Invalid ancestor class for the descendant class",
+					classDescriptor.getSuperClassDescriptor().getClassName(),
+					"org.apache.jackrabbit.ocm.testmodel.inheritance.Descendant");
+			descendandDescriptors = classDescriptor
+					.getDescendantClassDescriptors();
+			assertEquals("Invalid number of descendants", descendandDescriptors
+					.size(), 0);
+			assertTrue(
+					"SubDescendant  class doesn't have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertFalse(
+					"SubDescendant class  have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerConcreteClassStrategy());
+
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 *
+	 * Test Node Type per concrete class  setting
+	 */	
+	public void testMapperNtConcreteClass() {
+		try {
+			Mapper mapper = getMapper();
+			
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(CmsObjectImpl.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertEquals("Incorrect path field", classDescriptor
+					.getPathFieldDescriptor().getFieldName(), "path");
+			assertFalse("The cms object class  has discriminator",
+					classDescriptor.hasDiscriminator());
+			assertTrue("The cmsobject class is not abstract", classDescriptor
+					.isAbstract());
+			assertNull("The cmsobject class has an ancestor", classDescriptor
+					.getSuperClassDescriptor());
+			assertFalse(
+					"The cmsobject class  have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertTrue(
+					"The cmsobject class  have not a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			assertTrue("The cmsobject class has no descendant ",
+					classDescriptor.hasDescendants());
+			assertEquals("Invalid number of descendants", classDescriptor
+					.getDescendantClassDescriptors().size(), 2);
+
+			classDescriptor = mapper.getClassDescriptorByClass(DocumentImpl.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertEquals("Incorrect path field", classDescriptor
+					.getPathFieldDescriptor().getFieldName(), "path");
+			assertFalse("The document class  has discriminator",
+					classDescriptor.hasDiscriminator());
+			assertFalse("The document class is abstract", classDescriptor
+					.isAbstract());
+			assertNotNull("The document class has not  an ancestor",
+					classDescriptor.getSuperClassDescriptor());
+			assertEquals("The document class has an invalid ancestor ancestor",
+					classDescriptor.getSuperClassDescriptor().getClassName(),
+					"org.apache.jackrabbit.ocm.testmodel.inheritance.impl.ContentImpl");
+			assertFalse(
+					"The document class  have a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertTrue(
+					"The document class  have not a node type per hierarchy strategy",
+					classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			assertFalse("The document class has no descendant ",
+					classDescriptor.hasDescendants());
+			assertEquals("Invalid number of descendants", classDescriptor
+					.getDescendantClassDescriptors().size(), 0);
+
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 * Test interface setting
+	 */
+	public void testInterfaceWithDiscriminator() {
+		try {
+			Mapper mapper = getMapper();
+			assertNotNull("Mapper is null", mapper);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(Interface.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertTrue("Interface is not an interface", classDescriptor.isInterface());
+			assertTrue("Interface  has not a discriminator", classDescriptor.hasDiscriminator());
+			String[] mixinTypes = classDescriptor.getJcrMixinTypes();
+			assertEquals("Invalid mixin type for the interface",mixinTypes.length , 0);
+			assertNull("The interface has an ancestor", classDescriptor.getSuperClassDescriptor());
+			assertTrue("The interface has not implementation/descendant", classDescriptor.hasDescendants());
+			Collection descendants = classDescriptor.getDescendantClassDescriptors();
+			assertEquals("Invalid number of implementation/descendants", descendants.size(), 1);
+			assertEquals("Invalid interface implementation",( (ClassDescriptor) descendants.iterator().next()).getClassName(), "org.apache.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant");
+			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertFalse("Incalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			
+			classDescriptor = mapper.getClassDescriptorByClass(AnotherDescendant.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertFalse("Interface is  an interface", classDescriptor.isInterface());
+			assertTrue("AnotherDescendant  has not a discriminator", classDescriptor.hasDiscriminator());
+			assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 1);
+			assertEquals("Invalid  interface name", classDescriptor.getImplements().iterator().next(), "org.apache.jackrabbit.ocm.testmodel.interfaces.Interface");
+			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			
+
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+	
+	/**
+	 * Test interface setting
+	 */
+	public void testInterfaceWithoutDiscriminator() 
+	{
+		try {
+			Mapper mapper = getMapper();
+			assertNotNull("Mapper is null", mapper);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(CmsObject.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertTrue("CmsObject is not an interface", classDescriptor.isInterface());
+			assertFalse("Interface  has a discriminator", classDescriptor.hasDiscriminator());
+			String[] mixinTypes = classDescriptor.getJcrMixinTypes();
+			assertEquals("Invalid mixin type for the interface",mixinTypes.length , 0);
+			assertNull("The interface has an ancestor", classDescriptor.getSuperClassDescriptor());
+			assertTrue("The interface has not implementation/descendant", classDescriptor.hasDescendants());
+			Collection descendants = classDescriptor.getDescendantClassDescriptors();
+			assertEquals("Invalid number of implementation/descendants", descendants.size(),3);			
+			assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			
+			
+			classDescriptor = mapper.getClassDescriptorByClass(Document.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertTrue("Document is not  an interface", classDescriptor.isInterface());
+			assertFalse("Document  has a discriminator", classDescriptor.hasDiscriminator());
+			assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 0);			
+			assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
+			descendants = classDescriptor.getDescendantClassDescriptors();			
+			assertEquals("Invalid number of implementation/descendants", descendants.size(),1);
+		
+
+			classDescriptor = mapper.getClassDescriptorByClass(DocumentImpl.class);
+			assertNotNull("Classdescriptor is null", classDescriptor);
+			assertFalse("DocumentImpl is  an interface", classDescriptor.isInterface());
+			assertFalse("DocumentImpl  has a discriminator", classDescriptor.hasDiscriminator());
+			assertTrue("DocumentImpl has not interface", classDescriptor.hasInterfaces());	
+			assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 1);				
+			assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
+			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
+      
+			
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
+	 * 
+	 * Test Node Type per concrete class setting
+	 */
+	public void testProxy() {
+		try {
+			Mapper mapper = getMapper();
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(Main.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid proxy setting for bean field proxyDetail ", classDescriptor.getBeanDescriptor("proxyDetail").isProxy());
+			assertFalse("Invalid proxy setting for bean field detail  ", classDescriptor.getBeanDescriptor("detail").isProxy());
+			assertTrue("Invalid proxy setting for collection field proxyDetail ", classDescriptor.getCollectionDescriptor("proxyCollection").isProxy());
+			
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+	
+	private Mapper getMapper() 
+	{
+		List<Class> classes = new ArrayList<Class>();
+		classes.add( org.apache.jackrabbit.ocm.testmodel.A.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.B.class);
+		classes.add( org.apache.jackrabbit.ocm.testmodel.C.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.PropertyTest.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.inheritance.Ancestor.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant.class);
+		classes.add( org.apache.jackrabbit.ocm.testmodel.inheritance.Descendant.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.inheritance.SubDescendant.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.inheritance.impl.CmsObjectImpl.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentImpl.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.interfaces.Document.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.interfaces.Interface.class);
+		classes.add(org.apache.jackrabbit.ocm.testmodel.proxy.Main.class);
+		
+		Mapper mapper = new AnnotationMapperImpl(classes);
+		return mapper;
+	}
+	
+}
\ No newline at end of file

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java Fri Oct 12 08:08:13 2007
@@ -44,7 +44,7 @@
 import org.apache.jackrabbit.ocm.testmodel.proxy.Main;
 
 /**
- * Test Mapper
+ * Test Digester Mapper
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AllTests.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AllTests.java Fri Oct 12 08:08:13 2007
@@ -36,7 +36,8 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.querymanager");
         //$JUnit-BEGIN$
-        suite.addTestSuite(QueryManagerTest.class);
+        suite.addTestSuite(AnnotationQueryManagerTest.class);
+        suite.addTestSuite(DigesterQueryManagerTest.class);
        
         
         //$JUnit-END$

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AnnotationQueryManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AnnotationQueryManagerTest.java?rev=584180&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AnnotationQueryManagerTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/AnnotationQueryManagerTest.java Fri Oct 12 08:08:13 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.querymanager;
+
+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.query.Filter;
+import org.apache.jackrabbit.ocm.query.Query;
+import org.apache.jackrabbit.ocm.query.QueryManager;
+import org.apache.jackrabbit.ocm.testmodel.C;
+
+
+/**
+ * Test QueryManagerImpl methods
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationQueryManagerTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationQueryManagerTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationQueryManagerTest(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(AnnotationQueryManagerTest.class));
+    }
+
+    public void testBuildExpression1()
+    {
+    	try
+    	{
+    	      QueryManager queryManager = this.getQueryManager();
+    	      Filter filter = queryManager.createFilter(C.class);
+    	      filter.addEqualTo("name", "a test value")
+                    .addEqualTo("id", new Integer(1));
+    	      filter.setScope("/test//");
+    	      
+    	      Query query = queryManager.createQuery(filter);
+    	      String jcrExpression = queryManager.buildJCRExpression(query);
+    	      assertNotNull("jcrExpression is null", jcrExpression);
+    	      assertTrue("Invalid JcrExpression", jcrExpression.equals("/jcr:root/test//element(*, ocm:C) [@ocm:name = 'a test value' and @ocm:id = 1]"));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+
+    public void testBuildExpression2()
+    {
+
+    	try
+    	{
+    	      QueryManager queryManager = this.getQueryManager();
+    	      Filter filter = queryManager.createFilter(C.class);
+    	      filter.addEqualTo("name", "a test value")
+    	            .addEqualTo("id", new Integer(1));
+    	      
+    	      Query query = queryManager.createQuery(filter);
+    	      String jcrExpression = queryManager.buildJCRExpression(query);
+    	      assertNotNull("jcrExpression is null", jcrExpression);
+    	      assertTrue("Invalid JcrExpression", jcrExpression.equals("//element(*, ocm:C) [@ocm:name = 'a test value' and @ocm:id = 1]"));
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+    
+
+}
\ No newline at end of file

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/DigesterQueryManagerTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/QueryManagerTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/DigesterQueryManagerTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/DigesterQueryManagerTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/QueryManagerTest.java&r1=580157&r2=584180&rev=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/QueryManagerTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/querymanager/DigesterQueryManagerTest.java Fri Oct 12 08:08:13 2007
@@ -32,17 +32,17 @@
 /**
  * Test QueryManagerImpl methods
  *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class QueryManagerTest extends DigesterTestBase
+public class DigesterQueryManagerTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(QueryManagerTest.class);
+    private final static Log log = LogFactory.getLog(DigesterQueryManagerTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public QueryManagerTest(String testName)  throws Exception
+    public DigesterQueryManagerTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -51,7 +51,7 @@
     {
         // All methods starting with "test" will be executed in the test suite.
         return new RepositoryLifecycleTestSetup(
-                new TestSuite(QueryManagerTest.class));
+                new TestSuite(DigesterQueryManagerTest.class));
     }
 
     public void testBuildExpression1()

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/A.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/A.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/A.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/A.java Fri Oct 12 08:08:13 2007
@@ -16,17 +16,21 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.uuid;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 
 /**
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  * @version $Id: Exp $
  */
+@Node(jcrMixinTypes="mix:referenceable")
 public class A
 {
-	private String path; 
-	private String uuid;
-    private String stringData;
+	@Field(path=true) private String path; 
+	@Field(uuid=true) private String uuid;
+    @Field private String stringData;
 
     
     public String getPath() 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Ancestor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Ancestor.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Ancestor.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Ancestor.java Fri Oct 12 08:08:13 2007
@@ -16,16 +16,20 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.uuid;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 
 /**
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  * @version $Id: Exp $
  */
+@Node(isAbstract=true, jcrMixinTypes="mix:referenceable")
 public class Ancestor
 {
-	private String path; 
-	private String uuid;
+	@Field(path=true) private String path; 
+	@Field(uuid=true) private String uuid;
     
     
     public String getPath() 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B.java Fri Oct 12 08:08:13 2007
@@ -16,7 +16,13 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.uuid;
 
-import java.util.Collection;
+
+
+import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.ReferenceTypeConverterImpl;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ReferenceCollectionConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 
 
 /**
@@ -24,11 +30,12 @@
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  * @version $Id: Exp $
  */
+@Node
 public class B
 {
-	private String path; 
-    private String reference2A; // This String attribute is mapped to a reference/uuid jcr property
-    private Collection multiReferences; // a collection of references (uuid)
+	@Field(path=true) private String path; 
+    @Field(converter=ReferenceTypeConverterImpl.class) private String reference2A; // This String attribute is mapped to a reference/uuid jcr property
+    @Collection(collectionConverter=ReferenceCollectionConverterImpl.class ) private java.util.Collection multiReferences; // a collection of references (uuid)
     
     public String getPath() 
     {
@@ -50,11 +57,11 @@
 		this.reference2A = reference2A;
 	}
 
-	public Collection getMultiReferences() {
+	public java.util.Collection getMultiReferences() {
 		return multiReferences;
 	}
 
-	public void setMultiReferences(Collection multiReferences) {
+	public void setMultiReferences(java.util.Collection multiReferences) {
 		this.multiReferences = multiReferences;
 	}
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B2.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B2.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B2.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/B2.java Fri Oct 12 08:08:13 2007
@@ -16,7 +16,12 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.uuid;
 
-import java.util.Collection;
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.ReferenceBeanConverterImpl;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.BeanReferenceCollectionConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 
 
 /**
@@ -24,11 +29,17 @@
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  * @version $Id: Exp $
  */
+@Node
 public class B2
 {
-	private String path; 
-    private A a; // This attribute is mapped to a reference jcr property
-    private Collection multiReferences; // a collection of bean (with an uuid) mapped into a list of jcr properties (reference type)
+	@Field(path=true) private String path; 
+    
+    // This attribute is mapped to a reference jcr property
+	@Bean(converter=ReferenceBeanConverterImpl.class) private A a; 
+    
+    //  a collection of bean mapped into a list of jcr properties (reference type)
+    @Collection (collectionConverter=BeanReferenceCollectionConverterImpl.class)
+    private java.util.Collection multiReferences; 
     
     public String getPath() 
     {
@@ -47,11 +58,11 @@
 	public void setA(A a) {
 		this.a = a;
 	}
-	public Collection getMultiReferences() {
+	public java.util.Collection getMultiReferences() {
 		return multiReferences;
 	}
 
-	public void setMultiReferences(Collection multiReferences) {
+	public void setMultiReferences(java.util.Collection multiReferences) {
 		this.multiReferences = multiReferences;
 	}
     

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Descendant.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Descendant.java?rev=584180&r1=584179&r2=584180&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Descendant.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/uuid/Descendant.java Fri Oct 12 08:08:13 2007
@@ -16,16 +16,20 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.uuid;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 
 /**
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  * @version $Id: Exp $
  */
+@Node(extend=Ancestor.class, jcrMixinTypes="mix:referenceable") 	                  
 public class Descendant extends Ancestor
 {
 
-    private String stringData;
+    @Field private String stringData;
 
     
 	public String getStringData() {



Mime
View raw message