incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r307182 - in /incubator/graffito/trunk/jcr-mapping/src: java/org/apache/portals/graffito/jcr/persistence/ java/org/apache/portals/graffito/jcr/persistence/impl/ java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ test/org...
Date Fri, 07 Oct 2005 20:04:37 GMT
Author: clombart
Date: Fri Oct  7 13:04:22 2005
New Revision: 307182

URL: http://svn.apache.org/viewcvs?rev=307182&view=rev
Log:
Add save method in the persistenceManager

Modified:
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
    incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
Fri Oct  7 13:04:22 2005
@@ -95,5 +95,11 @@
      * Close the JCR session    
      */
     public void logout() throws JcrMappingException;
+    
+    /**
+     * Save all modifications made by the persistence manager
+     *
+     */
+    public void save() throws JcrMappingException;
         
 }

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
Fri Oct  7 13:04:22 2005
@@ -161,10 +161,9 @@
 
 		try
 		{
-			Item item = session.getItem(path);
-			Node parent = item.getParent();
+			Item item = session.getItem(path);			
 			item.remove();
-			parent.save();
+		
 		}
 		catch (RepositoryException e)
 		{
@@ -261,5 +260,19 @@
 	{
 		return this.session;
 	}
+
+	public void save() throws JcrMappingException
+	{
+		try
+		{
+		    session.save();
+		}
+		catch(Exception e)
+		{
+			throw new JcrMappingException("Impossible to save", e);
+		}
+	}
+	
+	
 
 }

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
Fri Oct  7 13:04:22 2005
@@ -71,7 +71,7 @@
             String nodeName = RepositoryUtil.getNodeName(path);
             Node parentNode = (Node) session.getItem(parentPath);
             this.insert(session, parentNode, nodeName, object);            
-            parentNode.save();
+            
         }
         catch (Exception e)
         {
@@ -126,7 +126,7 @@
             String nodeName = RepositoryUtil.getNodeName(path);
             Node parentNode = (Node) session.getItem(parentPath);
             this.update(session, parentNode, nodeName, object);
-            parentNode.save();
+            
         }
         catch (Exception e)
         {

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
Fri Oct  7 13:04:22 2005
@@ -18,26 +18,17 @@
 
 import java.io.ByteArrayInputStream;
 import java.sql.Timestamp;
-import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Collection;
 import java.util.Date;
 
-import javax.jcr.Node;
-import javax.jcr.Property;
-import javax.jcr.Session;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
-import org.apache.portals.graffito.jcr.testmodel.A;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.Atomic;
-import org.apache.portals.graffito.jcr.testmodel.B;
-import org.apache.portals.graffito.jcr.testmodel.C;
-import org.apache.portals.graffito.jcr.testmodel.Folder;
 
 /**
  * Test Atomic perisstence fields
@@ -67,10 +58,12 @@
     {
         try
         {
+        	PersistenceManager persistenceManager = getPersistenceManager();
 
-            if (getPersistenceManager().itemExists("/test"))
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+            	persistenceManager.remove("/test");
+            	persistenceManager.save();
             }
 
             // --------------------------------------------------------------------------------
@@ -94,14 +87,15 @@
             ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("Test Stream".getBytes());
             a.setInputStream(byteArrayInputStream);
             
-            getPersistenceManager().insert("/test", a);
+            persistenceManager.insert("/test", a);
+            persistenceManager.save();
 
              
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
             a = null;
-            a = (Atomic) getPersistenceManager().getObject(Atomic.class, "/test");
+            a = (Atomic) persistenceManager.getObject(Atomic.class, "/test");
             assertNotNull("a is null", a);
             assertNotNull("Boolean object is null", a.getBooleanObject());
             assertTrue("Incorrect boolean object", a.getBooleanObject().booleanValue());

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
Fri Oct  7 13:04:22 2005
@@ -32,6 +32,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.Atomic;
 import org.apache.portals.graffito.jcr.testmodel.B;
@@ -67,9 +68,10 @@
         try
         {
 
-            if (getPersistenceManager().itemExists("/test"))
+        	PersistenceManager persistenceManager = getPersistenceManager();
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
             }
 
             // --------------------------------------------------------------------------------
@@ -88,14 +90,14 @@
             ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("Test Stream".getBytes());
             a.setInputStream(byteArrayInputStream);
             
-            getPersistenceManager().insert("/test", a);
-
+            persistenceManager.insert("/test", a);
+            persistenceManager.save();
              
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
             a = null;
-            a = (Atomic) getPersistenceManager().getObject(Atomic.class, "/test");
+            a = (Atomic) persistenceManager.getObject(Atomic.class, "/test");
             assertNotNull("a is null", a);
             assertNull("Boolean object is not null", a.getBooleanObject());
             

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
Fri Oct  7 13:04:22 2005
@@ -25,6 +25,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.C;
 
@@ -56,10 +57,12 @@
     {
         try
         {
+        	PersistenceManager persistenceManager = getPersistenceManager();
 
-            if (getPersistenceManager().itemExists("/test"))
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
+                persistenceManager.save();
             }
 
             // --------------------------------------------------------------------------------
@@ -86,12 +89,13 @@
             
             a.setCollection(collection);
             
-            getPersistenceManager().insert("/test", a);
+            persistenceManager.insert("/test", a);
+            persistenceManager.save();
             
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/test");
             assertNotNull("a.collection is null", a.getCollection());
             assertTrue("Incorrect a.collection size", a.getCollection().size() == 3);
             assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
@@ -112,12 +116,13 @@
             collection.add(c2);
             a.setCollection(collection);
             
-            getPersistenceManager().update("/test", a);
+            persistenceManager.update("/test", a);
+            persistenceManager.save();
 
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/test");
             assertNotNull("a is null", a);
             assertNotNull("a.collection is null", a.getCollection());
             assertTrue("Incorrect collection size", a.getCollection().size() == 2);
@@ -142,9 +147,11 @@
         try
         {
 
-            if (getPersistenceManager().itemExists("/test"))
+        	PersistenceManager persistenceManager = getPersistenceManager();
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
+                persistenceManager.save();
             }
 
             // --------------------------------------------------------------------------------
@@ -171,12 +178,13 @@
             
             a.setCollection(collection);
             
-            getPersistenceManager().insert("/test", a);
+            persistenceManager.insert("/test", a);
+            persistenceManager.save();
             
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/test");
             assertNotNull("a.collection is null", a.getCollection());
             assertTrue("Incorrect a.collection size", a.getCollection().size() == 3);
             assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
@@ -206,12 +214,13 @@
             collection.add(c4);
             a.setCollection(collection);
             
-            getPersistenceManager().update("/test", a);
+            persistenceManager.update("/test", a);
+            persistenceManager.save();
 
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/test");
             assertNotNull("a is null", a);
             assertNotNull("a.collection is null", a.getCollection());
             assertTrue("Incorrect collection size", a.getCollection().size() == 4);

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
Fri Oct  7 13:04:22 2005
@@ -24,6 +24,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.Page;
 import org.apache.portals.graffito.jcr.testmodel.Paragraph;
 import org.apache.portals.graffito.jcr.testmodel.hashmap.Element;
@@ -58,10 +59,12 @@
     {
         try
         {
-
-            if (getPersistenceManager().itemExists("/test"))
+        	PersistenceManager persistenceManager = getPersistenceManager();
+        	
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
+                persistenceManager.save();
             }
 
             // --------------------------------------------------------------------------------
@@ -84,12 +87,13 @@
             
             main.setElements(hashMapElement);
             
-            getPersistenceManager().insert("/test", main);
+            persistenceManager.insert("/test", main);
+            persistenceManager.save();
             
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            main = (Main) getPersistenceManager().getObject(Main.class, "/test");
+            main = (Main) persistenceManager.getObject(Main.class, "/test");
             assertNotNull("main.getElements() is null", main.getElements());
             assertTrue("Incorrect text", main.getText().equals("Main text"));           
             assertTrue("Incorrect para element", ((Element) main.getElements().get("e1")).getText().equals("Element
1"));
@@ -114,7 +118,8 @@
             hashMapElement.addObject(e3);
             main.setElements(hashMapElement);
             
-            getPersistenceManager().update("/test", main);
+            persistenceManager.update("/test", main);
+            persistenceManager.save();
 
             // --------------------------------------------------------------------------------
             // Get the object
@@ -132,93 +137,6 @@
         
     }
 
-//    public void testAddElement()
-//    {
-//        try
-//        {
-//
-//            if (getPersistenceManager().itemExists("/test"))
-//            {
-//                getPersistenceManager().remove("/test");
-//            }
-//
-//            // --------------------------------------------------------------------------------
-//            // Create and store an object graph in the repository
-//            // --------------------------------------------------------------------------------
-//            A a = new A();
-//            
-//            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);
-//            
-//            getPersistenceManager().insert("/test", a);
-//            
-//            // --------------------------------------------------------------------------------
-//            // Get the object
-//            // --------------------------------------------------------------------------------
          
-//            a = (A) getPersistenceManager().getObject(A.class, "/test");
-//            assertNotNull("a.collection is null", a.getCollection());
-//            assertTrue("Incorrect a.collection size", a.getCollection().size() == 3);
-//            assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
-//            
-//            // --------------------------------------------------------------------------------
-//            // Update the object
-//            // --------------------------------------------------------------------------------
-//            c1 = new C();
-//            c1.setId("first");
-//            c1.setName("First Element");
-//            c2 = new C();
-//            c2.setId("second");
-//            c2.setName("Second Element");
-//            
-//            c3 = new C();
-//            c3.setId("third");
-//            c3.setName("Third Element");
-//            
-//            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);
-//            
-//            getPersistenceManager().update("/test", a);
-//
-//            // --------------------------------------------------------------------------------
-//            // Get the object
-//            // --------------------------------------------------------------------------------
          
-//            a = (A) getPersistenceManager().getObject(A.class, "/test");
-//            assertNotNull("a is null", a);
-//            assertNotNull("a.collection is null", a.getCollection());
-//            assertTrue("Incorrect collection size", a.getCollection().size() == 4);
-//            assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
-//            
-//        }
-//        catch (Exception e)
-//        {
-//            e.printStackTrace();
-//            fail("Exception occurs during the unit test : " + e);
-//        }
-//        
-//    }    
+
    
 }

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
Fri Oct  7 13:04:22 2005
@@ -25,6 +25,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.C;
 import org.apache.portals.graffito.jcr.testmodel.Page;
@@ -58,10 +59,12 @@
     {
         try
         {
+        	PersistenceManager persistenceManager = getPersistenceManager();
 
-            if (getPersistenceManager().itemExists("/test"))
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
+                persistenceManager.save();
             }
 
             // --------------------------------------------------------------------------------
@@ -78,12 +81,13 @@
             paragraphs.add(new Paragraph("Para 3"));
             page.setParagraphs(paragraphs);
             
-            getPersistenceManager().insert("/test", page);
+            persistenceManager.insert("/test", page);
+            persistenceManager.save();
             
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            page = (Page) getPersistenceManager().getObject(Page.class, "/test");
+            page = (Page) persistenceManager.getObject(Page.class, "/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);
@@ -100,13 +104,14 @@
             paragraphs.add(new Paragraph("Para 5"));
             page.setParagraphs(paragraphs);
             
-            getPersistenceManager().update("/test", page);
+            persistenceManager.update("/test", page);
+            persistenceManager.save();
 
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
 
-            page = (Page) getPersistenceManager().getObject(Page.class, "/test");
+            page = (Page) persistenceManager.getObject(Page.class, "/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);

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerAtomicQueryTest.java
Fri Oct  7 13:04:22 2005
@@ -194,10 +194,11 @@
 		try
 		{
 
+			PersistenceManager persistenceManager = getPersistenceManager();
 			
-			if (getPersistenceManager().itemExists("/test"))
+			if (persistenceManager.itemExists("/test"))
 			{
-				getPersistenceManager().remove("/test");
+				persistenceManager.remove("/test");
 			}
 
 			
@@ -228,10 +229,11 @@
 					 a.setByteArray("This is small object stored in a Graffito repository".getBytes());
 					 a.setInputStream(new ByteArrayInputStream("Another Stream".getBytes()));
 				}
-				getPersistenceManager().insert("/test" + i, a);
+				persistenceManager.insert("/test" + i, a);
 				
 				
 			}
+			persistenceManager.save();
 
 		}
 		catch (Exception e)

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerIteratorQueryTest.java
Fri Oct  7 13:04:22 2005
@@ -110,14 +110,16 @@
         
     	try
 		{
-        	if (getPersistenceManager().itemExists("/test"))
+    		PersistenceManager persistenceManager = getPersistenceManager();
+    		
+        	if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
             }
         	
-			PersistenceManagerImpl persistenceManager = (PersistenceManagerImpl) getPersistenceManager();
+			PersistenceManagerImpl persistenceManagerImpl = (PersistenceManagerImpl) persistenceManager;
 			
-			Session session = persistenceManager.getSession();
+			Session session = persistenceManagerImpl.getSession();
 			Node root = session.getRootNode();
 			root.addNode("test");
 			root.addNode("test/node1");
@@ -136,7 +138,7 @@
 			paragraphs.add(new Paragraph("Another Para "));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node1/page1", page);
+			persistenceManager.insert("/test/node1/page1", page);
 						
 			
 			page = new Page();
@@ -150,7 +152,7 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node1/page2", page);
+			persistenceManager.insert("/test/node1/page2", page);
 			
 			page = new Page();
 			page.setTitle("Page 3 Title");
@@ -163,7 +165,7 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node2/page1", page);
+			persistenceManager.insert("/test/node2/page1", page);
 
 			page = new Page();
 			page.setTitle("Page 4 Title");
@@ -176,7 +178,9 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node2/page2", page);
+			persistenceManager.insert("/test/node2/page2", page);
+			
+			persistenceManager.save();
 			
 
 			

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerScopeQueryTest.java
Fri Oct  7 13:04:22 2005
@@ -146,14 +146,15 @@
         
     	try
 		{
-        	if (getPersistenceManager().itemExists("/test"))
+    		PersistenceManager persistenceManager = getPersistenceManager();
+        	if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
             }
         	
-			PersistenceManagerImpl persistenceManager = (PersistenceManagerImpl) getPersistenceManager();
+			PersistenceManagerImpl persistenceManagerImpl = (PersistenceManagerImpl) persistenceManager;
 			
-			Session session = persistenceManager.getSession();
+			Session session = persistenceManagerImpl.getSession();
 			Node root = session.getRootNode();
 			root.addNode("test");
 			root.addNode("test/node1");
@@ -172,7 +173,7 @@
 			paragraphs.add(new Paragraph("Another Para "));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node1/page1", page);
+			persistenceManager.insert("/test/node1/page1", page);
 						
 			
 			page = new Page();
@@ -186,7 +187,7 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node1/page2", page);
+			persistenceManager.insert("/test/node1/page2", page);
 			
 			page = new Page();
 			page.setTitle("Page 3 Title");
@@ -199,7 +200,7 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node2/page1", page);
+			persistenceManager.insert("/test/node2/page1", page);
 
 			page = new Page();
 			page.setTitle("Page 4 Title");
@@ -212,8 +213,8 @@
 			paragraphs.add(new Paragraph("Another Para"));
 			page.setParagraphs(paragraphs);
 			
-			getPersistenceManager().insert("/test/node2/page2", page);
-			
+			persistenceManager.insert("/test/node2/page2", page);
+			persistenceManager.save();
 
 			
 		}

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSimpleQueryTest.java
Fri Oct  7 13:04:22 2005
@@ -214,10 +214,10 @@
     
     private void importData() throws JcrMappingException 
     {
-        
-    	if (getPersistenceManager().itemExists("/test"))
+    	PersistenceManager persistenceManager = getPersistenceManager();
+    	if (persistenceManager.itemExists("/test"))
         {
-            getPersistenceManager().remove("/test");
+            persistenceManager.remove("/test");
         }
 
         Page page = new Page();
@@ -231,7 +231,8 @@
         paragraphs.add(new Paragraph("Another Para "));
         page.setParagraphs(paragraphs);
         
-        getPersistenceManager().insert("/test", page);            
+        persistenceManager.insert("/test", page);  
+        persistenceManager.save();
                 
 
     }

Modified: incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java?rev=307182&r1=307181&r2=307182&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
Fri Oct  7 13:04:22 2005
@@ -30,6 +30,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.B;
 import org.apache.portals.graffito.jcr.testmodel.C;
@@ -63,10 +64,11 @@
     {
         try
         {
+        	PersistenceManager persistenceManager = getPersistenceManager();
 
-            if (getPersistenceManager().itemExists("/test"))
+            if (persistenceManager.itemExists("/test"))
             {
-                getPersistenceManager().remove("/test");
+                persistenceManager.remove("/test");
             }
 
             // --------------------------------------------------------------------------------
@@ -99,12 +101,14 @@
             
             a.setCollection(collection);
             
-            getPersistenceManager().insert("/test", a);
+            persistenceManager.insert("/test", a);
+            persistenceManager.save();
+            
 
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/test");
             assertNotNull("a is null", a);
             assertTrue("Incorrect a1", a.getA1().equals("a1"));
             assertNotNull("a.b is null", a.getB());
@@ -122,16 +126,18 @@
             a.setB(newB);
             
             
-            getPersistenceManager().update("/test", a);
+            persistenceManager.update("/test", a);
+            persistenceManager.save();
 
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------
          
-            a = (A) getPersistenceManager().getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject(A.class, "/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"));
+            
 
             
         }



Mime
View raw message