streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [1/2] incubator-streams git commit: STREAMS-472: fixes root cause
Date Sun, 08 Jan 2017 18:44:05 GMT
Repository: incubator-streams
Updated Branches:
  refs/heads/master 08b6fac0d -> 9ef999423


STREAMS-472: fixes root cause


Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/16edd38d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/16edd38d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/16edd38d

Branch: refs/heads/master
Commit: 16edd38dfec66566969409c0ad9fc00a9bfeccd8
Parents: 7810361
Author: Steve Blackmon <sblackmon@apache.org>
Authored: Sat Jan 7 14:00:50 2017 -0600
Committer: Steve Blackmon <sblackmon@apache.org>
Committed: Sat Jan 7 14:00:50 2017 -0600

----------------------------------------------------------------------
 .../java/org/apache/streams/util/schema/SchemaStoreImpl.java    | 5 ++++-
 .../org/apache/streams/util/schema/test/SchemaOrderingTest.java | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/16edd38d/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
----------------------------------------------------------------------
diff --git a/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
b/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
index 8584333..ddb73c3 100644
--- a/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
+++ b/streams-util/src/main/java/org/apache/streams/util/schema/SchemaStoreImpl.java
@@ -392,7 +392,10 @@ public class SchemaStoreImpl extends Ordering<Schema> implements
SchemaStore {
         }
       }
     }
-    return 0;
+    // there still has to be some order even when there are no connections.
+    // we'll arbitrarily pick alphabetic by ID
+    int lexigraphic = right.toString().compareTo(left.toString());
+    return ( lexigraphic / Math.abs(lexigraphic) );
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/16edd38d/streams-util/src/test/java/org/apache/streams/util/schema/test/SchemaOrderingTest.java
----------------------------------------------------------------------
diff --git a/streams-util/src/test/java/org/apache/streams/util/schema/test/SchemaOrderingTest.java
b/streams-util/src/test/java/org/apache/streams/util/schema/test/SchemaOrderingTest.java
index 6713529..0d68ca7 100644
--- a/streams-util/src/test/java/org/apache/streams/util/schema/test/SchemaOrderingTest.java
+++ b/streams-util/src/test/java/org/apache/streams/util/schema/test/SchemaOrderingTest.java
@@ -78,7 +78,8 @@ public class SchemaOrderingTest {
     schemaStore.create(alert.toURI());
     File update = new File("target/test-classes/activitystreams-schemas/verbs/update.json");
     schemaStore.create(update.toURI());
-    assert (schemaStore.compare( schemaStore.getByUri(alert.toURI()).get(), schemaStore.getByUri(update.toURI()).get())
== 0);
+    // update > alert b/c it's ascii is higher alphabetically
+    assert (schemaStore.compare( schemaStore.getByUri(alert.toURI()).get(), schemaStore.getByUri(update.toURI()).get())
== 1);
   }
 
   @Test


Mime
View raw message