You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by jo...@apache.org on 2019/05/13 20:11:28 UTC

[cayenne] branch cayenne42testing3 created (now d447080)

This is an automated email from the ASF dual-hosted git repository.

johnthuss pushed a change to branch cayenne42testing3
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


      at d447080  Add failing test for 'less than NULL'

This branch includes the following new commits:

     new ff91fa7  Add failing test for transient insert and delete of a to-many relationship value
     new d447080  Add failing test for 'less than NULL'

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[cayenne] 01/02: Add failing test for transient insert and delete of a to-many relationship value

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

johnthuss pushed a commit to branch cayenne42testing3
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit ff91fa76ca04607c71440851894f19e2d3d7e97d
Author: John Huss <jo...@apache.org>
AuthorDate: Mon May 13 11:58:43 2019 -0500

    Add failing test for transient insert and delete of a to-many relationship value
---
 .../apache/cayenne/access/OptimisticLockingIT.java | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/OptimisticLockingIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/OptimisticLockingIT.java
index 14b623c..c24a4a3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/OptimisticLockingIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/OptimisticLockingIT.java
@@ -26,6 +26,7 @@ import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.query.SortOrder;
 import org.apache.cayenne.test.jdbc.DBHelper;
 import org.apache.cayenne.test.jdbc.TableHelper;
+import org.apache.cayenne.testdo.locking.LockingHelper;
 import org.apache.cayenne.testdo.locking.RelLockingTestEntity;
 import org.apache.cayenne.testdo.locking.SimpleLockingTestEntity;
 import org.apache.cayenne.unit.di.server.CayenneProjects;
@@ -454,10 +455,36 @@ public class OptimisticLockingIT extends ServerCase {
         SimpleLockingTestEntity object1 = object.getToSimpleLockingTest();
         object.setToSimpleLockingTest(null);
         context.commitChanges();
+        assertNull(object.getToSimpleLockingTest());
 
         // change to-one relationship to non-null and save... should lock on null value
         object.setToSimpleLockingTest(object1);
         context.commitChanges();
+        assertNotNull(object.getToSimpleLockingTest());
+    }
+    
+    @Test
+    public void testTransientInsertAndDeleteOfToManyRelationship() throws Exception {
+        createLockingOnToOneDataSet();
+
+        List<RelLockingTestEntity> allObjects = new SelectQuery<>(
+                RelLockingTestEntity.class).select(context);
+        assertEquals(1, allObjects.size());
+
+        RelLockingTestEntity object = allObjects.get(0);
+        
+        LockingHelper object1 = object.getLockingHelpers().get(0);
+        
+        // create and then immediately delete a to-many relationship value 
+        LockingHelper object2 = context.newObject(LockingHelper.class);
+        object.addToLockingHelpers(object2);
+        object.removeFromLockingHelpers(object2);
+        context.deleteObject(object2);
+        assertEquals(1, object.getLockingHelpers().size());
+
+        object1.setName("updated"); // this will force the commit to actually execute some SQL
+
+        context.commitChanges();
     }
     
     @Test


[cayenne] 02/02: Add failing test for 'less than NULL'

Posted by jo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

johnthuss pushed a commit to branch cayenne42testing3
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit d44708010b3ed37f94f6dce4570a27de499120ba
Author: John Huss <jo...@apache.org>
AuthorDate: Mon May 13 15:11:06 2019 -0500

    Add failing test for 'less than NULL'
---
 .../src/test/java/org/apache/cayenne/exp/ExpressionIT.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionIT.java b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionIT.java
index b2d8749..3e61669 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/exp/ExpressionIT.java
@@ -23,6 +23,7 @@ import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.testdo.testmap.Artist;
 import org.apache.cayenne.testdo.testmap.Painting;
@@ -125,4 +126,14 @@ public class ExpressionIT extends ServerCase {
 		assertNull(e4.first(paintingList));
 	}
 
+    @Test
+	public void testLessThanNull() {
+		Artist a1 = context.newObject(Artist.class);
+		a1.setArtistName("Picasso");
+		context.commitChanges();
+		
+		List<Artist> artists = ObjectSelect.query(Artist.class, Artist.ARTIST_NAME.lt((String)null)).select(context);
+		assertTrue("Less than 'NULL' never matches anything", artists.isEmpty());
+    }
+    
 }