jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r563261 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation: ./ atomic/ basic/ model/ model/unstructured/
Date Mon, 06 Aug 2007 20:38:06 GMT
Author: clombart
Date: Mon Aug  6 13:38:04 2007
New Revision: 563261

URL: http://svn.apache.org/viewvc?view=rev&rev=563261
Log:
Add more unit tests for mapping objects into nt:unstructured. 
Plan to add other unit tests to check mapping on specific node types. 

Added:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java
      - copied, changed from r555087, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/BasicObjectTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/Int2BooleanTypeConverterImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/A.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/Atomic.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/B.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/C.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredAddress.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredPerson.java
Removed:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/BasicObjectTest.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Address.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Person.java

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java (from r555087, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/BasicObjectTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java?view=diff&rev=563261&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/BasicObjectTest.java&r1=555087&p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java&r2=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/BasicObjectTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/CollectionTest.java Mon Aug  6 13:38:04 2007
@@ -16,14 +16,6 @@
  */
 package org.apache.jackrabbit.ocm.annotation;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.jackrabbit.ocm.annotation.manager.AnnotatedObjectContentManagerImpl;
-import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
-import org.apache.jackrabbit.ocm.annotation.model.Address;
-import org.apache.jackrabbit.ocm.annotation.model.Person;
-import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
 
 /**
  * 
@@ -32,36 +24,54 @@
  * @author Philip Dodds
  * 
  */
-public class BasicObjectTest extends TestBase {
+public class CollectionTest extends TestBase {
+
+	public void tearDown() throws Exception {
+
+		//cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+	public void testBasicCollectionInsert() throws Exception {
+	/*
+		List<String> classNames = new ArrayList<String>();
+
+		classNames.add(Address.class.getName());
+		classNames.add(Person.class.getName());
+
+		ObjectContentManager objectContentManager = new AnnotatedObjectContentManagerImpl(
+				session, new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+		Person philip = new Person();
+		philip.setPath("/philip");
+		Address address = new Address();
+		address.setType("work");
+		address.setCity("Los Angeles");
+		address.setState("CA");
+		philip.addAddress(address);
 
-//	public void testBasicCollectionInsert() throws Exception {
-//		List<String> classNames = new ArrayList<String>();
-//
-//		classNames.add(Address.class.getName());
-//		classNames.add(Person.class.getName());
-//
-//		ObjectContentManager objectContentManager = new AnnotatedObjectContentManagerImpl(
-//				session, new AnnotatedObjectMapper(session, classNames));
-//
-//		Person philip = new Person();
-//		philip.setPath("/philip");
-//		Address address = new Address();
-//		address.setType("work");
-//		address.setCity("Los Angeles");
-//		address.setState("CA");
-//		philip.addAddress(address);
-//
-//		objectContentManager.insert(philip);
-//		session.save();
-//	}
+		address = new Address();
+		address.setType("home");
+		address.setCity("Santa Monica");
+		address.setState("CA");
+		philip.addAddress(address);
+		
+		objectContentManager.insert(philip);
+		session.save();
+		
+		objectContentManager.remove("/philip");
+		objectContentManager.save();
+		*/		
+	}
 	
 	public void testBasicInsert() throws Exception {
+		/*
 		List<String> classNames = new ArrayList<String>();
 
 		classNames.add(Address.class.getName());
 
 		ObjectContentManager objectContentManager = new AnnotatedObjectContentManagerImpl(
-				session, new AnnotatedObjectMapper(session, classNames));
+				session, new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
 
 		Address address = new Address();
 		address.setPath("/test");
@@ -78,7 +88,7 @@
 		
 		objectContentManager.remove("/test");
 		objectContentManager.save();
-		
+		*/
 	}
 	
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java?view=diff&rev=563261&r1=563260&r2=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/TestBase.java Mon Aug  6 13:38:04 2007
@@ -20,6 +20,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.Session;
 import javax.jcr.Workspace;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -90,5 +92,28 @@
 
         return found;
     }
+    
+	protected  void cleanUpRepisotory() {
+		try 
+		{
+						
+				NodeIterator nodeIterator = session.getRootNode().getNodes();
+		
+				while (nodeIterator.hasNext())
+				{
+					Node node = nodeIterator.nextNode();
+					if (! node.getName().startsWith("jcr:"))
+					{
+					   
+					    node.remove();
+					}
+				}
+				session.save();
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+	}    
     
 }

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/UnstructuredMappingTest.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.UnstructuredAddress;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.UnstructuredPerson;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
+
+/**
+ * 
+ * 
+ * Unit test for object mapping into a nt:unstructured jcr node type 
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+public class UnstructuredMappingTest extends TestBase {
+	
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+	
+	public void testBasic() throws Exception {
+		List<String> classNames = new ArrayList<String>();
+
+		classNames.add(UnstructuredAddress.class.getName());
+
+		ObjectContentManager objectContentManager = new ObjectContentManagerImpl(
+				session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+		// -----------------------------------------------------------------------------
+		// Insert 
+        // -----------------------------------------------------------------------------
+		UnstructuredAddress address = new UnstructuredAddress();
+		address.setPath("/test");
+		address.setType("work");
+		address.setCity("Los Angeles");
+		address.setState("CA");
+
+		objectContentManager.insert(address);
+		session.save();
+
+		// -----------------------------------------------------------------------------
+		// Retrieve
+        // -----------------------------------------------------------------------------		
+		address = (UnstructuredAddress)objectContentManager.getObject("/test");
+		assertNotNull(address);
+		assertTrue("Invalid address",address.getType().equals("work"));
+		
+		// -----------------------------------------------------------------------------
+		// Update 
+        // -----------------------------------------------------------------------------		
+		address.setType("home");
+		objectContentManager.update(address);
+		session.save();
+
+		// -----------------------------------------------------------------------------
+		// Retrieve
+        // -----------------------------------------------------------------------------		
+		address = (UnstructuredAddress)objectContentManager.getObject("/test");
+		assertNotNull(address);
+		assertTrue("Invalid address",address.getType().equals("home"));
+
+		// -----------------------------------------------------------------------------
+		// Remove
+        // -----------------------------------------------------------------------------		
+		objectContentManager.remove("/test");
+		objectContentManager.save();
+		
+	}
+	
+	public void testCollection() throws Exception 
+	{
+		
+			List<String> classNames = new ArrayList<String>();
+
+			classNames.add(UnstructuredAddress.class.getName());
+			classNames.add(UnstructuredPerson.class.getName());
+
+			ObjectContentManager ocm = new ObjectContentManagerImpl(
+					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+			
+			// -----------------------------------------------------------------------------
+			// Insert 
+	        // -----------------------------------------------------------------------------
+			UnstructuredPerson philip = new UnstructuredPerson();
+			philip.setPath("/test");
+			UnstructuredAddress address = new UnstructuredAddress();
+			address.setType("work");
+			address.setCity("Los Angeles");
+			address.setState("CA");
+			philip.addAddress(address);
+
+			address = new UnstructuredAddress();
+			address.setType("home");
+			address.setCity("Santa Monica");
+			address.setState("CA");
+			philip.addAddress(address);
+			
+			
+			
+			ocm.insert(philip);
+			session.save();
+			
+					
+			// -----------------------------------------------------------------------------
+			// Retrieve
+	        // -----------------------------------------------------------------------------
+			UnstructuredPerson person = (UnstructuredPerson) ocm.getObject("/test");
+			assertNotNull(person);
+			assertTrue("Invalid person", person.getPath().equals("/test"));
+			assertEquals("Invalid number of adress", person.getAddresses().size(), 2);
+			assertTrue("Invalid adress", person.getAddresses().get(0).getType().equals("work"));
+
+			// -----------------------------------------------------------------------------
+			// Update 
+	        // -----------------------------------------------------------------------------		
+			address = new UnstructuredAddress();
+			address.setType("vacation");
+			address.setCity("AA");
+			address.setState("BB");
+			person.addAddress(address);
+	
+			address = new UnstructuredAddress();
+			address.setType("anotheradress");
+			address.setCity("acity");
+			address.setState("state");
+			person.setAnotherAdress(address);
+			
+			ocm.update(person);
+			session.save();
+
+			// -----------------------------------------------------------------------------
+			// Retrieve
+	        // -----------------------------------------------------------------------------
+			person = (UnstructuredPerson) ocm.getObject("/test");
+			assertNotNull(person);
+			assertNotNull(person.getAnotherAdress());
+			assertTrue("Invalid person", person.getPath().equals("/test"));
+			assertEquals("Invalid number of adress", person.getAddresses().size(), 3);
+			assertTrue("Invalid adress", person.getAddresses().get(2).getType().equals("vacation"));
+			
+			// -----------------------------------------------------------------------------
+			// Remove
+	        // -----------------------------------------------------------------------------		
+			ocm.remove("/test");
+			ocm.save();
+			
+			
+			
+		}	
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/AtomicTest.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.atomic;
+
+import java.io.ByteArrayInputStream;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.annotation.TestBase;
+import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.Atomic;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
+
+/**
+ * Test Atomic perisstence fields
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AtomicTest extends TestBase
+{
+    private final static Log log = LogFactory.getLog(AtomicTest.class);
+
+
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+    
+    public void testAtomicFields()
+    {
+        try
+        {
+        	
+    		List<String> classNames = new ArrayList<String>();
+
+    		classNames.add(Atomic.class.getName());
+
+    		ObjectContentManager ocm = new ObjectContentManagerImpl(
+    				session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+    		
+        	Date date = new Date();
+        	Calendar calendar = Calendar.getInstance();
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+            Atomic a = new Atomic();
+            a.setPath("/test");
+            a.setBooleanObject(new Boolean(true));
+            a.setBooleanPrimitive(true);
+            a.setIntegerObject(new Integer(100));
+            a.setIntPrimitive(200);
+            a.setString("Test String");
+            a.setDate(date);
+            a.setInt2boolean(true);
+            
+            byte[] content = "Test Byte".getBytes();
+            a.setByteArray(content);
+            a.setCalendar(calendar);
+            a.setDoubleObject(new Double(2.12));
+            a.setDoublePrimitive(1.23);
+            long now = System.currentTimeMillis();
+            a.setTimestamp(new Timestamp(now));
+            
+            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("Test Stream".getBytes());
+            a.setInputStream(byteArrayInputStream);
+            a.setNamedProperty("ocm:test");
+            a.setPathProperty("/node1/node2");
+            a.setUndefinedProperty("aStringData");
+            
+            ocm.insert(a);
+            ocm.save();
+
+             
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------
+            a = null;
+            a = (Atomic) ocm.getObject( "/test");
+            assertNotNull("a is null", a);
+            assertNotNull("Boolean object is null", a.getBooleanObject());
+            assertTrue("Incorrect boolean object", a.getBooleanObject().booleanValue());
+            assertTrue("Incorrect boolean primitive", a.isBooleanPrimitive());
+            assertNotNull("Integer Object is null", a.getIntegerObject());
+            assertTrue("Incorrect Integer object", a.getIntegerObject().intValue() == 100);
+            assertTrue("Incorrect int primitive", a.getIntPrimitive() == 200);
+            assertNotNull("String object is null", a.getString());
+            assertTrue("Incorrect boolean object", a.getString().equals("Test String"));
+            assertNotNull("Byte array object is null", a.getByteArray());
+            assertTrue("Incorrect byte object", new String(a.getByteArray()).equals("Test Byte"));
+            
+            assertNotNull("date object is null", a.getDate());
+            assertTrue("Invalid date", a.getDate().equals(date));            
+            assertNotNull("calendar object is null", a.getCalendar());
+            
+            log.debug("Calendar : " + a.getCalendar().get(Calendar.YEAR) + "-" + a.getCalendar().get(Calendar.MONTH) + "-" + a.getCalendar().get(Calendar.DAY_OF_MONTH));
+            assertTrue("Invalid calendar object", a.getCalendar().equals(calendar));
+            
+            assertNotNull("Double object is null", a.getDoubleObject());
+            assertTrue("Incorrect double object", a.getDoubleObject().doubleValue() == 2.12);
+            assertTrue("Incorrect double primitive", a.getDoublePrimitive() == 1.23);
+            
+            assertNotNull("Incorrect input stream primitive", a.getInputStream());
+            assertNotNull("Incorrect timestamp", a.getTimestamp());
+            assertTrue("Invalid timestamp value ", a.getTimestamp().getTime() == now);            
+            assertTrue("Invalid int2boolean value ", a.isInt2boolean());
+            
+            assertTrue("Invalid namedProperty value ", a.getNamedProperty().equals("ocm:test"));
+            assertTrue("Invalid pathProperty value ", a.getPathProperty().equals("/node1/node2"));
+            assertTrue("Invalid undefinedProperty value ", ((String) a.getUndefinedProperty()).equals("aStringData"));
+            // --------------------------------------------------------------------------------
+            // Update the property "namedProperty" with an invalid value
+            // --------------------------------------------------------------------------------            
+            try 
+            {
+               // update with an incorrect namespace - Should throws an exception
+               a.setNamedProperty("unknown:test");               
+               ocm.update(a);
+               fail("Exception was not triggered with an invalid namespace");
+               ocm.save();
+            }
+            catch (Exception e)
+            {
+               
+                
+            }
+            
+            // --------------------------------------------------------------------------------
+            // Update the property "pathProperty" with an invalid value
+            // --------------------------------------------------------------------------------            
+            try 
+            {
+               // update with an incorrect namespace - Should throws an exception
+               a.setPathProperty("//node1");               
+               ocm.update(a);
+               fail("Exception was not triggered with an invalid path");
+               ocm.save();
+            }
+            catch (Exception e)
+            {
+               
+                
+            }
+            
+            // --------------------------------------------------------------------------------
+            // Update the property "undefinedProperty" with an invalid value
+            // --------------------------------------------------------------------------------            
+            a = null;
+            a = (Atomic) ocm.getObject( "/test");
+
+            a.setUndefinedProperty(new Double(1.2));
+            ocm.update(a);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------
+            a = null;
+            a = (Atomic) ocm.getObject( "/test");
+            assertNotNull("a is null", a);
+            assertTrue("Invalid undefinedProperty value ", ((Double) a.getUndefinedProperty()).doubleValue() == 1.2);
+            
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+    
+}
\ No newline at end of file

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/Int2BooleanTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/Int2BooleanTypeConverterImpl.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/Int2BooleanTypeConverterImpl.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/atomic/Int2BooleanTypeConverterImpl.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.ocm.annotation.atomic;
+
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+
+import org.apache.jackrabbit.ocm.exception.IncorrectAtomicTypeException;
+import org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter;
+
+/**
+ * This is a simple converter which convert a boolean field value into a jcr long property (int type is not defined in the jcr spec).
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ * 
+ */
+public class Int2BooleanTypeConverterImpl implements AtomicTypeConverter
+{
+	/**
+	 * 
+	 * @see org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
+	 */
+	public Value getValue(ValueFactory valueFactory, Object propValue)
+	{
+		if (propValue == null)
+		{
+			return null;
+		}
+		boolean value = ((Boolean) propValue).booleanValue();
+		int jcrValue = 0;
+		
+		if (value)
+		{
+			jcrValue = 1;			
+		}
+		return valueFactory.createValue(jcrValue);
+	}
+	
+
+    /**
+     * 
+     * @see org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter#getObject(javax.jcr.Value)
+     */
+	public Object getObject(Value value)
+    {
+    	try
+    	{
+    		long jcrValue = value.getLong();
+    		if (jcrValue == 1)
+    		{
+		       return new Boolean(true);
+    		}
+    		else
+    		{
+    		   return new Boolean(false);
+    		}
+		}
+		catch (Exception e)
+		{
+			throw new IncorrectAtomicTypeException("Impossible to convert the value : " + value.toString()  , e);
+		}
+    }
+	
+	/**
+	 * 
+	 * @see org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter#getStringValue(java.lang.Object)
+	 */
+	public String getXPathQueryValue(ValueFactory valueFactory, Object object)
+	{
+		
+		return ((Boolean) object).booleanValue() ? "1" : "0"; 
+	}
+
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/basic/ObjectContentManagerTest.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.basic;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.annotation.TestBase;
+import org.apache.jackrabbit.ocm.annotation.mapper.AnnotatedObjectMapper;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.A;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.Atomic;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.B;
+import org.apache.jackrabbit.ocm.annotation.model.unstructured.C;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl;
+
+/**
+ * Test JcrSession
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class ObjectContentManagerTest extends TestBase {
+	private final static Log log = LogFactory.getLog(ObjectContentManagerTest.class);
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+
+	}
+
+	public void testClassA() {
+		try {
+
+			List<String> classNames = new ArrayList<String>();
+			
+			classNames.add(B.class.getName());
+			classNames.add(C.class.getName());
+			classNames.add(A.class.getName());
+
+			ObjectContentManager ocm = new ObjectContentManagerImpl(
+					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+
+			// --------------------------------------------------------------------------------
+			// 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);
+			assertTrue("Incorrect a1", a.getA1().equals("a1"));
+			assertNotNull("a.b is null", a.getB());
+			assertTrue("Incorrect a.b.b1", a.getB().getB1().equals("b1"));
+			assertNotNull("a.collection is null", a.getCollection());
+			assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
+
+			// --------------------------------------------------------------------------------
+			// Update the object
+			// --------------------------------------------------------------------------------
+			a.setA1("new value");
+			B newB = new B();
+			newB.setB1("new B1");
+			newB.setB2("new B2");
+			a.setB(newB);
+
+			ocm.update(a);
+			ocm.save();
+
+			// --------------------------------------------------------------------------------
+			// Get the object
+			// --------------------------------------------------------------------------------           
+			a = (A) ocm.getObject("/test");
+			assertNotNull("a is null", a);
+			assertTrue("Incorrect a1", a.getA1().equals("new value"));
+			assertNotNull("a.b is null", a.getB());
+			assertTrue("Incorrect a.b.b1", a.getB().getB1().equals("new B1"));
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail("Exception occurs during the unit test : " + e);
+		}
+
+	}
+
+	public void testIsPersistent() {
+		try {
+			List<String> classNames = new ArrayList<String>();
+
+			classNames.add(Atomic.class.getName());
+
+			ObjectContentManager ocm = new ObjectContentManagerImpl(
+					session, (Mapper) new AnnotatedObjectMapper(session, classNames, new NodeTypeManagerImpl()));
+
+
+			assertTrue("Class A is not persistent ", ocm.isPersistent(Atomic.class));
+			assertFalse("Class String is  persistent - hum ? ", ocm.isPersistent(String.class));
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail("Exception occurs during the unit test : " + e);
+		}
+	}
+
+}
\ No newline at end of file

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Address.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Address.java?view=diff&rev=563261&r1=563260&r2=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Address.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Address.java Mon Aug  6 13:38:04 2007
@@ -8,7 +8,7 @@
  * 
  * @author Philip Dodds
  */
-@Node
+@Node(jcrNodeType="ocm:Adress")
 public class Address {
 
     private String path; 
@@ -31,7 +31,7 @@
 		this.path = path;
 	}
 
-	@Field(jcrName="ocm:street")
+	@Field
     public String getStreet() {
         return street;
     }
@@ -40,12 +40,12 @@
         this.street = street;
     }
 
-    @Field(jcrName="ocm:city")
+    @Field
     public String getCity() {
         return city;
     }
 
-    @Field(jcrName="ocm:type")
+    @Field(id=true)
     public String getType() {
         return type;
     }
@@ -58,7 +58,7 @@
         this.city = city;
     }
 
-    @Field(jcrName="ocm:state")
+    @Field
     public String getState() {
         return state;
     }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Person.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Person.java?view=diff&rev=563261&r1=563260&r2=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Person.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/Person.java Mon Aug  6 13:38:04 2007
@@ -20,8 +20,8 @@
 import java.util.List;
 
 import org.apache.jackrabbit.ocm.annotation.Collection;
-import org.apache.jackrabbit.ocm.annotation.Node;
 import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl;
 
 /**
@@ -37,7 +37,7 @@
 
     private List<Address> addresses = new ArrayList<Address>();
 
-    @Collection(type = Address.class, converter= NTCollectionConverterImpl.class)
+    @Collection(type = Address.class, converter = NTCollectionConverterImpl.class )
     public List<Address> getAddresses() {
         return addresses;
     }

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/A.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/A.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/A.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/A.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.jackrabbit.ocm.annotation.Bean;
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+
+/**
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+@Node
+public class A
+{
+	
+	private String path; 
+    private String a1;
+    private String a2;
+    private B b;
+    private B emptyB;
+    private Collection collection;
+    private Collection emptyCollection; 
+    
+    
+    @Field(path=true)
+    public String getPath() {
+		return path;
+	}
+        
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	@Field
+	public String getA1()
+    {
+        return a1;
+    }
+	
+    
+    public void setA1(String a1)
+    {
+        this.a1 = a1;
+    }
+
+    @Field
+    public String getA2()
+    {
+        return a2;
+    }
+
+    public void setA2(String a2)
+    {
+        this.a2 = a2;
+    }
+    
+    @Bean
+    public B getB()
+    {
+        return b;
+    }
+
+    public void setB(B b)
+    {
+        this.b = b;
+    }
+    
+        
+    @org.apache.jackrabbit.ocm.annotation.Collection(type=C.class)
+    public Collection getCollection()
+    {
+        return collection;
+    }
+    
+    /**
+     * @param collection The collection to set.
+     */
+    public void setCollection(Collection collection)
+    {
+        this.collection = collection;
+    }
+    
+    public void addC(C c)
+    {
+       if (collection == null )
+       {
+           collection = new ArrayList();
+       }
+       
+       collection.add(c);   
+    }
+    public Collection getEmptyCollection()
+    {
+        return emptyCollection;
+    }
+    public void setEmptyCollection(Collection emptyCollection)
+    {
+        this.emptyCollection = emptyCollection;
+    }
+    public B getEmptyB()
+    {
+        return emptyB;
+    }
+    public void setEmptyB(B emptyB)
+    {
+        this.emptyB = emptyB;
+    }
+    
+    
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/Atomic.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/Atomic.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/Atomic.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/Atomic.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+import org.apache.jackrabbit.ocm.annotation.atomic.Int2BooleanTypeConverterImpl;
+import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.NameTypeConverterImpl;
+import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.PathTypeConverterImpl;
+import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.UndefinedTypeConverterImpl;
+
+/**
+ *
+ * Simple object used to test atomic type
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+@Node
+public class Atomic
+{	
+	private String path;
+    private String string;
+    private Boolean booleanObject;
+    private boolean booleanPrimitive;
+    private Integer integerObject;
+    private int intPrimitive;
+    private byte[] byteArray;
+    private Calendar calendar;
+    private Date date;
+    private Double doubleObject;
+    private double doublePrimitive;
+    private InputStream inputStream;
+    private Timestamp timestamp;
+    private boolean int2boolean;
+//    private Collection multiValue;
+    
+    private String namedProperty;
+    private String pathProperty; // used to refer another node
+    private Object undefinedProperty;
+        
+    @Field(path=true)
+    public String getPath() {
+		return path;
+	}
+	public void setPath(String path) {
+		this.path = path;
+	}
+	
+	@Field
+	public Boolean getBooleanObject()
+    {
+        return booleanObject;
+    }
+		
+    public void setBooleanObject(Boolean booleanObject)
+    {
+        this.booleanObject = booleanObject;
+    }
+	
+    @Field
+    public boolean isBooleanPrimitive()
+    {
+        return booleanPrimitive;
+    }
+    
+    
+    public void setBooleanPrimitive(boolean booleanPrimitive)
+    {
+        this.booleanPrimitive = booleanPrimitive;
+    }
+    
+    @Field
+    public Integer getIntegerObject()
+    {
+        return integerObject;
+    }
+    
+    
+    public void setIntegerObject(Integer integerObject)
+    {
+        this.integerObject = integerObject;
+    }
+    
+    @Field
+    public int getIntPrimitive()
+    {
+        return intPrimitive;
+    }
+        
+    public void setIntPrimitive(int intPrimitive)
+    {
+        this.intPrimitive = intPrimitive;
+    }
+    
+    @Field
+    public String getString()
+    {
+        return string;
+    }
+        
+    public void setString(String string)
+    {
+        this.string = string;
+    }
+    
+    @Field
+    public byte[] getByteArray()
+    {
+        return byteArray;
+    }
+    
+       
+    public void setByteArray(byte[] byteArray)
+    {
+        this.byteArray = byteArray;
+    }
+    
+    @Field
+    public Calendar getCalendar()
+    {
+        return calendar;
+    }
+        
+    public void setCalendar(Calendar calandar)
+    {
+        this.calendar = calandar;
+    }
+    
+    @Field
+    public Date getDate()
+    {
+        return date;
+    }
+        
+    public void setDate(Date date)
+    {
+        this.date = date;
+    }
+    
+    @Field
+    public Double getDoubleObject()
+    {
+        return doubleObject;
+    }
+        
+    public void setDoubleObject(Double doubleObject)
+    {
+        this.doubleObject = doubleObject;
+    }
+    
+    @Field
+    public double getDoublePrimitive()
+    {
+        return doublePrimitive;
+    }
+       
+    public void setDoublePrimitive(double doublePrimitive)
+    {
+        this.doublePrimitive = doublePrimitive;
+    }
+    
+    @Field
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+        
+    public void setInputStream(InputStream inputStream)
+    {
+        this.inputStream = inputStream;
+    }
+    
+    @Field
+    public Timestamp getTimestamp()
+    {
+        return timestamp;
+    }
+        
+    public void setTimestamp(Timestamp timestamp)
+    {
+        this.timestamp = timestamp;
+    }
+        
+    @Field(converter=Int2BooleanTypeConverterImpl.class)
+	public boolean isInt2boolean() 
+	{
+		return int2boolean;
+	}
+		
+	public void setInt2boolean(boolean int2boolean) 
+	{
+		this.int2boolean = int2boolean;
+	}
+	
+//	@Field
+//	public Collection getMultiValue()
+//	{
+//		return multiValue;
+//	}
+//		
+//	public void setMultiValue(Collection multiValue)
+//	{
+//		this.multiValue = multiValue;
+//	}
+	
+	@Field(converter=NameTypeConverterImpl.class)
+	public String getNamedProperty() {
+		return namedProperty;
+	}
+	
+	public void setNamedProperty(String namedProperty) 
+	{
+		this.namedProperty = namedProperty;
+	}
+	
+	@Field(converter=PathTypeConverterImpl.class)
+	public String getPathProperty() 
+	{
+		return pathProperty;
+	}
+	
+	
+	public void setPathProperty(String pathProperty) 
+	{
+		this.pathProperty = pathProperty;
+	}
+	
+	@Field(converter=UndefinedTypeConverterImpl.class)
+	public Object getUndefinedProperty() 
+	{
+		return undefinedProperty;
+	}
+	
+	public void setUndefinedProperty(Object undefinedProperty) 
+	{
+		this.undefinedProperty = undefinedProperty;
+	}
+    
+    	
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/B.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/B.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/B.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/B.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+
+/**
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+
+@Node
+public class B
+{
+     private String b1;
+     private String b2;   
+     
+    @Field
+    public String getB1()
+    {
+        return b1;
+    }
+
+    public void setB1(String b1)
+    {
+        this.b1 = b1;
+    }
+
+    @Field
+    public String getB2()
+    {
+        return b2;
+    }
+
+    public void setB2(String b2)
+    {
+        this.b2 = b2;
+    }
+    
+    
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/C.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/C.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/C.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/C.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+
+/**
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+@Node
+public class C
+{
+     private String id;
+     private String name;
+     
+    /**
+     * @return Returns the id.
+     */
+    @Field
+    public String getId()
+    {
+        return id;
+    }
+    /**
+     * @param id The id to set.
+     */
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    /**
+     * @return Returns the name.
+     */
+    @Field
+    public String getName()
+    {
+        return name;
+    }
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredAddress.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredAddress.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredAddress.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredAddress.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,69 @@
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+
+/**
+ * This class is mapped into a unstructured jcr node type
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a> 
+ */
+
+@Node
+public class UnstructuredAddress {
+
+    private String path; 
+    
+	private String type;
+
+    private String street;
+
+    private String city;
+
+    private String state;
+    
+    
+    @Field(path = true)
+    public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	@Field
+    public String getStreet() {
+        return street;
+    }
+
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    @Field
+    public String getCity() {
+        return city;
+    }
+    
+    public void setCity(String city) {
+        this.city = city;
+    }
+    
+    @Field(id=true)
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredPerson.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredPerson.java?view=auto&rev=563261
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredPerson.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/annotation/src/test/java/org/apache/jackrabbit/ocm/annotation/model/unstructured/UnstructuredPerson.java Mon Aug  6 13:38:04 2007
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.ocm.annotation.model.unstructured;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.jackrabbit.ocm.annotation.Bean;
+import org.apache.jackrabbit.ocm.annotation.Collection;
+import org.apache.jackrabbit.ocm.annotation.Field;
+import org.apache.jackrabbit.ocm.annotation.Node;
+
+
+/**
+ * 
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ */
+@Node
+public class UnstructuredPerson {
+
+
+    private String path;
+
+    private List<UnstructuredAddress> addresses = new ArrayList<UnstructuredAddress>();
+    
+    private UnstructuredAddress anotherAdress; // Add here to test the Bean mapping
+
+    @Collection(type = UnstructuredAddress.class)
+    public List<UnstructuredAddress> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<UnstructuredAddress> addresses) {
+        this.addresses = addresses;
+    }
+
+    @Field(path = true)
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public void addAddress(UnstructuredAddress address) {
+        addresses.add(address);
+    }
+
+    @Bean
+	public UnstructuredAddress getAnotherAdress() {
+		return anotherAdress;
+	}
+
+	public void setAnotherAdress(UnstructuredAddress anotherAdress) {
+		this.anotherAdress = anotherAdress;
+	}
+    
+    
+
+}



Mime
View raw message