You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/11/11 13:04:47 UTC

[1/2] incubator-tinkerpop git commit: Added unit test to Artifact

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 7ed6ecf2a -> c1af210f9


Added unit test to Artifact

Corrected bug in artifact.equal where a local variable was overriding a member variable with the same name.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/00583ecf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/00583ecf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/00583ecf

Branch: refs/heads/master
Commit: 00583ecfd2eba9e8003d9b6dae47df0442000e47
Parents: a9efe65
Author: Nghia Tran <ng...@gmail.com>
Authored: Mon Nov 9 20:01:29 2015 -0500
Committer: Nghia Tran <ng...@gmail.com>
Committed: Tue Nov 10 18:48:00 2015 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/plugin/Artifact.java         | 10 +--
 .../gremlin/groovy/plugin/ArtifactTest.java     | 87 ++++++++++++++++++++
 2 files changed, 92 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/00583ecf/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
index 8f1cafe..29ce7d6 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/Artifact.java
@@ -63,15 +63,15 @@ public class Artifact {
     }
 
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         if (this == o) return true;
         if (o == null || getClass() != o.getClass()) return false;
 
-        Artifact artifact = (Artifact) o;
+        final Artifact a = (Artifact) o;
 
-        if (group != null ? !group.equals(artifact.group) : artifact.group != null) return false;
-        if (artifact != null ? !artifact.equals(artifact.artifact) : artifact.artifact != null) return false;
-        if (version != null ? !version.equals(artifact.version) : artifact.version != null) return false;
+        if (group != null ? !group.equals(a.group) : a.group != null) return false;
+        if (artifact != null ? !artifact.equals(a.artifact) : a.artifact != null) return false;
+        if (version != null ? !version.equals(a.version) : a.version != null) return false;
 
         return true;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/00583ecf/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
new file mode 100644
index 0000000..a876df8
--- /dev/null
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/plugin/ArtifactTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.tinkerpop.gremlin.groovy.plugin;
+
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+
+/**
+ * @author Nghia Tran (https://github.com/n-tran)
+ */
+public class ArtifactTest {
+    @Test
+    public void shouldBeEqualIfSame() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = a;
+
+        assertThat(a.equals(b), is(true));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfArgumentIsNull() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = null;
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfArgumentIsNotAnArtifact() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final String b = " ";
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheGroupIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("com.apacheTest.tinkerpop2","tinkergraph-gremlin","3.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheArtifactIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-artifact","3.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldNotBeEqualIfTheVersionIsNotEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","4.0.0");
+
+        assertThat(a.equals(b), is(false));
+    }
+
+    @Test
+    public void shouldBeEqual() {
+        final Artifact a = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+        final Artifact b = new Artifact("org.apache.tinkerpop","tinkergraph-gremlin","3.0.0");
+
+        assertThat(a.equals(b), is(true));
+    }
+}


[2/2] incubator-tinkerpop git commit: Merge branch 'TINKERPOP3-953' of https://github.com/n-tran/incubator-tinkerpop

Posted by sp...@apache.org.
Merge branch 'TINKERPOP3-953' of https://github.com/n-tran/incubator-tinkerpop


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

Branch: refs/heads/master
Commit: c1af210f984315b59676fa203403bdd3d3d36795
Parents: 7ed6ecf 00583ec
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Nov 11 06:42:34 2015 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Nov 11 06:42:34 2015 -0500

----------------------------------------------------------------------
 .../gremlin/groovy/plugin/Artifact.java         | 10 +--
 .../gremlin/groovy/plugin/ArtifactTest.java     | 87 ++++++++++++++++++++
 2 files changed, 92 insertions(+), 5 deletions(-)
----------------------------------------------------------------------