cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/2] cayenne git commit: Cleanup tests
Date Wed, 01 Aug 2018 08:34:18 GMT
Repository: cayenne
Updated Branches:
  refs/heads/STABLE-4.0 ec2612d8f -> 62769a587


Cleanup tests


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/525f7bfb
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/525f7bfb
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/525f7bfb

Branch: refs/heads/STABLE-4.0
Commit: 525f7bfbde17f8d67b346ad27d2d0eaff7bc74b2
Parents: ec2612d
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Wed Aug 1 11:04:10 2018 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Wed Aug 1 11:04:10 2018 +0300

----------------------------------------------------------------------
 .../persistent/auto/_ClientMtTable1.java        | 51 ++++++--------------
 .../persistent/auto/_ClientMtTable2.java        | 20 ++------
 2 files changed, 19 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/525f7bfb/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java
b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java
index f471aa6..e7178e0 100644
--- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java
+++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable1.java
@@ -41,15 +41,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return dateAttribute;
     }
+
     public void setDateAttribute(LocalDate dateAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "dateAttribute", false);
-        }
-
-        Object oldValue = this.dateAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "dateAttribute", oldValue, dateAttribute);
+            objectContext.propertyChanged(this, "dateAttribute", this.dateAttribute, dateAttribute);
         }
         
         this.dateAttribute = dateAttribute;
@@ -62,15 +58,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return globalAttribute;
     }
+
     public void setGlobalAttribute(String globalAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "globalAttribute", false);
-        }
-
-        Object oldValue = this.globalAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute);
+            objectContext.propertyChanged(this, "globalAttribute", this.globalAttribute,
globalAttribute);
         }
         
         this.globalAttribute = globalAttribute;
@@ -83,15 +75,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return oldDateAttribute;
     }
+
     public void setOldDateAttribute(Date oldDateAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "oldDateAttribute", false);
-        }
-
-        Object oldValue = this.oldDateAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "oldDateAttribute", oldValue, oldDateAttribute);
+            objectContext.propertyChanged(this, "oldDateAttribute", this.oldDateAttribute,
oldDateAttribute);
         }
         
         this.oldDateAttribute = oldDateAttribute;
@@ -104,15 +92,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return serverAttribute;
     }
+
     public void setServerAttribute(String serverAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "serverAttribute", false);
-        }
-
-        Object oldValue = this.serverAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "serverAttribute", oldValue, serverAttribute);
+            objectContext.propertyChanged(this, "serverAttribute", this.serverAttribute,
serverAttribute);
         }
         
         this.serverAttribute = serverAttribute;
@@ -125,15 +109,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return timeAttribute;
     }
+
     public void setTimeAttribute(LocalTime timeAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "timeAttribute", false);
-        }
-
-        Object oldValue = this.timeAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "timeAttribute", oldValue, timeAttribute);
+            objectContext.propertyChanged(this, "timeAttribute", this.timeAttribute, timeAttribute);
         }
         
         this.timeAttribute = timeAttribute;
@@ -146,15 +126,11 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return timestampAttribute;
     }
+
     public void setTimestampAttribute(LocalDateTime timestampAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "timestampAttribute", false);
-        }
-
-        Object oldValue = this.timestampAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "timestampAttribute", oldValue, timestampAttribute);
+            objectContext.propertyChanged(this, "timestampAttribute", this.timestampAttribute,
timestampAttribute);
         }
         
         this.timestampAttribute = timestampAttribute;
@@ -169,6 +145,7 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         return table2Array;
     }
+
     public void addToTable2Array(ClientMtTable2 object) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "table2Array", true);
@@ -178,6 +155,7 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         this.table2Array.add(object);
     }
+
     public void removeFromTable2Array(ClientMtTable2 object) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "table2Array", true);
@@ -187,5 +165,4 @@ public abstract class _ClientMtTable1 extends PersistentObject {
 
         this.table2Array.remove(object);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/525f7bfb/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java
----------------------------------------------------------------------
diff --git a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java
b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java
index 598fcdf..a6c8c37 100644
--- a/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java
+++ b/cayenne-protostuff/src/test/java/org/apache/cayenne/rop/protostuff/persistent/auto/_ClientMtTable2.java
@@ -14,7 +14,7 @@ import org.apache.cayenne.util.PersistentObjectHolder;
 public abstract class _ClientMtTable2 extends PersistentObject {
 
     public static final Property<String> GLOBAL_ATTRIBUTE = Property.create("globalAttribute",
String.class);
-    public static final Property<org.apache.cayenne.rop.protostuff.persistent.MtTable1>
TABLE1 = Property.create("table1", org.apache.cayenne.rop.protostuff.persistent.MtTable1.class);
+    public static final Property<ClientMtTable1> TABLE1 = Property.create("table1",
ClientMtTable1.class);
 
     protected String globalAttribute;
     protected ValueHolder table1;
@@ -26,15 +26,11 @@ public abstract class _ClientMtTable2 extends PersistentObject {
 
         return globalAttribute;
     }
+
     public void setGlobalAttribute(String globalAttribute) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "globalAttribute", false);
-        }
-
-        Object oldValue = this.globalAttribute;
-        // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "globalAttribute", oldValue, globalAttribute);
+            objectContext.propertyChanged(this, "globalAttribute", this.globalAttribute,
globalAttribute);
         }
         
         this.globalAttribute = globalAttribute;
@@ -49,21 +45,15 @@ public abstract class _ClientMtTable2 extends PersistentObject {
 
         return (ClientMtTable1) table1.getValue();
     }
+
     public void setTable1(ClientMtTable1 table1) {
         if(objectContext != null) {
             objectContext.prepareForAccess(this, "table1", true);
+            objectContext.propertyChanged(this, "table1", this.table1.getValueDirectly(),
table1);
         } else if (this.table1 == null) {
         	this.table1 = new PersistentObjectHolder(this, "table1");
 		}
-
-        // note how we notify ObjectContext of change BEFORE the object is actually
-        // changed... this is needed to take a valid current snapshot
-        Object oldValue = this.table1.getValueDirectly();
-        if (objectContext != null) {
-        	objectContext.propertyChanged(this, "table1", oldValue, table1);
-        }
         
         this.table1.setValue(table1);
     }
-
 }


Mime
View raw message