cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1484111 - in /cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle: audit/AuditableFilterTest.java sort/WeightedAshwoodEntitySorterTest.java
Date Sat, 18 May 2013 13:22:30 GMT
Author: aadamchik
Date: Sat May 18 13:22:30 2013
New Revision: 1484111

URL: http://svn.apache.org/r1484111
Log:
seemed like dead code?

Modified:
    cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/audit/AuditableFilterTest.java
    cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/sort/WeightedAshwoodEntitySorterTest.java

Modified: cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/audit/AuditableFilterTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/audit/AuditableFilterTest.java?rev=1484111&r1=1484110&r2=1484111&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/audit/AuditableFilterTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/audit/AuditableFilterTest.java
Sat May 18 13:22:30 2013
@@ -18,7 +18,12 @@
  ****************************************************************/
 package org.apache.cayenne.lifecycle.audit;
 
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 import junit.framework.TestCase;
+
 import org.apache.cayenne.CayenneDataObject;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.DataChannelFilterChain;
@@ -30,18 +35,12 @@ import org.apache.cayenne.graph.GraphDif
 import org.apache.cayenne.lifecycle.db.Auditable1;
 import org.apache.cayenne.lifecycle.db.AuditableChildUuid;
 import org.apache.cayenne.lifecycle.id.IdCoder;
-import org.apache.cayenne.lifecycle.relationship.ObjectIdRelationshipFilter;
 import org.apache.cayenne.lifecycle.relationship.ObjectIdRelationshipHandler;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.map.ObjEntity;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 public class AuditableFilterTest extends TestCase {
 
     private AuditableProcessor processor;
@@ -52,15 +51,11 @@ public class AuditableFilterTest extends
     protected void setUp() throws Exception {
         processor = mock(AuditableProcessor.class);
         resolver = mock(EntityResolver.class);
-        
+
         ObjEntity objectEntity = new ObjEntity("CayenneDataObject");
         when(resolver.lookupObjEntity(any(Object.class))).thenReturn(objectEntity);
 
         runtime = new ServerRuntime("cayenne-lifecycle.xml");
-        // a filter is required to invalidate root objects after commit
-        ObjectIdRelationshipFilter filter = new ObjectIdRelationshipFilter();
-        runtime.getDataDomain().addFilter(filter);
-        runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(filter);
     }
 
     @Override
@@ -159,17 +154,16 @@ public class AuditableFilterTest extends
         audited13.writeProperty("parent", auditedParent1);
 
         DataChannelFilterChain chain = mock(DataChannelFilterChain.class);
-        when(chain.onSync(context, changes, DataChannel.FLUSH_CASCADE_SYNC)).thenAnswer(
-                new Answer<GraphDiff>() {
+        when(chain.onSync(context, changes, DataChannel.FLUSH_CASCADE_SYNC)).thenAnswer(new
Answer<GraphDiff>() {
 
-                    public GraphDiff answer(InvocationOnMock invocation) throws Throwable
{
-                        filter.updateAudit(auditedParent1);
-                        filter.updateAuditChild(audited11);
-                        filter.updateAuditChild(audited12);
-                        filter.updateAuditChild(audited13);
-                        return mock(GraphDiff.class);
-                    }
-                });
+            public GraphDiff answer(InvocationOnMock invocation) throws Throwable {
+                filter.updateAudit(auditedParent1);
+                filter.updateAuditChild(audited11);
+                filter.updateAuditChild(audited12);
+                filter.updateAuditChild(audited13);
+                return mock(GraphDiff.class);
+            }
+        });
 
         filter.onSync(context, changes, DataChannel.FLUSH_CASCADE_SYNC, chain);
 

Modified: cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/sort/WeightedAshwoodEntitySorterTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/sort/WeightedAshwoodEntitySorterTest.java?rev=1484111&r1=1484110&r2=1484111&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/sort/WeightedAshwoodEntitySorterTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/sort/WeightedAshwoodEntitySorterTest.java
Sat May 18 13:22:30 2013
@@ -24,7 +24,6 @@ import java.util.List;
 import junit.framework.TestCase;
 
 import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.lifecycle.relationship.ObjectIdRelationshipFilter;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.EntityResolver;
 
@@ -34,14 +33,7 @@ public class WeightedAshwoodEntitySorter
 
     @Override
     protected void setUp() throws Exception {
-
         runtime = new ServerRuntime("cayenne-lifecycle.xml");
-
-        // a filter is required to invalidate root objects after commit
-        ObjectIdRelationshipFilter filter = new ObjectIdRelationshipFilter();
-        runtime.getDataDomain().addFilter(filter);
-        runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(
-                filter);
     }
 
     @Override
@@ -53,19 +45,19 @@ public class WeightedAshwoodEntitySorter
 
         EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
 
-        // since it is impossible to ensure non-coincidental sort order of unrelated
-        // DbEntities (without overriding DbEntity.hashCode()), we'll test on 2 entities
-        // with a relationship, and reverse the topological order with SortWeight
+        // since it is impossible to ensure non-coincidental sort order of
+        // unrelated
+        // DbEntities (without overriding DbEntity.hashCode()), we'll test on 2
+        // entities
+        // with a relationship, and reverse the topological order with
+        // SortWeight
         // annotation.
 
-        List<DbEntity> eSorted = Arrays.asList(resolver.getDbEntity("SORT_DEP"), resolver
-                .getDbEntity("SORT_ROOT"));
+        List<DbEntity> eSorted = Arrays.asList(resolver.getDbEntity("SORT_DEP"), resolver.getDbEntity("SORT_ROOT"));
 
-        List<DbEntity> e1 = Arrays.asList(resolver.getDbEntity("SORT_ROOT"), resolver
-                .getDbEntity("SORT_DEP"));
+        List<DbEntity> e1 = Arrays.asList(resolver.getDbEntity("SORT_ROOT"), resolver.getDbEntity("SORT_DEP"));
 
-        List<DbEntity> e2 = Arrays.asList(resolver.getDbEntity("SORT_DEP"), resolver
-                .getDbEntity("SORT_ROOT"));
+        List<DbEntity> e2 = Arrays.asList(resolver.getDbEntity("SORT_DEP"), resolver.getDbEntity("SORT_ROOT"));
 
         WeightedAshwoodEntitySorter sorter = new WeightedAshwoodEntitySorter();
         sorter.setEntityResolver(resolver);



Mime
View raw message