jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r583628 [2/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
Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterInterfaceHierarchyTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceHierarchyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterInterfaceHierarchyTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterInterfaceHierarchyTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/ObjectContentManagerInterfaceHierarchyTest.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/ObjectContentManagerInterfaceHierarchyTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/interfaces/DigesterInterfaceHierarchyTest.java Wed Oct 10 14:48:46 2007
@@ -41,14 +41,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerInterfaceHierarchyTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerInterfaceHierarchyTest.class);
+public class DigesterInterfaceHierarchyTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterInterfaceHierarchyTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerInterfaceHierarchyTest(String testName) throws Exception {
+	public DigesterInterfaceHierarchyTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -56,7 +56,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerInterfaceHierarchyTest.class));
+				DigesterInterfaceHierarchyTest.class));
 	}
 
 	public void tearDown() throws Exception {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/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/jcrnodetype/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/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.jcrnodetype");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerJcrNodeTypeTest.class);                
-        suite.addTestSuite(ObjectContentManagerJcrPropertyTest.class);
+        suite.addTestSuite(AnnotationJcrNodeTypeTest.class);
+        suite.addTestSuite(DigesterJcrNodeTypeTest.class);                
+        suite.addTestSuite(AnnotationJcrPropertyTest.class);
+        suite.addTestSuite(DigesterJcrPropertyTest.class);
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrNodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrNodeTypeTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrNodeTypeTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrNodeTypeTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,111 @@
+/*
+ * 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.jcrnodetype;
+
+import java.io.ByteArrayInputStream;
+import java.util.Calendar;
+
+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.File;
+import org.apache.jackrabbit.ocm.testmodel.Folder;
+import org.apache.jackrabbit.ocm.testmodel.Resource;
+
+/**
+ * Test inheritance with node type per concrete class (without  discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationJcrNodeTypeTest extends AnnotationTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationJcrNodeTypeTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationJcrNodeTypeTest(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(
+				AnnotationJcrNodeTypeTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+
+	public void testRetrieveSingleton() 
+	{
+
+		try 
+		{
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Insert a  folder (class mapped to jcr:folder) with one file (class mapped to jcr:file)
+			//---------------------------------------------------------------------------------------------------------			
+            Resource resource = new Resource();
+            resource.setData(new ByteArrayInputStream("this is the content".getBytes()));            
+            resource.setLastModified(Calendar.getInstance());
+            resource.setMimeType("plain/text");
+            File file = new File();    
+            file.setResource(resource);
+            
+            
+            Folder folder = new Folder();
+            folder.setPath("/folder1");
+            folder.addChild(file);
+            
+            ocm.insert(folder);            
+			ocm.save();
+			
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve a document object
+			//---------------------------------------------------------------------------------------------------------						
+			folder = (Folder) ocm.getObject( "/folder1");
+			assertNotNull("folder is null", folder);
+			System.out.println("Folder creation date : " + folder.getCreationDate());
+			assertTrue("Invalid number of children", folder.getChildren().size() == 1);
+			file = (File) folder.getChildren().iterator().next();
+			assertNotNull("resource is null", file.getResource());	
+			System.out.println("File resource calendar: " + file.getResource().getLastModified());	// The prop is autocreated
+			
+			
+		}
+		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/jcrnodetype/AnnotationJcrPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrPropertyTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrPropertyTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/AnnotationJcrPropertyTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,165 @@
+/*
+ * 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.jcrnodetype;
+
+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.PropertyTest;
+
+/**
+ * Test inheritance with node type per concrete class (without  discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationJcrPropertyTest extends AnnotationTestBase 
+{
+	private final static Log log = LogFactory.getLog(AnnotationJcrPropertyTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationJcrPropertyTest(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(AnnotationJcrPropertyTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+
+	public void testRequiredProperty() 
+	{
+
+		try 
+		{
+			ObjectContentManager ocm = this.getObjectContentManager();
+			//---------------------------------------------------------------------------------------------------------
+			// Insert without the mandatory field
+			//---------------------------------------------------------------------------------------------------------			
+			
+            PropertyTest propertyTest = new PropertyTest();
+            propertyTest.setPath("/test");
+            propertyTest.setRequiredProp("requiredPropValue");
+            propertyTest.setRequiredWithConstraintsProp("abc");
+            
+            try 
+            {
+                 ocm.insert(propertyTest);
+                 fail("Incorrect insert operation - the mandatory fields have no value");
+            }
+            catch(Exception e)
+            {
+               // Normal behaviour 	
+            	ocm.refresh(false);
+            }
+            
+			//---------------------------------------------------------------------------------------------------------
+			// Insert with the mandatory fields
+			//---------------------------------------------------------------------------------------------------------			
+            propertyTest.setMandatoryProp("mandatoryValue");
+            propertyTest.setMandatoryWithConstaintsProp("xx");
+            ocm.insert(propertyTest);
+            ocm.save();
+            
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve
+			//---------------------------------------------------------------------------------------------------------			
+            propertyTest = (PropertyTest) ocm.getObject("/test");
+            assertTrue("Invalid required property", propertyTest.getRequiredProp().equals("requiredPropValue"));
+            assertTrue("Invalid required property with constraints", propertyTest.getRequiredWithConstraintsProp().equals("abc"));            
+            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedProp().equals("aaa")); 
+            assertTrue("Invalid autocreated property", propertyTest.getAutoCreatedWithConstraintsProp().equals("ccc"));
+            assertTrue("Invalid protected property", propertyTest.getProtectedWithDefaultValueProp().equals("protectedValue"));
+            
+            //---------------------------------------------------------------------------------------------------------
+			// update the property requiredWithConstraintsProp with bad value
+			//---------------------------------------------------------------------------------------------------------			
+            propertyTest = (PropertyTest) ocm.getObject("/test");
+            propertyTest.setRequiredWithConstraintsProp("invalid value");
+            try 
+            {
+            	ocm.update(propertyTest);
+            	ocm.save();
+            	fail("Invalid value was accepted for requiredWithConstraintsProp");
+            }
+            catch(Exception e)
+            {                	
+               // Do nothing - normal behaviour, the value               	
+            }
+            
+            //---------------------------------------------------------------------------------------------------------
+			// update the property AutoCreatedWithConstraintsProp with bad value
+			//---------------------------------------------------------------------------------------------------------			
+            propertyTest = (PropertyTest) ocm.getObject("/test");
+            propertyTest.setAutoCreatedWithConstraintsProp("invalid value");
+            try 
+            {
+            	ocm.update(propertyTest);
+            	ocm.save();
+            	fail("Invalid value was accepted for autoCreatedWithConstraintsProp ");
+            }
+            catch(Exception e)
+            {             	
+               // Do nothing - normal behaviour, the value is not valid
+               	
+            }
+            
+            //---------------------------------------------------------------------------------------------------------
+			// update the property mandatoryWithConstaintsProp with bad value
+			//---------------------------------------------------------------------------------------------------------			
+            propertyTest = (PropertyTest) ocm.getObject("/test");
+            propertyTest.setMandatoryWithConstaintsProp("yy");
+            try 
+            {
+            	ocm.update(propertyTest);
+            	ocm.save();
+            	fail("Invalid value was accepted for mandatoryWithConstaintsProp");
+            }
+            catch(Exception e)
+            {                	
+                e.printStackTrace();
+            }            
+			
+			
+		}
+		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/jcrnodetype/DigesterJcrNodeTypeTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrNodeTypeTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrNodeTypeTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrNodeTypeTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrNodeTypeTest.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/jcrnodetype/ObjectContentManagerJcrNodeTypeTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrNodeTypeTest.java Wed Oct 10 14:48:46 2007
@@ -37,14 +37,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerJcrNodeTypeTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerJcrNodeTypeTest.class);
+public class DigesterJcrNodeTypeTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterJcrNodeTypeTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerJcrNodeTypeTest(String testName) throws Exception {
+	public DigesterJcrNodeTypeTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -52,7 +52,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerJcrNodeTypeTest.class));
+				DigesterJcrNodeTypeTest.class));
 	}
 
 	public void tearDown() throws Exception {

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrPropertyTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrPropertyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrPropertyTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrPropertyTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/ObjectContentManagerJcrPropertyTest.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/jcrnodetype/ObjectContentManagerJcrPropertyTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/jcrnodetype/DigesterJcrPropertyTest.java Wed Oct 10 14:48:46 2007
@@ -31,21 +31,21 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerJcrPropertyTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerJcrPropertyTest.class);
+public class DigesterJcrPropertyTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterJcrPropertyTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerJcrPropertyTest(String testName) throws Exception {
+	public DigesterJcrPropertyTest(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(ObjectContentManagerJcrPropertyTest.class));
+		return new RepositoryLifecycleTestSetup(new TestSuite(DigesterJcrPropertyTest.class));
 	}
 
 	public void tearDown() throws Exception {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/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/lock/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AllTests.java Wed Oct 10 14:48:46 2007
@@ -36,7 +36,8 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.basic");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerLockTest.class);
+        suite.addTestSuite(DigesterLockTest.class);
+        suite.addTestSuite(AnnotationLockTest.class);
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AnnotationLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AnnotationLockTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AnnotationLockTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/AnnotationLockTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,258 @@
+/*
+ * 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.lock;
+
+import java.util.ArrayList;
+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.lock.Lock;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+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.Lockable;
+
+/**
+ * Test object content Manager lock feature
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationLockTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationLockTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationLockTest(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(AnnotationLockTest.class));
+    }
+
+
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	if (getObjectContentManager().objectExists("/test"))
+    	{
+    	   getObjectContentManager().remove("/test");
+    	   getObjectContentManager().save();
+    	}
+        super.tearDown();
+    }
+    
+    public void testBasicLock()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+            A a = new A();
+            a.setPath("/test");
+            a.setA1("a1");
+            a.setA2("a2");
+            B b = new B();
+            b.setB1("b1");
+            b.setB2("b2");
+            a.setB(b);
+            
+            C c1 = new C();
+            c1.setId("first");
+            c1.setName("First Element");
+            C c2 = new C();
+            c2.setId("second");
+            c2.setName("Second Element");
+            
+            C c3 = new C();
+            c3.setId("third");
+            c3.setName("Third Element");
+            
+            
+            Collection collection = new ArrayList();
+            collection.add(c1);
+            collection.add(c2);
+            collection.add(c3);
+            
+            a.setCollection(collection);
+            
+            ocm.insert(a);
+            ocm.save();
+            
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject( "/test");
+            assertNotNull("a is null", a);
+            
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertFalse("the object is locked", ocm.isLocked("/test"));
+            
+            // --------------------------------------------------------------------------------
+            // Lock the object
+            // --------------------------------------------------------------------------------           
+            
+            Lock lock = ocm.lock("/test", true, false);
+            assertTrue("the Lock owner is not correct", lock.getLockOwner().equals("superuser"));
+            
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertTrue("the object is not locked", ocm.isLocked("/test"));
+            
+            // --------------------------------------------------------------------------------
+            // Unlock the object
+            // --------------------------------------------------------------------------------           
+            ocm.unlock("/test", lock.getLockToken());
+
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertFalse("the object is locked", ocm.isLocked("/test"));
+
+            // --------------------------------------------------------------------------------
+            // Lock & update 
+            // --------------------------------------------------------------------------------
+            lock = ocm.lock("/test", true, false);
+            a = (A) ocm.getObject("/test");
+            a.setA1("new a1 Value");
+            ocm.update(a);
+            ocm.save();
+            ocm.unlock("/test", lock.getLockToken());
+            
+            
+            // --------------------------------------------------------------------------------
+            // Remove the object
+            // --------------------------------------------------------------------------------           
+            ocm.remove(a);
+            ocm.save();
+            
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }        
+
+    /**
+     *  Lock object which is assigned to a custome node type. This jcr node type inherits from mix:lockable
+     *
+     */
+    public void testLockWithNodeType()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+
+            // --------------------------------------------------------------------------------
+            // Create an object which is associated to the 
+            // --------------------------------------------------------------------------------
+            Lockable lockable = new Lockable();
+            lockable.setPath("/test");
+            lockable.setA1("a1");
+            lockable.setA2("a2");
+            ocm.insert(lockable);
+            ocm.save();
+            
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            lockable = (Lockable) ocm.getObject("/test");
+            assertNotNull("a is null", lockable);
+            
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertFalse("the object is locked", ocm.isLocked("/test"));
+            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
+            // --------------------------------------------------------------------------------
+            // Lock the object
+            // --------------------------------------------------------------------------------                       
+            Lock lock = ocm.lock("/test", true, false);
+            
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertTrue("the object is not locked", ocm.isLocked("/test"));
+            
+            // --------------------------------------------------------------------------------
+            // Unlock the object
+            // --------------------------------------------------------------------------------           
+            ocm.unlock("/test", lock.getLockToken());
+
+            // --------------------------------------------------------------------------------
+            // Check if the object is locked
+            // --------------------------------------------------------------------------------
+            assertFalse("the object is locked", ocm.isLocked("/test"));
+
+
+            // --------------------------------------------------------------------------------
+            // Lock & update 
+            // --------------------------------------------------------------------------------
+            lock = ocm.lock("/test", true, false);
+            assertTrue("the object is not locked", ocm.isLocked("/test"));
+            lockable = (Lockable) ocm.getObject("/test");
+            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
+            lockable.setA1("new a1 Value");
+            ocm.update(lockable);
+            ocm.save();
+            ocm.unlock("/test", lock.getLockToken());
+            
+            
+            // --------------------------------------------------------------------------------
+            // Remove the object
+            // --------------------------------------------------------------------------------           
+            ocm.remove(lockable);
+            ocm.save();
+            
+        }
+        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/manager/lock/DigesterLockTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/ObjectContentManagerLockTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/DigesterLockTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/DigesterLockTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/ObjectContentManagerLockTest.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/lock/ObjectContentManagerLockTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/lock/DigesterLockTest.java Wed Oct 10 14:48:46 2007
@@ -38,15 +38,15 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerLockTest extends DigesterTestBase
+public class DigesterLockTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(ObjectContentManagerLockTest.class);
+    private final static Log log = LogFactory.getLog(DigesterLockTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public ObjectContentManagerLockTest(String testName)  throws Exception
+    public DigesterLockTest(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(ObjectContentManagerLockTest.class));
+                new TestSuite(DigesterLockTest.class));
     }
 
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/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/proxy/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AllTests.java Wed Oct 10 14:48:46 2007
@@ -36,7 +36,7 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.proxy");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ProxyTest.class);
+        suite.addTestSuite(DigesterProxyTest.class);
         
         //$JUnit-END$
 

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AnnotationProxyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AnnotationProxyTest.java?rev=583628&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AnnotationProxyTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/AnnotationProxyTest.java Wed Oct 10 14:48:46 2007
@@ -0,0 +1,286 @@
+/*
+ * 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.proxy;
+
+import java.util.ArrayList;
+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.testmodel.proxy.Detail;
+import org.apache.jackrabbit.ocm.testmodel.proxy.Main;
+import org.apache.jackrabbit.ocm.testmodel.proxy.NTDetail;
+import org.apache.jackrabbit.ocm.testmodel.proxy.NTMain;
+
+/**
+ * Test inheritance with node type per concrete class (without  discreminator field)
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationProxyTest extends AnnotationTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationProxyTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationProxyTest(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(
+				AnnotationProxyTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+	public void testBeanProxy() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			Detail detail = new Detail();
+			detail.setField("FieldValue");			
+			
+			Detail proxyDetail = new Detail();
+			proxyDetail.setField("ProxyFieldValue");
+			
+			Main main = new Main();
+			main.setPath("/test");
+			main.setDetail(detail);
+			main.setProxyDetail(proxyDetail);
+							
+            ocm.insert(main);
+			ocm.save();
+			
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (Main) ocm.getObject( "/test");
+			assertNotNull("detail is null", main.getDetail());
+			assertTrue("Invalid detail bean", main.getDetail().getField().equals("FieldValue"));
+
+			assertNotNull("proxydetail is null", main.getProxyDetail());
+			Object proxyObject = main.getProxyDetail();
+			assertTrue("Invalid class specify for the proxy bean", proxyObject  instanceof Detail);
+			assertTrue("Invalid proxy detail bean",proxyDetail .getField().equals("ProxyFieldValue"));
+			
+			Detail nullDetail = main.getNullDetail();
+			assertNull("nulldetail is not  null",nullDetail );
+
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Update  
+			//---------------------------------------------------------------------------------------------------------						
+			 detail = new Detail();
+			detail.setField("AnotherFieldValue");			
+			
+			proxyDetail = new Detail();
+			proxyDetail.setField("AnotherProxyFieldValue");
+			
+			main.setDetail(detail);
+			main.setProxyDetail(proxyDetail);
+			
+			ocm.update(main);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (Main) ocm.getObject( "/test");
+			assertNotNull("detail is null", main.getDetail());
+			assertTrue("Invalid detail bean", main.getDetail().getField().equals("AnotherFieldValue"));
+
+			assertNotNull("proxydetail is null", main.getProxyDetail());
+			proxyObject = main.getProxyDetail();
+			assertTrue("Invalid class specify for the proxy bean", proxyObject  instanceof Detail);
+			assertTrue("Invalid proxy detail bean",proxyDetail .getField().equals("AnotherProxyFieldValue"));
+						
+			assertNull("nulldetail is not  null",main.getNullDetail());
+				
+			//---------------------------------------------------------------------------------------------------------
+			// Delete the main object
+			//---------------------------------------------------------------------------------------------------------						
+			ocm.remove("/test");
+			ocm.save();
+	
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+		
+	}
+	
+	public void testDefaultCollectionConverterWithProxy() {
+
+		try {
+			ObjectContentManager ocm = this.getObjectContentManager();
+
+			ArrayList  details= new ArrayList();
+			for(int i=1; i<=100;i++)
+			{
+				Detail detail = new Detail();
+				detail.setField("field" + i);				
+				details.add(detail);
+			}
+			
+			Main main = new Main();
+			main.setProxyCollection(details);
+			main.setPath("/test");							
+            ocm.insert(main);
+			ocm.save();
+			
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (Main) ocm.getObject( "/test");
+			assertNotNull("main is null", main);
+
+            Collection result = main.getProxyCollection();
+            assertEquals("Invalide size", result.size(), 100);
+            assertNull("nullcollectionproxy  is not null", main.getNullProxyCollection());
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Update  
+			//---------------------------------------------------------------------------------------------------------
+            
+            Detail detail = new Detail();
+			detail.setField("newFieldValue");			
+			result.add(detail);
+			main.setProxyCollection(result);
+			ocm.update(main);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (Main) ocm.getObject("/test");
+			assertNotNull("main  is null", main);
+            assertEquals("Invalide size",main.getProxyCollection().size(), 101);
+            assertNull("nullcollectionproxy  is not null", main.getNullProxyCollection());
+
+            //---------------------------------------------------------------------------------------------------------
+			// Delete the main object
+			//---------------------------------------------------------------------------------------------------------						
+			ocm.remove("/test");
+			ocm.save();            
+	
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail();
+		}
+
+		
+	}
+
+
+	public void testNTCollectionconverterWithProxy() {
+
+		try {
+
+			ObjectContentManager ocm = this.getObjectContentManager();			
+			
+			NTMain main = new NTMain();
+			main.setPath("/test");							
+            ocm.insert(main);
+			ocm.save();
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (NTMain) ocm.getObject( "/test");
+			assertNotNull("main is null", main);
+
+            Collection result = main.getProxyCollection();
+            assertNull("Collection is not null", result);
+            			
+			//---------------------------------------------------------------------------------------------------------
+			// Update  
+			//---------------------------------------------------------------------------------------------------------
+			ArrayList  details= new ArrayList();
+			for(int i=1; i<=100;i++)
+			{
+				NTDetail detail = new NTDetail();
+				detail.setField("field" + i);				
+				details.add(detail);
+			}
+			main.setProxyCollection(details);
+			ocm.update(main);
+			ocm.save();
+            
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (NTMain) ocm.getObject( "/test");
+			assertNotNull("main is null", main);
+
+            result = main.getProxyCollection();
+            assertEquals("Invalide size", result.size(), 100);
+            
+			
+			//---------------------------------------------------------------------------------------------------------
+			// Update  
+			//---------------------------------------------------------------------------------------------------------            
+            NTDetail detail = new NTDetail();
+			detail.setField("newFieldValue");			
+			result.add(detail);
+			main.setProxyCollection(result);
+			ocm.update(main);
+			ocm.save();
+
+			//---------------------------------------------------------------------------------------------------------
+			// Retrieve the main object
+			//---------------------------------------------------------------------------------------------------------						
+			main = (NTMain) ocm.getObject("/test");
+			assertNotNull("main  is null", main);
+            assertEquals("Invalide size",main.getProxyCollection().size(), 101);
+            
+
+            //---------------------------------------------------------------------------------------------------------
+			// Delete the main object
+			//---------------------------------------------------------------------------------------------------------						
+			ocm.remove("/test");
+			ocm.save();            
+	
+		} 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/proxy/DigesterProxyTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/ProxyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/DigesterProxyTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/DigesterProxyTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/ProxyTest.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/proxy/ProxyTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/proxy/DigesterProxyTest.java Wed Oct 10 14:48:46 2007
@@ -37,14 +37,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ProxyTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ProxyTest.class);
+public class DigesterProxyTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterProxyTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ProxyTest(String testName) throws Exception {
+	public DigesterProxyTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -52,7 +52,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ProxyTest.class));
+				DigesterProxyTest.class));
 	}
 
 	public void tearDown() throws Exception {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/File.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/File.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/File.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/File.java Wed Oct 10 14:48:46 2007
@@ -16,17 +16,20 @@
  */
 package org.apache.jackrabbit.ocm.testmodel;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 /**
  * Java class used to map the jcr node type nt:file
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  *
  */
+@Node(jcrType="nt:file", extend=HierarchyNode.class)
 public class File  extends HierarchyNode
 {
 
-    private Resource resource;
-    private String path;
-
+    @Bean(jcrName="jcr:content") private Resource resource;
+    
 	public Resource getResource() 
 	{
 		return resource;
@@ -37,16 +40,5 @@
 		this.resource = resource;
 	}
 
-	public String getPath() 
-	{
-		return path;
-	}
-
-	public void setPath(String path) 
-	{
-		this.path = path;
-	}
-
-	
     
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Folder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Folder.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Folder.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Folder.java Wed Oct 10 14:48:46 2007
@@ -17,36 +17,29 @@
 package org.apache.jackrabbit.ocm.testmodel;
 
 import java.util.ArrayList;
-import java.util.Collection;
+
+
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 /**
  * Java class used to map the jcr node type nt:folder
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  *
  */
+@Node(jcrType="nt:folder", extend=HierarchyNode.class )
 public class Folder extends HierarchyNode
 {
-    private String path;
-    
-    private Collection children;   // = a collection of HierarchyNodes 
-
-    
-	public String getPath() 
-	{
-		return path;
-	}
-
-	public void setPath(String path) 
-	{
-		this.path = path;
-	}
-
+    @Collection(autoUpdate=false, elementClassName=HierarchyNode.class , collectionConverter=NTCollectionConverterImpl.class)
+    private java.util.Collection children; 
+   
 
-	public Collection getChildren() 
+	public java.util.Collection getChildren() 
 	{
 		return children;
 	}
 
-	public void setChildren(Collection children) 
+	public void setChildren(java.util.Collection children) 
 	{
 		this.children = children;
 	}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/HierarchyNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/HierarchyNode.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/HierarchyNode.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/HierarchyNode.java Wed Oct 10 14:48:46 2007
@@ -18,14 +18,30 @@
 
 import java.util.Calendar;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 /**
  * Java class used to map the jcr node type nt:hierarchyNode
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  *
  */
+@Node(jcrType="nt:hierarchyNode")
 public class HierarchyNode
 {	
-	private Calendar creationDate;
+	@Field(path=true) private String path;
+	@Field(jcrName="jcr:created") private Calendar creationDate;
+	
+	
+	public String getPath() 
+	{
+		return path;
+	}
+
+	public void setPath(String path) 
+	{
+		this.path = path;
+	}
 	
 	public Calendar getCreationDate() 
 	{

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Lockable.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Lockable.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Lockable.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Lockable.java Wed Oct 10 14:48:46 2007
@@ -16,18 +16,22 @@
  */
 package org.apache.jackrabbit.ocm.testmodel;
 
+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>
  * 
  */
+@Node(jcrType="ocm:TestLockable") 
 public class Lockable
 {
-	private String path; 
-    private String a1;
-    private String a2;
-    private String lockOwner;
+	@Field(path=true) private String path; 
+    @Field(jcrName="ocm:a1") private String a1;
+    @Field(jcrName="ocm:a2") private String a2;
+    @Field(jcrName="jcr:lockOwner") private String lockOwner;
     
     
     public String getPath() {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/PropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/PropertyTest.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/PropertyTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/PropertyTest.java Wed Oct 10 14:48:46 2007
@@ -16,24 +16,26 @@
  */
 package org.apache.jackrabbit.ocm.testmodel;
 
+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>
  * 
  */
+@Node(jcrType="ocm:propertytest")
 public class PropertyTest
 {
-	private String path;
-	private String requiredProp;
-	private String requiredWithConstraintsProp;
-	private String autoCreatedProp;
-	private String autoCreatedWithConstraintsProp;
-	private String mandatoryProp;
-	private String mandatoryWithConstaintsProp; 
-	private String protectedWithDefaultValueProp;
-	
-	
+	@Field(path=true) private String path;
+	@Field(jcrName="ocm:requiredProp") private String requiredProp;
+	@Field(jcrName="ocm:requiredWithConstraintsProp", jcrValueConstraints="abc,def,ghi") private String requiredWithConstraintsProp;
+	@Field(jcrName="ocm:autoCreatedProp", jcrDefaultValue="aaa") private String autoCreatedProp;
+	@Field(jcrName="ocm:autoCreatedWithConstraintsProp", jcrDefaultValue="ccc", jcrValueConstraints="bbb,ccc,ddd") private String autoCreatedWithConstraintsProp;
+	@Field(jcrName="ocm:mandatoryProp", jcrMandatory=true) private String mandatoryProp;
+	@Field(jcrName="ocm:mandatoryWithConstaintsProp", jcrMandatory=true, jcrValueConstraints="xx,yy") private String mandatoryWithConstaintsProp; 
+	@Field(jcrName="ocm:protectedWithDefaultValueProp", jcrProtected=true) private String protectedWithDefaultValueProp;
 	
 	public String getPath() {
 		return path;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Resource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Resource.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Resource.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Resource.java Wed Oct 10 14:48:46 2007
@@ -23,13 +23,17 @@
  * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
  *
  */
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(jcrType="nt:resource")
 public class Resource
 {
 
-    private String mimeType;
-    private String encoding;
-    private InputStream data;
-    private Calendar lastModified;
+    @Field( jcrName="jcr:mimeType") private String mimeType;    
+    @Field( jcrName="jcr:data") private InputStream data;
+    @Field( jcrName="jcr:lastModified") private Calendar lastModified;
     
     public InputStream getData()
     {
@@ -39,14 +43,7 @@
     {
         this.data = data;
     }
-    public String getEncoding()
-    {
-        return encoding;
-    }
-    public void setEncoding(String encoding)
-    {
-        this.encoding = encoding;
-    }
+
     public Calendar getLastModified()
     {
         return lastModified;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Ancestor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Ancestor.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Ancestor.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Ancestor.java Wed Oct 10 14:48:46 2007
@@ -16,10 +16,14 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isAbstract=true)
 public class Ancestor
 {
-	protected String path;
-	protected String ancestorField;
+	@Field(path=true)protected String path;
+	@Field protected String ancestorField;
 	protected String discriminator;
 	
 	public String getPath() {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/AnotherDescendant.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/AnotherDescendant.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/AnotherDescendant.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/AnotherDescendant.java Wed Oct 10 14:48:46 2007
@@ -16,11 +16,17 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.Interface;
 
-public class AnotherDescendant extends Ancestor implements Interface{
+@Node(extend=Ancestor.class)
+@Implement(interfaceName=Interface.class)
+public class AnotherDescendant extends Ancestor implements Interface
+{
 
-	protected String anotherDescendantField;
+	@Field protected String anotherDescendantField;
 
 	public String getAnotherDescendantField() {
 		return anotherDescendantField;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Descendant.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Descendant.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Descendant.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/Descendant.java Wed Oct 10 14:48:46 2007
@@ -16,12 +16,17 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.AnotherInterface;
 
+@Node(extend=Ancestor.class)
+@Implement(interfaceName=AnotherInterface.class)
 public class Descendant extends Ancestor implements AnotherInterface {
 
-	protected String descendantField;
-	protected int intField;
+	@Field protected String descendantField;
+	@Field protected int intField;
 	
 
 	public String getDescendantField() {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/SubDescendant.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/SubDescendant.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/SubDescendant.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/SubDescendant.java Wed Oct 10 14:48:46 2007
@@ -16,9 +16,15 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+
+@Node(extend=Descendant.class)
+
 public class SubDescendant extends Descendant {
 
-	protected String subDescendantField;
+	@Field protected String subDescendantField;
 
 	public String getSubDescendantField() {
 		return subDescendantField;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/CmsObjectImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/CmsObjectImpl.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/CmsObjectImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/CmsObjectImpl.java Wed Oct 10 14:48:46 2007
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance.impl;
 
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.ParentBeanConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.Folder;
 
@@ -28,13 +33,14 @@
  * 
  * 
  */
+@Node(jcrType="ocm:cmsobjectimpl", discriminator=false, isAbstract=true)
+@Implement(interfaceName=CmsObject.class)
 public class CmsObjectImpl implements CmsObject
 {
     
-    protected String path;        
-    protected String name;
-    protected Folder parentFolder;
-    
+    @Field(path=true) protected String path;        
+    @Field(jcrName="ocm:name", id=true) protected String name;
+    @Bean(converter=ParentBeanConverterImpl.class) protected Folder parentFolder;
 
     /**
      * 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/ContentImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/ContentImpl.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/ContentImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/ContentImpl.java Wed Oct 10 14:48:46 2007
@@ -16,18 +16,18 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance.impl;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.Content;
 
-
-
-
-
 /**
  * Content object
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * 
  */
+@Node(jcrType="ocm:contentimpl", isAbstract=true, extend=CmsObjectImpl.class, discriminator=false )
+@Implement(interfaceName=Content.class)
 public abstract class ContentImpl  extends CmsObjectImpl implements Content
 {
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentExtImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentExtImpl.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentExtImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentExtImpl.java Wed Oct 10 14:48:46 2007
@@ -14,12 +14,16 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.inheritance.impl;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
 /**
  * Simple extension to the DocumentImpl class
  */
+@Node(jcrType="ocm:documentextimpl", extend=DocumentImpl.class, discriminator=false)
 public class DocumentExtImpl extends DocumentImpl {
 
-    private String extInfo;
+    @Field(jcrName="ocm:extinfo") private String extInfo;
 
     public String getExtInfo() {
         return extInfo;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentImpl.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentImpl.java Wed Oct 10 14:48:46 2007
@@ -19,6 +19,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.Document;
 
 /**
@@ -27,14 +31,16 @@
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  * 
  */
+@Node(jcrType="ocm:documentimpl", extend=ContentImpl.class, discriminator=false)
+@Implement(interfaceName=Document.class)
 public class DocumentImpl extends ContentImpl implements Document
 {
     protected final static Log log =  LogFactory.getLog(DocumentImpl.class);
     
-    protected long size;
-    protected String contentType;   
+    @Field(jcrName="ocm:size") protected long size;
+    @Field(jcrName="ocm:contenttype") protected String contentType;   
         
-    protected DocumentStream documentStream;
+    @Bean(jcrName="ocm:documentstream", proxy=true) protected DocumentStream documentStream;
 
 
     /**

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentStream.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentStream.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/DocumentStream.java Wed Oct 10 14:48:46 2007
@@ -22,24 +22,27 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 
 
 
 /**
- * Content object
+ * Document Steam
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  * 
  */
+@Node(jcrType="ocm:documentstream", discriminator=false)
 public class DocumentStream 
 {
     protected final static Log log = LogFactory.getLog(DocumentStream.class);
       
-    protected byte[] content;
+    @Field(jcrName="ocm:binarycontent") protected byte[] content;
     
-    protected String encoding;
+    @Field(jcrName="ocm:encoding") protected String encoding;
     
-    protected String path;
+    @Field(path=true) protected String path;
 
 
     /**

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/FolderImpl.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/FolderImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/inheritance/impl/FolderImpl.java Wed Oct 10 14:48:46 2007
@@ -19,22 +19,27 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject;
 import org.apache.jackrabbit.ocm.testmodel.interfaces.Folder;
 
-
-
-
 /**
  * CMS Folder Test
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * @version $Id: Folder.java,v 1.1 2004/12/22 20:36:59 christophe Exp $
- */
+ */	                                    
+@Node(jcrType="ocm:folderimpl" , extend=CmsObjectImpl.class, discriminator=false)
+@Implement(interfaceName=Folder.class)
 public class FolderImpl extends CmsObjectImpl implements Folder 
 {
-
-    protected List children = new ArrayList();
+        
+	@Collection(proxy=true,  
+			  elementClassName=CmsObjectImpl.class, collectionConverter=NTCollectionConverterImpl.class)
+	protected List children = new ArrayList();
 
 	/**
 	 * 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/AnotherInterface.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/AnotherInterface.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/AnotherInterface.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/AnotherInterface.java Wed Oct 10 14:48:46 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.interfaces;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true)
 public interface AnotherInterface
 {
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/CmsObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/CmsObject.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/CmsObject.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/CmsObject.java Wed Oct 10 14:48:46 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.interfaces;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true, jcrType="ocm:cmsobject", discriminator=false )
 public interface CmsObject {
 
 	public String getName();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Content.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Content.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Content.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Content.java Wed Oct 10 14:48:46 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.interfaces;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true, extend= CmsObject.class, jcrType="ocm:content", discriminator=false )
 public interface Content extends CmsObject {
 
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Document.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Document.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Document.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Document.java Wed Oct 10 14:48:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.interfaces;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.inheritance.impl.DocumentStream;
 
+@Node(isInterface=true, extend= Content.class, jcrType="ocm:document", discriminator=false )
 public interface Document extends Content {
 
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Folder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Folder.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Folder.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Folder.java Wed Oct 10 14:48:46 2007
@@ -18,6 +18,9 @@
 
 import java.util.List;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true, extend= CmsObject.class, jcrType="ocm:folder", discriminator=false )
 public interface Folder  extends CmsObject{
 
 	public List getChildren();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Interface.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Interface.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Interface.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/interfaces/Interface.java Wed Oct 10 14:48:46 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.interfaces;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true)
 public interface Interface
 {
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Detail.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Detail.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Detail.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Detail.java Wed Oct 10 14:48:46 2007
@@ -16,10 +16,14 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.proxy;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node
 public class Detail 
 {
-    private String path;
-	private String field;
+    @Field(path=true) private String path;
+	@Field private String field;
 
     
 	public String getPath() {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Main.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Main.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/Main.java Wed Oct 10 14:48:46 2007
@@ -16,17 +16,23 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.proxy;
 
-import java.util.Collection;
 
+
+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;
+
+@Node
 public class Main 
 {
 
-	private String path;
-	private Detail proxyDetail;
-	private Detail nullDetail; 
-    private Detail detail;
-    private Collection proxyCollection;
-    private Collection nullProxyCollection;
+	@Field(path=true) private String path;
+	@Bean(proxy=true) private Detail proxyDetail;
+	@Bean(proxy=true) private Detail nullDetail; 
+    @Bean private Detail detail;
+    @Collection(proxy=true, elementClassName=Detail.class) private java.util.Collection proxyCollection;
+    @Collection(proxy=true, elementClassName=Detail.class) private java.util.Collection nullProxyCollection;
 
      
 	public String getPath() {
@@ -61,19 +67,19 @@
 		this.nullDetail = nullDetail;
 	}
 
-	public Collection getProxyCollection() {
+	public java.util.Collection getProxyCollection() {
 		return proxyCollection;
 	}
 
-	public void setProxyCollection(Collection proxyCollection) {
+	public void setProxyCollection(java.util.Collection proxyCollection) {
 		this.proxyCollection = proxyCollection;
 	}
 
-	public Collection getNullProxyCollection() {
+	public java.util.Collection getNullProxyCollection() {
 		return nullProxyCollection;
 	}
 
-	public void setNullProxyCollection(Collection nullProxyCollection) {
+	public void setNullProxyCollection(java.util.Collection nullProxyCollection) {
 		this.nullProxyCollection = nullProxyCollection;
 	}
 	

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTDetail.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTDetail.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTDetail.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTDetail.java Wed Oct 10 14:48:46 2007
@@ -16,10 +16,14 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.proxy;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(jcrType="ocm:ntdetail")
 public class NTDetail 
 {
-    private String path;
-	private String field;
+    @Field(path=true) private String path;
+	@Field(jcrName="ocm:field") private String field;
 
     
 	public String getPath() {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTMain.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTMain.java?rev=583628&r1=583627&r2=583628&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTMain.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/proxy/NTMain.java Wed Oct 10 14:48:46 2007
@@ -16,17 +16,20 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.proxy;
 
-import java.util.Collection;
 
+
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl;
+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;
+
+@Node(jcrType="ocm:ntmain")
 public class NTMain 
 {
 
-	private String path;
-	//private Detail proxyDetail;
-    private Collection proxyCollection;
-
+	@Field(path=true) private String path;
+    @Collection(proxy=true, elementClassName=NTDetail.class,collectionConverter=NTCollectionConverterImpl.class)  private java.util.Collection proxyCollection;
 
-     
 	public String getPath() {
 		return path;
 	}
@@ -35,11 +38,11 @@
 		this.path = path;
 	}
 
-	public Collection getProxyCollection() {
+	public java.util.Collection getProxyCollection() {
 		return proxyCollection;
 	}
 
-	public void setProxyCollection(Collection proxyCollection) {
+	public void setProxyCollection(java.util.Collection proxyCollection) {
 		this.proxyCollection = proxyCollection;
 	}
 



Mime
View raw message