jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r582680 [2/3] - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src: main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ main/java/org/apache/jackrabbit/ocm/mapper/impl/ main/java/org/apache/jackrabbit/ocm/mapp...
Date Sun, 07 Oct 2007 20:54:58 GMT
Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/AnnotationBeanDescriptorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/AnnotationBeanDescriptorTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/AnnotationBeanDescriptorTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/AnnotationBeanDescriptorTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,289 @@
+/*
+ * 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.beanconverter;
+
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+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.A;
+import org.apache.jackrabbit.ocm.testmodel.B;
+import org.apache.jackrabbit.ocm.testmodel.D;
+import org.apache.jackrabbit.ocm.testmodel.DFull;
+import org.apache.jackrabbit.ocm.testmodel.E;
+import org.apache.jackrabbit.ocm.testmodel.Page;
+import org.apache.jackrabbit.ocm.testmodel.Paragraph;
+
+/**
+ * ObjectConverter test for bean-descriptor with inner bean inlined and inner bean with
+ * custom converter.
+ * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AnnotationBeanDescriptorTest extends AnnotationTestBase {
+
+    
+    public AnnotationBeanDescriptorTest(String testname) {
+        super(testname);
+    }
+
+    public static Test suite() {
+
+        // All methods starting with "test" will be executed in the test suite.
+        return new RepositoryLifecycleTestSetup(new TestSuite(AnnotationBeanDescriptorTest.class));
+    }
+    
+    
+    /**
+     * @see org.apache.jackrabbit.ocm.DigesterTestBase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    
+    /**
+     * @see org.apache.jackrabbit.ocm.DigesterTestBase#tearDown()
+     */
+    public void tearDown() throws Exception {
+        this.cleanUpRepisotory();
+        FakeBeanConverter.cleanUpLog();
+        super.tearDown();
+    }    
+    
+    public void testBasic() throws Exception 
+    {
+    	
+    	try 
+    	{
+    		// ------------------------------------------------------------------------
+    		// Create a main object (a) with a null attribute (A.b)
+    		// ------------------------------------------------------------------------    		
+			A a = new A();
+			a.setPath("/test");
+			a.setA1("a1");
+			ocm.insert(a);
+			ocm.save();
+			
+    		// ------------------------------------------------------------------------
+    		// Retrieve 
+    		// ------------------------------------------------------------------------
+			a = (A) ocm.getObject("/test");
+			assertNotNull("Object is null", a);
+			assertNull("attribute is not null", a.getB());
+			
+			B b = new B();
+			b.setB1("b1");
+			b.setB2("b2");
+			a.setB(b);
+			
+			ocm.update(a);
+			ocm.save();
+
+    		// ------------------------------------------------------------------------
+    		// Retrieve 
+    		// ------------------------------------------------------------------------
+			a = (A) ocm.getObject("/test");
+			assertNotNull("Object is null", a);
+			assertNotNull("attribute is null", a.getB());
+			
+    		// ------------------------------------------------------------------------
+			// Remove object
+    		// ------------------------------------------------------------------------			
+			ocm.remove("/test");
+			ocm.save();
+		} 
+    	catch (RuntimeException e) 
+    	{
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);    		
+		}
+    	
+    	
+    }
+    public void testInlined() throws Exception {
+        
+        B expB = new B();
+        expB.setB1("b1value");
+        expB.setB2("b2value");
+        D expD = new D();
+        expD.setPath("/someD");
+        expD.setD1("d1value");
+        expD.setB1(expB);
+        
+       ocm.insert( expD);
+       ocm.save();
+        
+        D actD = (D) ocm.getObject( "/someD");
+        
+        assertEquals(expD.getD1(), actD.getD1());
+        assertEquals(expB.getB1(), actD.getB1().getB1());
+        assertEquals(expB.getB2(), actD.getB1().getB2());
+        
+        DFull actDFull = (DFull) ocm.getObject( DFull.class,  "/someD");
+        
+        assertEquals(expD.getD1(), actDFull.getD1());
+        assertEquals(expB.getB1(), actDFull.getB1());
+        assertEquals(expB.getB2(), actDFull.getB2());
+        
+        expB.setB1("updatedvalue1");
+        
+        ocm.update( expD);
+        getSession().save();
+        
+        actD = (D) ocm.getObject( "/someD");
+        
+        assertEquals(expD.getD1(), actD.getD1());
+        assertEquals(expB.getB1(), actD.getB1().getB1());
+        assertEquals(expB.getB2(), actD.getB1().getB2());
+        
+        actDFull = (DFull) ocm.getObject( DFull.class,  "/someD");
+        
+        assertEquals(expD.getD1(), actDFull.getD1());
+        assertEquals(expB.getB1(), actDFull.getB1());
+        assertEquals(expB.getB2(), actDFull.getB2());
+        
+            
+        expD.setB1(null);
+        ocm.update( expD);
+        getSession().save();
+        
+        actD = (D) ocm.getObject(  "/someD");
+        
+        assertEquals(expD.getD1(), actD.getD1());
+        assertNull("b1 was not  removed", actD.getB1());
+        
+        actDFull = (DFull) ocm.getObject( DFull.class,  "/someD");
+        assertEquals(expD.getD1(), actDFull.getD1());
+        assertNull("b1 was not  removed", actDFull.getB1());
+        assertNull("b2 wan not remove", actDFull.getB2());
+
+    }
+    
+    
+    public void testBeanDescriptorConverter() throws Exception 
+    {
+        
+        B expB = new B();
+        expB.setB1("b1value");
+        expB.setB2("b2value");
+        E expE = new E();
+        expE.setPath("/someD");
+        expE.setD1("d1value");
+        expE.setB1(expB);
+        
+        
+        ocm.insert( expE);
+        ocm.save();
+       
+        E actE = (E) ocm.getObject( "/someD");
+       
+        assertEquals(expE.getD1(), actE.getD1());
+        
+        expE.setD1("updatedvalueD1");
+        expB.setB1("updatedvalue1");
+        
+        ocm.update( expE);
+        ocm.save();
+               
+        actE = (E) ocm.getObject(  "/someD");
+        
+        assertEquals(expE.getD1(), actE.getD1());
+                        
+        expE.setB1(null);
+        ocm.update( expE);
+        ocm.save();
+        
+        actE = (E) ocm.getObject(  "/someD");
+        
+        assertEquals(expE.getD1(), actE.getD1());        
+        
+   
+        List messages = FakeBeanConverter.getLog();
+        assertEquals(6, messages.size());
+        assertEquals("insert at path /someD", messages.get(0));
+        assertEquals("get from path /someD", messages.get(1));
+        assertEquals("update at path /someD", messages.get(2));
+        assertEquals("get from path /someD", messages.get(3));
+        assertEquals("remove from path /someD", messages.get(4));
+        assertEquals("get from path /someD", messages.get(5));
+
+    }
+    
+    public void testParentBeanConverter() throws Exception
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+
+            Page page = new Page();
+            page.setPath("/test");
+            page.setTitle("Page Title");
+            
+            Collection paragraphs = new ArrayList();
+            
+            paragraphs.add(new Paragraph("Para 1"));
+            paragraphs.add(new Paragraph("Para 2"));
+            paragraphs.add(new Paragraph("Para 3"));
+            page.setParagraphs(paragraphs);
+            
+            ocm.insert(page);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            page = (Page) ocm.getObject("/test");
+            paragraphs = page.getParagraphs();
+            for (Iterator iter = paragraphs.iterator(); iter.hasNext();) {
+				Paragraph paragraph = (Paragraph) iter.next();
+				System.out.println("Paragraph path : " + paragraph.getPath());				
+			}            
+            Paragraph p1 = (Paragraph) ocm.getObject("/test/collection-element[2]");
+            Page paraPage = p1.getPage();
+            assertNotNull("Parent page is null", paraPage);
+            assertTrue("Invalid parent page", paraPage.getPath().equals("/test"));
+            
+            // --------------------------------------------------------------------------------
+            // Remove the object
+            // --------------------------------------------------------------------------------           
+            ocm.remove("/test");
+            ocm.save();
+            
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+    	
+    }
+    
+}

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/DigesterBeanDescriptorTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/BeanDescriptorTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/DigesterBeanDescriptorTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/DigesterBeanDescriptorTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/BeanDescriptorTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/BeanDescriptorTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/DigesterBeanDescriptorTest.java Sun Oct  7 13:54:52 2007
@@ -43,17 +43,17 @@
  * 
  * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class BeanDescriptorTest extends DigesterTestBase {
+public class DigesterBeanDescriptorTest extends DigesterTestBase {
 
     
-    public BeanDescriptorTest(String testname) {
+    public DigesterBeanDescriptorTest(String testname) {
         super(testname);
     }
 
     public static Test suite() {
 
         // All methods starting with "test" will be executed in the test suite.
-        return new RepositoryLifecycleTestSetup(new TestSuite(BeanDescriptorTest.class));
+        return new RepositoryLifecycleTestSetup(new TestSuite(DigesterBeanDescriptorTest.class));
     }
     
     
@@ -62,8 +62,6 @@
      */
     protected void setUp() throws Exception {
         super.setUp();
-
-        clean();
     }
 
     
@@ -71,24 +69,11 @@
      * @see org.apache.jackrabbit.ocm.DigesterTestBase#tearDown()
      */
     public void tearDown() throws Exception {
-        clean();
+        this.cleanUpRepisotory();
+        FakeBeanConverter.cleanUpLog();
         super.tearDown();
     }
 
-    private void clean() throws Exception {
-        if(getSession().itemExists("/someD")) 
-        {
-            getSession().getItem("/someD").remove();
-            getSession().save();
-        }
-        
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }           
-
-    }
     
     public void testBasic() throws Exception 
     {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/FakeBeanConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/FakeBeanConverter.java?rev=582680&r1=582679&r2=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/FakeBeanConverter.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/beanconverter/FakeBeanConverter.java Sun Oct  7 13:54:52 2007
@@ -44,6 +44,11 @@
 		 
 		 
 	}
+    
+    public static void cleanUpLog()
+    {
+    	log.clear();
+    }
 
 	public static List getLog() {
         return log;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AllTests.java?rev=582680&r1=582679&r2=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AllTests.java Sun Oct  7 13:54:52 2007
@@ -36,13 +36,21 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.collectionconverter");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ArrayListTest.class);
-        suite.addTestSuite(DefaultCollectionConverterImplTest.class);        
-        suite.addTestSuite(HashMapTest.class);        
-        suite.addTestSuite(MultiValueCollectionConverterImplTest.class);
-        suite.addTestSuite(NTCollectionConverterImplTest.class);
-        suite.addTestSuite(ResidualPropertiesCollectionConverterImplTest.class);
-        suite.addTestSuite(ResidualNodesCollectionConverterImplTest.class);
+        suite.addTestSuite(AnnotationArrayListTest.class);
+        suite.addTestSuite(AnnotationDefaultCollectionConverterImplTest.class);
+        suite.addTestSuite(AnnotationHashMapTest.class);
+        suite.addTestSuite(AnnotationMultiValueCollectionConverterImplTest.class);
+        suite.addTestSuite(AnnotationNTCollectionConverterImplTest.class);
+        suite.addTestSuite(AnnotationResidualNodesCollectionConverterImplTest.class);
+        suite.addTestSuite(AnnotationResidualPropertiesCollectionConverterImplTest.class);
+        suite.addTestSuite(DigesterArrayListTest.class);        
+        suite.addTestSuite(DigesterDefaultCollectionConverterImplTest.class);                
+        suite.addTestSuite(DigesterHashMapTest.class);
+        suite.addTestSuite(DigesterMultiValueCollectionConverterImplTest.class);                                
+        suite.addTestSuite(DigesterNTCollectionConverterImplTest.class);
+        suite.addTestSuite(DigesterResidualNodesCollectionConverterImplTest.class);
+        suite.addTestSuite(DigesterResidualPropertiesCollectionConverterImplTest.class);
+        
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationArrayListTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationArrayListTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationArrayListTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationArrayListTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,164 @@
+/*
+ * 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.collectionconverter;
+
+import java.util.ArrayList;
+
+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.collection.ArrayListElement;
+import org.apache.jackrabbit.ocm.testmodel.collection.Element;
+import org.apache.jackrabbit.ocm.testmodel.collection.Main;
+
+/**
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationArrayListTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationArrayListTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationArrayListTest(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(AnnotationArrayListTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }    
+    
+    public void testArrayList()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+        	
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+        	// with a null value for the arraylist
+            // --------------------------------------------------------------------------------
+
+            Main main = new Main();
+            main.setPath("/test");
+            main.setText("Main text");
+            
+            ocm.insert(main);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            main = (Main) ocm.getObject( "/test");
+            ArrayList arrayList = main.getList();
+            assertNull("main.getList is not null", arrayList ); 
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            
+            ArrayListElement arrayListElement = new ArrayListElement();
+            Element e1 = new Element();
+            e1.setId("e1");
+            e1.setText("Element 1");
+            arrayListElement.add(e1);
+            
+            Element e2 = new Element();
+            e2.setId("e2");
+            e2.setText("Element 2");
+            arrayListElement.add(e2);
+            
+            main.setList(arrayListElement);
+            ocm.update(main);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            main = (Main) ocm.getObject( "/test");
+            arrayList = main.getList();
+            assertNotNull("main.getList is null", arrayList ); 
+            Element[] elements = (Element[]) arrayList.toArray(new Element[arrayList.size()]);
+            assertTrue("Incorrect para element", elements[0].getText().equals("Element 1"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            arrayListElement = new ArrayListElement();
+            e1 = new Element();
+            e1.setId("e1");
+            e1.setText("Element 1");
+            arrayListElement.add(e1);
+            
+            e2 = new Element();
+            e2.setId("e3");
+            e2.setText("Element 3");
+            arrayListElement.add(e2);
+            
+            Element e3 = new Element();
+            e3.setId("e4");
+            e3.setText("Element 4");
+            arrayListElement.add(e3);
+            
+            main.setList(arrayListElement);            
+            
+            ocm.update(main);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            main = (Main) ocm.getObject( "/test");
+            arrayList = main.getList();
+            assertNotNull("main.getList() is null", arrayList ); 
+            elements = (Element[]) arrayList.toArray(new Element[arrayList.size()]);
+            assertTrue("Incorrect element", elements[2].getText().equals("Element 4"));
+            
+        }
+        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/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationDefaultCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationDefaultCollectionConverterImplTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationDefaultCollectionConverterImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationDefaultCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,311 @@
+/*
+ * 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.collectionconverter;
+
+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.DigesterTestBase;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.testmodel.A;
+import org.apache.jackrabbit.ocm.testmodel.C;
+
+/**
+ * Test DefaultCollectionConverterImpl
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AnnotationDefaultCollectionConverterImplTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationDefaultCollectionConverterImplTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationDefaultCollectionConverterImplTest(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(AnnotationDefaultCollectionConverterImplTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }
+
+    public void testNull()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object with a null collection field
+            // --------------------------------------------------------------------------------
+            A a = new A();
+            a.setPath("/test");               
+            
+            ocm.insert(a);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject( "/test");
+            assertNull("a.collection is not null", a.getCollection());
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            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.update(a);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject("/test");
+            assertNotNull("a is null", a);
+            assertNotNull("a.collection is null", a.getCollection());
+            assertTrue("Incorrect collection size", a.getCollection().size() == 3);
+            assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            a.setCollection(null);
+            ocm.update(a);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject( "/test");
+            assertNull("a.collection is not null", a.getCollection());
+            
+            // --------------------------------------------------------------------------------
+            // Export to check the content
+            // --------------------------------------------------------------------------------           
+            this.exportDocument("target/DefaultCollectionConverterExport.xml", "/test", true, false);         
+            
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+    
+    public void testDropElement()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+            A a = new A();
+            a.setPath("/test");
+            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.collection is null", a.getCollection());
+            assertEquals("Incorrect a.collection size", 3, a.getCollection().size());
+            assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            c1 = new C();
+            c1.setId("new first");
+            c1.setName("First Element");
+            
+            c2 = new C();
+            c2.setId("new second");
+            c2.setName("Second Element");
+            
+            collection = new ArrayList();
+            collection.add(c1);
+            collection.add(c2);
+            a.setCollection(collection);
+            
+            ocm.update(a);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject( "/test");
+            assertNotNull("a is null", a);
+            assertNotNull("a.collection is null", a.getCollection());
+            assertTrue("Incorrect collection size", a.getCollection().size() == 2);
+            assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("new first"));
+            
+            // --------------------------------------------------------------------------------
+            // Export to check the content
+            // --------------------------------------------------------------------------------           
+            this.exportDocument("target/DefaultCollectionConverterExport.xml", "/test", true, false);         
+            
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+
+    public void testAddElement()
+    {
+        try
+        {
+
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+            A a = new A();
+            a.setPath("/test");
+            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.collection is null", a.getCollection());
+            assertEquals("Incorrect a.collection size", 3, a.getCollection().size());
+            assertEquals("Incorrect a.collection", "first", ((C) a.getCollection().iterator().next()).getId());
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            C c4 = new C();
+            c4.setId("Fourth");
+            c4.setName("Fourth Element");
+                
+            collection = new ArrayList();
+            collection.add(c1);
+            collection.add(c2);
+            collection.add(c3);
+            collection.add(c4);
+            a.setCollection(collection);
+            
+            ocm.update(a);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            a = (A) ocm.getObject( "/test");
+            assertNotNull("a is null", a);
+            assertNotNull("a.collection is null", a.getCollection());
+            assertEquals("Incorrect collection size", 4, a.getCollection().size());
+            assertEquals("Incorrect a.collection", "first", ((C) a.getCollection().iterator().next()).getId());
+            
+        }
+        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/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,163 @@
+/*
+ * 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.collectionconverter;
+
+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.collection.Element;
+import org.apache.jackrabbit.ocm.testmodel.collection.HashMapElement;
+import org.apache.jackrabbit.ocm.testmodel.collection.Main;
+
+/**
+ * Test NTCollectionConverterImpl
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AnnotationHashMapTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationHashMapTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationHashMapTest(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(AnnotationHashMapTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }    
+    
+    public void testHashMap()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+        	
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository with null hashmap
+            // --------------------------------------------------------------------------------
+
+            Main main = new Main();
+            main.setPath("/test");
+            main.setText("Main text");
+                        
+            ocm.insert(main);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            main = (Main) ocm.getObject( "/test");            
+            assertTrue("Incorrect text", main.getText().equals("Main text"));           
+            assertNull("HashMap is not null", main.getHashMap());
+            
+            // --------------------------------------------------------------------------------
+            // Update an object graph in the repository
+            // --------------------------------------------------------------------------------
+
+            main = new Main();
+            main.setPath("/test");
+            main.setText("Main text");
+            
+            HashMapElement hashMapElement = new HashMapElement();
+            Element e1 = new Element();
+            e1.setId("e1");
+            e1.setText("Element 1");
+            hashMapElement.addObject(e1);
+            
+            Element e2 = new Element();
+            e2.setId("e2");
+            e2.setText("Element 2");
+            hashMapElement.addObject(e2);
+            
+            main.setHashMap(hashMapElement);
+            
+            ocm.update(main);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            main = (Main) ocm.getObject( "/test");
+            assertNotNull("main.getHashMap() is null", main.getHashMap());
+            assertTrue("Incorrect text", main.getText().equals("Main text"));           
+            assertTrue("Incorrect para element", ((Element) main.getHashMap().get("e1")).getText().equals("Element 1"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            hashMapElement = new HashMapElement();
+            e1 = new Element();
+            e1.setId("e1");
+            e1.setText("Element 1");
+            hashMapElement.addObject(e1);
+            
+            e2 = new Element();
+            e2.setId("e3");
+            e2.setText("Element 3");
+            hashMapElement.addObject(e2);
+
+            Element e3 = new Element();
+            e3.setId("e4");
+            e3.setText("Element 4");
+            hashMapElement.addObject(e3);
+            main.setHashMap(hashMapElement);
+            
+            ocm.update(main);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            assertNotNull("main.getElements() is null", main.getHashMap());
+            assertTrue("Incorrect text", main.getText().equals("Main text"));           
+            assertTrue("Incorrect para element", ((Element) main.getHashMap().get("e4")).getText().equals("Element 4"));
+            
+        }
+        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/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationMultiValueCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationMultiValueCollectionConverterImplTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationMultiValueCollectionConverterImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationMultiValueCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,133 @@
+/*
+ * 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.collectionconverter;
+
+import java.util.ArrayList;
+
+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.MultiValue;
+
+/**
+ * Test NTCollectionConverterImpl
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AnnotationMultiValueCollectionConverterImplTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationMultiValueCollectionConverterImplTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationMultiValueCollectionConverterImplTest(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(AnnotationMultiValueCollectionConverterImplTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+        this.cleanUpRepisotory();       
+    	
+        super.tearDown();
+    }    
+
+    public void testMultiValue()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+
+            MultiValue multiValue = new MultiValue();
+            multiValue.setPath("/test");
+            
+            ArrayList values = new ArrayList();
+            values.add("Value1");
+            values.add("Value2");
+            values.add("Value3");
+            values.add("Value4");
+            multiValue.setMultiValues(values);
+            
+            ocm.insert(multiValue);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            multiValue = (MultiValue) ocm.getObject( "/test");
+            assertNotNull("Object is null", multiValue);
+            assertNull("nullMultiValues field is not null", multiValue.getNullMultiValues());
+            assertTrue("Incorrect number of values", multiValue.getMultiValues().size() == 4);            
+            assertTrue("Incorrect collection element", ((String) multiValue.getMultiValues().iterator().next()).equals("Value1"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            values = new ArrayList();
+            values.add("Value1");
+            values.add("Value2");
+            values.add("Value3");
+            values.add("Value4");
+            values.add("Value5");
+            multiValue.setMultiValues(values);
+            
+            ocm.update(multiValue);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+
+            multiValue = (MultiValue) ocm.getObject( "/test");
+            assertNotNull("Object is null", multiValue);
+            assertNull("nullMultiValues field is not null", multiValue.getNullMultiValues());
+            assertTrue("Incorrect number of values", multiValue.getMultiValues().size() == 5);            
+            assertTrue("Incorrect collection element", ((String) multiValue.getMultiValues().iterator().next()).equals("Value1"));
+            
+            
+        }
+        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/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationNTCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationNTCollectionConverterImplTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationNTCollectionConverterImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationNTCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,152 @@
+/*
+ * 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.collectionconverter;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.testmodel.Page;
+import org.apache.jackrabbit.ocm.testmodel.Paragraph;
+
+/**
+ * Test NTCollectionConverterImpl
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class AnnotationNTCollectionConverterImplTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationNTCollectionConverterImplTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationNTCollectionConverterImplTest(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(AnnotationNTCollectionConverterImplTest.class));
+    }
+    
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }       
+
+    public void testCollection()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+            
+        	// --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository with a null collection
+            // --------------------------------------------------------------------------------
+
+            Page page = new Page();
+            page.setPath("/test");
+            page.setTitle("Page Title");
+            
+            ocm.insert(page);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            page = (Page) ocm.getObject( "/test");
+            assertNull("page.getParagraphs is not null", page.getParagraphs());
+            assertTrue("Incorrect page title", page.getTitle().equals("Page Title"));                        
+            
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository
+            // --------------------------------------------------------------------------------
+            ArrayList paragraphs = new ArrayList();
+            
+            paragraphs.add(new Paragraph("Para 1"));
+            paragraphs.add(new Paragraph("Para 2"));
+            paragraphs.add(new Paragraph("Para 3"));
+            page.setParagraphs(paragraphs);
+            
+            ocm.update(page);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            page = (Page) ocm.getObject( "/test");
+            assertNotNull("page.getParagraphs is null", page.getParagraphs());
+            assertTrue("Incorrect page title", page.getTitle().equals("Page Title"));
+            assertTrue("Incorrect page.getParagraphs size", page.getParagraphs().size() == 3);
+            assertTrue("Incorrect para element", ((Paragraph) page.getParagraphs().iterator().next()).getText().equals("Para 1"));
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            paragraphs = new ArrayList();
+            
+            paragraphs.add(new Paragraph("Para 1"));
+            paragraphs.add(new Paragraph("Para 2"));
+            paragraphs.add(new Paragraph("Para 4"));
+            paragraphs.add(new Paragraph("Para 5"));
+            page.setParagraphs(paragraphs);
+            
+            ocm.update(page);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+
+            page = (Page) ocm.getObject( "/test");
+            assertNotNull("page.getParagraphs is null", page.getParagraphs());
+            assertTrue("Incorrect page title", page.getTitle().equals("Page Title"));
+            assertTrue("Incorrect page.getParagraphs size", page.getParagraphs().size() == 4);
+            assertTrue("Incorrect para element", ((Paragraph) page.getParagraphs().iterator().next()).getText().equals("Para 1"));
+            
+            // --------------------------------------------------------------------------------
+            // Export to check the content
+            // --------------------------------------------------------------------------------           
+            this.exportDocument("target/NTCollectionExport.xml", "/test", true, false);
+            
+        }
+        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/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualNodesCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualNodesCollectionConverterImplTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualNodesCollectionConverterImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualNodesCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,148 @@
+/*
+ * 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.collectionconverter;
+
+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.manager.collectionconverter.impl.ManagedHashMap;
+import org.apache.jackrabbit.ocm.testmodel.Paragraph;
+import org.apache.jackrabbit.ocm.testmodel.Residual;
+
+/**
+ * Test ResidualNodesCollectionConverterImpl
+ *
+ * @author <a href="mailto:fmeschbe[at]apache[dot]com">Felix Meschberger</a>
+ * 
+ */
+public class AnnotationResidualNodesCollectionConverterImplTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationResidualNodesCollectionConverterImplTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationResidualNodesCollectionConverterImplTest(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(AnnotationResidualNodesCollectionConverterImplTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }    
+
+    public void testResidualNodes()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository with null values
+            // --------------------------------------------------------------------------------
+
+            Residual residual = new Residual.ResidualNodes();
+            residual.setPath("/test");
+            ocm.insert(residual);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertNull("Map is not null", residual.getElements());
+            
+            // --------------------------------------------------------------------------------
+            // Update an object graph in the repository
+            // --------------------------------------------------------------------------------
+            residual = new Residual.ResidualNodes();
+            residual.setPath("/test");
+            
+            ManagedHashMap map = new ManagedHashMap();
+            map.put("value1", new Paragraph("Value1"));
+            map.put("value2", new Paragraph("Value2"));
+            map.put("value3", new Paragraph("Value3"));
+            map.put("value4", new Paragraph("Value4"));
+            residual.setElements(map);
+            
+            ocm.update(residual);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertTrue("Incorrect number of values", residual.getElements().size() == 4);            
+            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
+            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            map = new ManagedHashMap();
+            map.put("value11", new Paragraph("Value11"));
+            map.put("value12", new Paragraph("Value12"));
+            map.put("value13", new Paragraph("Value13"));
+            map.put("value14", new Paragraph("Value14"));
+            map.put("value15", new Paragraph("Value15"));
+            residual.setElements(map);
+            
+            ocm.update(residual);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertTrue("Incorrect number of values", residual.getElements().size() == 5);
+            assertNull("Unexpected collection element", residual.getElements().get("value2"));
+            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
+            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+
+   
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualPropertiesCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualPropertiesCollectionConverterImplTest.java?rev=582680&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualPropertiesCollectionConverterImplTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualPropertiesCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -0,0 +1,162 @@
+/*
+ * 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.collectionconverter;
+
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.AnnotationTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.DigesterTestBase;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManagedHashMap;
+import org.apache.jackrabbit.ocm.testmodel.Residual;
+
+/**
+ * Test ResidualPropertiesCollectionConverterImpl
+ *
+ * @author <a href="mailto:fmeschbe[at]apache[dot]com">Felix Meschberger</a>
+ * 
+ */
+public class AnnotationResidualPropertiesCollectionConverterImplTest extends AnnotationTestBase
+{
+    private final static Log log = LogFactory.getLog(AnnotationResidualPropertiesCollectionConverterImplTest.class);
+
+    /**
+     * <p>Defines the test case name for junit.</p>
+     * @param testName The test case name.
+     */
+    public AnnotationResidualPropertiesCollectionConverterImplTest(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(AnnotationResidualPropertiesCollectionConverterImplTest.class));
+    }
+
+    
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    public void tearDown() throws Exception
+    {
+    	this.cleanUpRepisotory();          
+    	
+        super.tearDown();
+    }    
+
+    public void testResidualProperties()
+    {
+        try
+        {
+        	ObjectContentManager ocm = getObjectContentManager();
+
+            // --------------------------------------------------------------------------------
+            // Create and store an object graph in the repository with a null hashmap
+            // --------------------------------------------------------------------------------
+
+            Residual residual = new Residual.ResidualProperties();
+            residual.setPath("/test");
+                        
+            ocm.insert(residual);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertNull("Hashmap is not null", residual.getElements());
+            
+            // --------------------------------------------------------------------------------
+            // Update an object graph in the repository
+            // --------------------------------------------------------------------------------
+
+            residual = new Residual.ResidualProperties();
+            residual.setPath("/test");
+            
+            ManagedHashMap map = new ManagedHashMap();
+            map.put("value1", "Value1");
+            map.put("value2", "Value2");
+            map.put("value3", "Value3");
+            map.put("value4", "Value4");
+            map.put("value5", Arrays.asList(new String[]{ "Value5-1", "Value5-2" }));
+            residual.setElements(map);
+            
+            ocm.update(residual);
+            ocm.save();
+            
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertTrue("Incorrect number of values", residual.getElements().size() == 5);            
+            assertTrue("Incorrect collection element", residual.getElements().get("value2").equals("Value2"));
+            assertNotNull("Missing collection element", residual.getElements().get("value5"));
+            assertTrue("Incorrect collection element type", (residual.getElements().get("value5") instanceof List));
+            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value5")).size(), 2);
+            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value5")).get(0), "Value5-1");
+            
+            // --------------------------------------------------------------------------------
+            // Update the object
+            // --------------------------------------------------------------------------------
+            map = new ManagedHashMap();
+            map.put("value11", "Value11");
+            map.put("value12", "Value12");
+            map.put("value13", "Value13");
+            map.put("value14", "Value14");
+            map.put("value15", "Value15");
+            map.put("value16", Arrays.asList(new String[]{ "Value16-1", "Value16-2" }));
+            residual.setElements(map);
+            
+            ocm.update(residual);
+            ocm.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------           
+
+            residual = (Residual) ocm.getObject( "/test");
+            assertNotNull("Object is null", residual);
+            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
+            assertNull("Unexpected collection element", residual.getElements().get("value2"));
+            assertNull("Unexpected collection element", residual.getElements().get("value5"));
+            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
+            assertNotNull("Missing collection element", residual.getElements().get("value16"));
+            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
+            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
+            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            fail("Exception occurs during the unit test : " + e);
+        }
+        
+    }
+
+   
+}

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterArrayListTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ArrayListTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterArrayListTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterArrayListTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ArrayListTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ArrayListTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterArrayListTest.java Sun Oct  7 13:54:52 2007
@@ -33,15 +33,15 @@
 /**
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ArrayListTest extends DigesterTestBase
+public class DigesterArrayListTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(ArrayListTest.class);
+    private final static Log log = LogFactory.getLog(DigesterArrayListTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public ArrayListTest(String testName)  throws Exception
+    public DigesterArrayListTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -49,7 +49,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new RepositoryLifecycleTestSetup(new TestSuite(ArrayListTest.class));
+        return new RepositoryLifecycleTestSetup(new TestSuite(DigesterArrayListTest.class));
     }
 
     
@@ -58,11 +58,7 @@
      */
     public void tearDown() throws Exception
     {
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }        
+    	this.cleanUpRepisotory();         
     	
         super.tearDown();
     }    

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterDefaultCollectionConverterImplTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DefaultCollectionConverterImplTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterDefaultCollectionConverterImplTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterDefaultCollectionConverterImplTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DefaultCollectionConverterImplTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DefaultCollectionConverterImplTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterDefaultCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -35,15 +35,15 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class DefaultCollectionConverterImplTest extends DigesterTestBase
+public class DigesterDefaultCollectionConverterImplTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(DefaultCollectionConverterImplTest.class);
+    private final static Log log = LogFactory.getLog(DigesterDefaultCollectionConverterImplTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public DefaultCollectionConverterImplTest(String testName)  throws Exception
+    public DigesterDefaultCollectionConverterImplTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -51,7 +51,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new RepositoryLifecycleTestSetup(new TestSuite(DefaultCollectionConverterImplTest.class));
+        return new RepositoryLifecycleTestSetup(new TestSuite(DigesterDefaultCollectionConverterImplTest.class));
     }
 
     
@@ -60,11 +60,7 @@
      */
     public void tearDown() throws Exception
     {
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }        
+    	this.cleanUpRepisotory();          
     	
         super.tearDown();
     }

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterHashMapTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/HashMapTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterHashMapTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterHashMapTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/HashMapTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/HashMapTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterHashMapTest.java Sun Oct  7 13:54:52 2007
@@ -33,15 +33,15 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class HashMapTest extends DigesterTestBase
+public class DigesterHashMapTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(HashMapTest.class);
+    private final static Log log = LogFactory.getLog(DigesterHashMapTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public HashMapTest(String testName)  throws Exception
+    public DigesterHashMapTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -49,7 +49,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new RepositoryLifecycleTestSetup(new TestSuite(HashMapTest.class));
+        return new RepositoryLifecycleTestSetup(new TestSuite(DigesterHashMapTest.class));
     }
 
     
@@ -58,11 +58,7 @@
      */
     public void tearDown() throws Exception
     {
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }        
+    	this.cleanUpRepisotory();          
     	
         super.tearDown();
     }    

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterMultiValueCollectionConverterImplTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/MultiValueCollectionConverterImplTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterMultiValueCollectionConverterImplTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterMultiValueCollectionConverterImplTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/MultiValueCollectionConverterImplTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/MultiValueCollectionConverterImplTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterMultiValueCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -38,15 +38,15 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class MultiValueCollectionConverterImplTest extends DigesterTestBase
+public class DigesterMultiValueCollectionConverterImplTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(MultiValueCollectionConverterImplTest.class);
+    private final static Log log = LogFactory.getLog(DigesterMultiValueCollectionConverterImplTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public MultiValueCollectionConverterImplTest(String testName)  throws Exception
+    public DigesterMultiValueCollectionConverterImplTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -54,7 +54,7 @@
     public static Test suite()
     {
         // All methods starting with "test" will be executed in the test suite.
-        return new RepositoryLifecycleTestSetup(new TestSuite(MultiValueCollectionConverterImplTest.class));
+        return new RepositoryLifecycleTestSetup(new TestSuite(DigesterMultiValueCollectionConverterImplTest.class));
     }
 
     
@@ -63,11 +63,7 @@
      */
     public void tearDown() throws Exception
     {
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }        
+    	this.cleanUpRepisotory();          
     	
         super.tearDown();
     }    

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterNTCollectionConverterImplTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/NTCollectionConverterImplTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterNTCollectionConverterImplTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterNTCollectionConverterImplTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/NTCollectionConverterImplTest.java&r1=580157&r2=582680&rev=582680&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/NTCollectionConverterImplTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterNTCollectionConverterImplTest.java Sun Oct  7 13:54:52 2007
@@ -37,15 +37,15 @@
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
  */
-public class NTCollectionConverterImplTest extends DigesterTestBase
+public class DigesterNTCollectionConverterImplTest extends DigesterTestBase
 {
-    private final static Log log = LogFactory.getLog(NTCollectionConverterImplTest.class);
+    private final static Log log = LogFactory.getLog(DigesterNTCollectionConverterImplTest.class);
 
     /**
      * <p>Defines the test case name for junit.</p>
      * @param testName The test case name.
      */
-    public NTCollectionConverterImplTest(String testName)  throws Exception
+    public DigesterNTCollectionConverterImplTest(String testName)  throws Exception
     {
         super(testName);
     }
@@ -54,7 +54,7 @@
     {
         // All methods starting with "test" will be executed in the test suite.
         return new RepositoryLifecycleTestSetup(
-                new TestSuite(NTCollectionConverterImplTest.class));
+                new TestSuite(DigesterNTCollectionConverterImplTest.class));
     }
     
     
@@ -63,11 +63,7 @@
      */
     public void tearDown() throws Exception
     {
-        if (getObjectContentManager().objectExists("/test"))
-        {
-            getObjectContentManager().remove("/test");
-            getObjectContentManager().save();
-        }        
+    	this.cleanUpRepisotory();          
     	
         super.tearDown();
     }       



Mime
View raw message