cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kolonit...@apache.org
Subject cayenne git commit: fix DbImportActionTest.java, specify token order more precisely
Date Wed, 11 Feb 2015 07:56:02 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master d96dc300b -> 257b1eb56


fix DbImportActionTest.java, specify token order more precisely


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

Branch: refs/heads/master
Commit: 257b1eb565c7b6d0762610ae417f0abb6b9980a3
Parents: d96dc30
Author: kolonitsky <kolonitsky@apache.org>
Authored: Wed Feb 11 10:55:45 2015 +0300
Committer: kolonitsky <kolonitsky@apache.org>
Committed: Wed Feb 11 10:55:45 2015 +0300

----------------------------------------------------------------------
 .../org/apache/cayenne/tools/dbimport/DbImportAction.java     | 7 +++++--
 .../org/apache/cayenne/tools/dbimport/DbImportActionTest.java | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/257b1eb5/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
index fb55dd3..c795e34 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
@@ -133,11 +133,14 @@ public class DbImportAction {
         Collections.sort(reverse, new Comparator<MergerToken>() {
             @Override
             public int compare(MergerToken o1, MergerToken o2) {
-                if (o1 instanceof AddRelationshipToDb
-                        && o2 instanceof AddRelationshipToDb) {
+                if (o1 instanceof AddRelationshipToDb && o2 instanceof AddRelationshipToDb)
{
                     return 0;
                 }
 
+                if (!(o1 instanceof AddRelationshipToDb || o2 instanceof AddRelationshipToDb))
{
+                    return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+                }
+
                 return o1 instanceof AddRelationshipToDb ? 1 : -1;
             }
         });

http://git-wip-us.apache.org/repos/asf/cayenne/blob/257b1eb5/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportActionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportActionTest.java
b/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportActionTest.java
index 9e39c28..a303a6d 100644
--- a/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportActionTest.java
+++ b/cayenne-tools/src/test/java/org/apache/cayenne/tools/dbimport/DbImportActionTest.java
@@ -337,7 +337,7 @@ public class DbImportActionTest {
         tokens.add(new CreateTableToDb(null));
         tokens.add(new CreateTableToModel(null));
 
-        assertEquals(asList("CreateTableToModel", "CreateTableToDb", "AddColumnToDb", "AddRelationshipToDb"),
+        assertEquals(asList("AddColumnToDb", "CreateTableToDb", "CreateTableToModel", "AddRelationshipToDb"),
                 toClasses(DbImportAction.sort(tokens)));
     }
 


Mime
View raw message