jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r537949 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test: java/org/apache/jackrabbit/ocm/persistence/basic/ java/org/apache/jackrabbit/ocm/testmodel/crossreference/ test-config/
Date Mon, 14 May 2007 18:50:29 GMT
Author: clombart
Date: Mon May 14 11:50:28 2007
New Revision: 537949

URL: http://svn.apache.org/viewvc?view=rev&rev=537949
Log:
Add more test for JCR-918 (Avoid INFINITE RECURSION when Object Model has cycles.)
 

Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/basic/PersistenceManagerAvoidRecursiveLoopTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/crossreference/A.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-avoidrecursiveloop.xml

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/basic/PersistenceManagerAvoidRecursiveLoopTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/basic/PersistenceManagerAvoidRecursiveLoopTest.java?view=diff&rev=537949&r1=537948&r2=537949
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/basic/PersistenceManagerAvoidRecursiveLoopTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/basic/PersistenceManagerAvoidRecursiveLoopTest.java
Mon May 14 11:50:28 2007
@@ -89,6 +89,14 @@
             a.setA1("a1");
             a.setA2("a2");
             
+            persistenceManager.insert(a);
+            persistenceManager.save();
+
+            // --------------------------------------------------------------------------------
+            // Get the object
+            // --------------------------------------------------------------------------------
          
+            a = (A) persistenceManager.getObject( "/test");
+            assertNotNull("a is null", a);
             
             B b = new B();
             b.setB1("b1");
@@ -109,7 +117,7 @@
             b2.setA(a);
             a.addB(b2);
 
-            persistenceManager.insert(a);
+            persistenceManager.update(a);
             persistenceManager.save();
             
 
@@ -120,11 +128,11 @@
             assertNotNull("a is null", a);
             assertTrue("Duplicate instance a", a == a.getB().getA());
             
-//            Collection collection = a.getCollection();
-//            assertTrue("Invalid number of items in the collection", collection.size() ==
2);
-//            B[] bs = (B[])collection.toArray();
-//            assertTrue("Duplicate instance a", a == bs[0].getA());
-//            assertTrue("Duplicate instance a", a == bs[1].getA());
+            Collection collection = a.getCollection();
+            assertTrue("Invalid number of items in the collection", collection.size() ==
2);
+            B[] bs = (B[]) collection.toArray(new B[2]);
+            assertTrue("Duplicate instance a", a == bs[0].getA());
+            assertTrue("Duplicate instance a", a == bs[1].getA());
             
         }
         catch (Exception e)

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/crossreference/A.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/crossreference/A.java?view=diff&rev=537949&r1=537948&r2=537949
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/crossreference/A.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/crossreference/A.java
Mon May 14 11:50:28 2007
@@ -29,6 +29,7 @@
 public class A
 {
 	private String path; 
+	private String uuid; 
     private String a1;
     private String a2;
     private B b;    
@@ -41,6 +42,17 @@
 	public void setPath(String path) {
 		this.path = path;
 	}
+	
+	
+	public String getUuid() {
+		return uuid;
+	}
+	
+	public void setUuid(String uuid) {
+		this.uuid = uuid;
+	}
+	
+	
 	/**
      * @return Returns the a1.
      */

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-avoidrecursiveloop.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-avoidrecursiveloop.xml?view=diff&rev=537949&r1=537948&r2=537949
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-avoidrecursiveloop.xml
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/test-config/jcrmapping-avoidrecursiveloop.xml
Mon May 14 11:50:28 2007
@@ -4,20 +4,20 @@
 <jackrabbit-ocm>
 
 	<class-descriptor
-		className="org.apache.jackrabbit.ocm.testmodel.crossreference.A" jcrNodeType="nt:unstructured"
>		
-		<field-descriptor fieldName="path" path="true" />
+		className="org.apache.jackrabbit.ocm.testmodel.crossreference.A" jcrNodeType="nt:unstructured"
jcrMixinTypes="mix:referenceable">		
+		<field-descriptor fieldName="path" path="true"/>
+		<field-descriptor fieldName="uuid" uuid="true"/>
 		<field-descriptor fieldName="a1" jcrName="a1" />
 		<field-descriptor fieldName="a2" jcrName="a2" />
 		<bean-descriptor fieldName="b" jcrName="b" proxy="false" />	
-		<collection-descriptor fieldName="collection"  proxy="false" 
-		                       elementClassName="org.apache.jackrabbit.ocm.testmodel.crossreference.B"

-		                       collectionConverter="org.apache.jackrabbit.ocm.persistence.collectionconverter.impl.NTCollectionConverterImpl"
/>                               
+		<collection-descriptor fieldName="collection" jcrName="collection"  proxy="false" 
+		                       elementClassName="org.apache.jackrabbit.ocm.testmodel.crossreference.B"
/>                               
 	</class-descriptor>
 
 	<class-descriptor className="org.apache.jackrabbit.ocm.testmodel.crossreference.B"  jcrNodeType="nt:unstructured"
>
 		<field-descriptor fieldName="b1" jcrName="b1"  />		
         <field-descriptor fieldName="b2" jcrName="b2"  />
-        <bean-descriptor fieldName="a" jcrName="a" proxy="false" converter="org.apache.jackrabbit.ocm.persistence.beanconverter.impl.ParentBeanConverterImpl"
/>
+        <bean-descriptor fieldName="a" jcrName="a" proxy="false" converter="org.apache.jackrabbit.ocm.persistence.beanconverter.impl.ReferenceBeanConverterImpl"
/>
 	</class-descriptor>
 
 </jackrabbit-ocm>



Mime
View raw message