You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2015/11/20 05:26:11 UTC

[02/19] usergrid git commit: Added test to prove shard ordering.

Added test to prove shard ordering.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/2b2793ff
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/2b2793ff
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/2b2793ff

Branch: refs/heads/master
Commit: 2b2793ffeddb0836ced383b13c25d8f86432b632
Parents: afffdf2
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Nov 16 19:00:20 2015 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Nov 16 19:00:20 2015 -0700

----------------------------------------------------------------------
 .../serialization/impl/shard/ShardTest.java     | 65 ++++++++++++++++++++
 1 file changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/2b2793ff/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardTest.java b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardTest.java
new file mode 100644
index 0000000..478873f
--- /dev/null
+++ b/stack/corepersistence/graph/src/test/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/ShardTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.usergrid.persistence.graph.serialization.impl.shard;
+
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+
+public class ShardTest {
+
+    @Test
+    public void testShardIndexOrder() {
+        final Shard first = new Shard( 1, 1, false );
+
+
+        final Shard second = new Shard( 2, 1, false );
+
+        assertTrue( first.compareTo( second ) < 0 );
+
+        assertTrue( second.compareTo( first ) > 0 );
+    }
+
+
+    @Test
+    public void testShardTimestapOrder() {
+        final Shard first = new Shard( 1, 1, false );
+
+
+        final Shard second = new Shard( 1, 2, false );
+
+        assertTrue( first.compareTo( second ) < 0 );
+
+        assertTrue( second.compareTo( first ) > 0 );
+    }
+
+
+    @Test
+    public void testShardCompactedOrder() {
+        final Shard first = new Shard( 1, 1, false );
+
+
+        final Shard second = new Shard( 1, 1, true );
+
+        assertTrue( first.compareTo( second ) < 0 );
+
+        assertTrue( second.compareTo( first ) > 0 );
+    }
+}