[06/15] tinkerpop git commit: TINKERPOP-1612 WIP - first step to removal of gremlin-groovy-test
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a5f528a5/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovySackTest.groovy -- diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovySackTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovySackTest.groovy deleted file mode 100644 index a478f6f..000 --- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroovySackTest.groovy +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.process.traversal.step.sideEffect - -import org.apache.tinkerpop.gremlin.process.traversal.Traversal -import org.apache.tinkerpop.gremlin.process.traversal.util.ScriptTraversal -import org.apache.tinkerpop.gremlin.structure.Vertex - -/** - * @author Marko A. Rodriguez (http://markorodriguez.com) - */ -public abstract class GroovySackTest { - -public static class Traversals extends SackTest { - -@Override -public Traversalget_g_withSackXhelloX_V_outE_sackXassignX_byXlabelX_inV_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack('hello').V.outE.sack(assign).by(label).inV.sack") -} - -@Override -public Traversal get_g_withSackX0X_V_outE_sackXsumX_byXweightX_inV_sack_sum() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(0.0d).V.outE.sack(sum).by('weight').inV.sack.sum()") -} - -@Override -public Traversal get_g_withSackX0X_V_repeatXoutE_sackXsumX_byXweightX_inVX_timesX2X_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(0.0d).V.repeat(__.outE.sack(sum).by('weight').inV).times(2).sack()") -} - -@Override -public Traversal get_g_withSackX0X_V_outE_sackXsum_weightX_inV_sack_sum() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(0.0d).V().outE.sack(sum, 'weight').inV.sack.sum()") -} - -@Override -public Traversal get_g_withSackX0X_V_repeatXoutE_sackXsum_weightX_inVX_timesX2X_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(0.0d).V.repeat(__.outE.sack(sum, 'weight').inV).times(2).sack") -} - -@Override -public Traversal get_g_withSackXmap__map_cloneX_V_out_out_sackXmap_a_nameX_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack{[:]}{ it.clone() }.V.out().out().sack { m, v -> m['a'] = v.name; m }.sack()") -} - -@Override -public Traversal get_g_withSackX1_sumX_VX1X_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack( -final Object v1Id) { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(1.0d,sum).V(v1Id).local(out('knows').barrier(normSack)).in('knows').barrier.sack", "v1Id", v1Id) -} - -@Override -public Traversal get_g_withBulkXfalseX_withSackX1_sumX_V_out_barrier_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withBulk(false).withSack(1, sum).V.out.barrier.sack") -} - -@Override -public Traversal get_g_withBulkXfalseX_withSackX1_sumX_VX1X_localXoutEXknowsX_barrierXnormSackX_inVX_inXknowsX_barrier_sack( -final Object v1Id) { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withBulk(false).withSack(1.0d, sum).V(v1Id).local(outE('knows').barrier(normSack).inV).in('knows').barrier.sack", "v1Id", v1Id) -} - -@Override -Traversal get_g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack() { -new ScriptTraversal<>(g, "gremlin-groovy", "g.withSack(BigInteger.TEN.pow(1000), assign).V.local(out('knows').barrier(normSack)).in('knows').barrier.sack") -}
[06/15] tinkerpop git commit: TINKERPOP-1612 WIP - first step to removal of gremlin-groovy-test
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa828940/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java -- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java deleted file mode 100644 index e3a713d..000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.jsr223.dsl.credential; - -import org.apache.tinkerpop.gremlin.AbstractGremlinTest; -import org.apache.tinkerpop.gremlin.FeatureRequirement; -import org.apache.tinkerpop.gremlin.FeatureRequirementSet; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.hamcrest.MatcherAssert; -import org.junit.Test; - -import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph.credentials; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class CredentialGraphTest extends AbstractGremlinTest { - -@Test -@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) -public void shouldCreateUser() { -final Vertex v = credentials(graph).createUser("stephen", "secret"); -assertEquals("stephen", v.value("username")); -assertEquals("user", v.label()); -assertNotEquals("secret", v.value("password")); // hashed to something -assertThat(v.value("password").toString().length(), greaterThan(0)); -} - -@Test -@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) -@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES) -public void shouldRemoveUser() { -MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); -credentials(graph).createUser("stephen", "secret"); -MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - -assertEquals(1, credentials(graph).removeUser("stephen")); -MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); -} - -@Test -@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) -public void shouldNotRemoveUser() { -MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); -credentials(graph).createUser("stephen", "secret"); -MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - -assertEquals(0, credentials(graph).removeUser("stephanie")); -MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); -} - -@Test -@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) -public void shouldFindUser() { -MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); -credentials(graph).createUser("marko", "secret"); -final Vertex stephen = credentials(graph).createUser("stephen", "secret"); -credentials(graph).createUser("daniel", "secret"); -MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - -assertEquals(stephen, credentials(graph).findUser("stephen")); -} - -@Test -@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) -public void shouldNotFindUser() { -MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); -credentials(graph).createUser("marko", "secret"); -credentials(graph).createUser("stephen", "secret"); -credentials(graph).createUser("daniel", "secret"); -