You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/05/28 23:52:02 UTC
[1/2] incubator-tinkerpop git commit: Add some tests to structure
utility classes.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/neo4j-gremlin-apache c850d5e77 -> 81d125ab8
Add some tests to structure utility classes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/0b4e5552
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/0b4e5552
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/0b4e5552
Branch: refs/heads/neo4j-gremlin-apache
Commit: 0b4e55524756e8ebdcb9ea593934e438413999ef
Parents: c1006ee
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 28 17:41:04 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 28 17:41:04 2015 -0400
----------------------------------------------------------------------
gremlin-core/pom.xml | 7 +
.../gremlin/structure/util/GraphFactory.java | 14 +-
.../structure/util/GraphVariableHelper.java | 4 +-
.../apache/tinkerpop/gremlin/TestHelper.java | 20 ++
.../structure/util/GraphFactoryTest.java | 323 +++++++++++++++++++
.../structure/util/GraphVariableHelperTest.java | 72 +++++
.../structure/util/StringFactoryTest.java | 32 ++
.../structure/util/mockgraph-busted.yaml | 20 ++
.../gremlin/structure/util/mockgraph.properties | 18 ++
.../gremlin/structure/util/mockgraph.xml | 22 ++
.../gremlin/structure/util/mockgraph.yaml | 19 ++
11 files changed, 545 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-core/pom.xml b/gremlin-core/pom.xml
index 62281e8..ec15ba8 100644
--- a/gremlin-core/pom.xml
+++ b/gremlin-core/pom.xml
@@ -96,6 +96,13 @@ limitations under the License.
<version>1.3</version>
<scope>test</scope>
</dependency>
+ <!-- needed to test GraphFactory and xml based config via optional dependency in apache configurations -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<directory>${basedir}/target</directory>
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactory.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactory.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactory.java
index 0a91820..f859b7c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactory.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactory.java
@@ -35,7 +35,9 @@ import java.util.Map;
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
-public class GraphFactory {
+public final class GraphFactory {
+
+ private GraphFactory() {}
/**
* Open a graph. See each {@link org.apache.tinkerpop.gremlin.structure.Graph} instance for its configuration options.
@@ -76,9 +78,13 @@ public class GraphFactory {
}
/**
- * Open a graph. See each {@link org.apache.tinkerpop.gremlin.structure.Graph} instance for its configuration options. This file may be XML, YAML,
+ * Open a graph. See each {@link Graph} instance for its configuration options. This file may be XML, YAML,
* or a standard properties file. How the configuration is used (and which kind is required) is dependent on
* the implementation.
+ * <p/>
+ * If using XML, ensure that the appropriate version of Apache {@code commons-collections} is available on the
+ * classpath as it is an optional dependency of Apache {@code commons-configuration}, the library that
+ * {@code GraphFactory} depends on.
*
* @param configurationFile The location of a configuration file that specifies the minimally required properties
* for a {@link org.apache.tinkerpop.gremlin.structure.Graph} instance. This minimum is determined by the {@link org.apache.tinkerpop.gremlin.structure.Graph} instance
@@ -99,13 +105,11 @@ public class GraphFactory {
* @return A Graph instance.
*/
public static Graph open(final Map configuration) {
+ if (null == configuration) throw Graph.Exceptions.argumentCanNotBeNull("configuration");
return open(new MapConfiguration(configuration));
}
private static Configuration getConfiguration(final File configurationFile) {
- if (null == configurationFile)
- throw Graph.Exceptions.argumentCanNotBeNull("configurationFile");
-
if (!configurationFile.isFile())
throw new IllegalArgumentException(String.format("The location configuration must resolve to a file and [%s] does not", configurationFile));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelper.java
index f7e251c..7c9a6b5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelper.java
@@ -23,7 +23,9 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
-public class GraphVariableHelper {
+public final class GraphVariableHelper {
+
+ private GraphVariableHelper() { }
public static void validateVariable(final String variable, final Object value) throws IllegalArgumentException {
if (null == value)
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/TestHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/TestHelper.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/TestHelper.java
index 3a8f8c3..84087e6 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/TestHelper.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/TestHelper.java
@@ -19,7 +19,9 @@
package org.apache.tinkerpop.gremlin;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.net.URL;
@@ -75,4 +77,22 @@ public final class TestHelper {
final String clsPath = url.getPath();
return clsPath.substring(0, clsPath.length() - clsUri.length());
}
+
+ /**
+ * See {@code TestHelper} in gremlin-test for the official version.
+ */
+ public static File generateTempFileFromResource(final Class resourceClass, final String resourceName, final String extension) throws IOException {
+ final File temp = makeTestDataPath(resourceClass, "resources");
+ if (!temp.exists()) temp.mkdirs();
+ final File tempFile = new File(temp, resourceName + extension);
+ final FileOutputStream outputStream = new FileOutputStream(tempFile);
+ int data;
+ final InputStream inputStream = resourceClass.getResourceAsStream(resourceName);
+ while ((data = inputStream.read()) != -1) {
+ outputStream.write(data);
+ }
+ outputStream.close();
+ inputStream.close();
+ return tempFile;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
new file mode 100644
index 0000000..118ac05
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
@@ -0,0 +1,323 @@
+/*
+ * 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.structure.util;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphFactoryTest {
+ @Test
+ public void shouldBeUtilityClass() throws Exception {
+ TestHelper.assertIsUtilityClass(GraphFactory.class);
+ }
+
+ @Test
+ public void shouldThrowExceptionOnNullConfiguration() {
+ try {
+ GraphFactory.open((Configuration) null);
+ fail("Should have thrown an exception since configuration is null");
+ } catch (Exception ex) {
+ final Exception expected = Graph.Exceptions.argumentCanNotBeNull("configuration");
+ assertEquals(expected.getClass(), ex.getClass());
+ assertEquals(expected.getMessage(), ex.getMessage());
+ }
+ }
+
+ @Test
+ public void shouldThrowExceptionOnNullMapConfiguration() {
+ try {
+ GraphFactory.open((Map) null);
+ fail("Should have thrown an exception since configuration is null");
+ } catch (Exception ex) {
+ final Exception expected = Graph.Exceptions.argumentCanNotBeNull("configuration");
+ assertEquals(expected.getClass(), ex.getClass());
+ assertEquals(expected.getMessage(), ex.getMessage());
+ }
+ }
+
+ @Test
+ public void shouldThrowExceptionOnNullFileConfiguration() {
+ try {
+ GraphFactory.open((String) null);
+ fail("Should have thrown an exception since configuration is null");
+ } catch (Exception ex) {
+ final Exception expected = Graph.Exceptions.argumentCanNotBeNull("configurationFile");
+ assertEquals(expected.getClass(), ex.getClass());
+ assertEquals(expected.getMessage(), ex.getMessage());
+ }
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void shouldThrowExceptionOnIfConfigurationFileIsNotAnActualFile() {
+ GraphFactory.open(TestHelper.makeTestDataPath(GraphFactoryTest.class, "path").getAbsolutePath());
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphKeyIsNotPresentInConfiguration() {
+ final Configuration conf = new BaseConfiguration();
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphKeyIsNotPresentInMapConfig() {
+ final Map<String,Object> conf = new HashMap<>();
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphKeyIsNotValidClassInConfiguration() {
+ final Configuration conf = new BaseConfiguration();
+ conf.setProperty(Graph.GRAPH, "not.a.real.class.that.is.a.SomeGraph");
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphKeyIsNotValidClassInMapConfig() {
+ final Map<String,Object> conf = new HashMap<>();
+ conf.put(Graph.GRAPH, "not.a.real.class.that.is.a.SomeGraph");
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphDoesNotHaveOpenMethodViaConfiguration() {
+ final Configuration conf = new BaseConfiguration();
+ conf.setProperty(Graph.GRAPH, MockGraphWithoutOpen.class.getName());
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphDoesNotHaveOpenMethodViaMapConfig() {
+ final Map<String,Object> conf = new HashMap<>();
+ conf.put(Graph.GRAPH, MockGraphWithoutOpen.class.getName());
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphThrowsWhileConfiguringViaConfiguration() {
+ final Configuration conf = new BaseConfiguration();
+ conf.setProperty(Graph.GRAPH, MockGraph.class.getName());
+ conf.setProperty("throw", "it");
+ GraphFactory.open(conf);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void shouldThrowExceptionIfGraphThrowsWhileConfiguringViaMapConfig() {
+ final Map<String,Object> conf = new HashMap<>();
+ conf.put(Graph.GRAPH, MockGraph.class.getName());
+ conf.put("throw", "it");
+ GraphFactory.open(conf);
+ }
+
+ @Test
+ public void shouldOpenViaConfiguration() {
+ final Configuration conf = new BaseConfiguration();
+ conf.setProperty(Graph.GRAPH, MockGraph.class.getName());
+ conf.setProperty("keep", "it");
+ GraphFactory.open(conf);
+ final MockGraph g = (MockGraph) GraphFactory.open(conf);
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaMapConfig() {
+ final Map<String,Object> conf = new HashMap<>();
+ conf.put(Graph.GRAPH, MockGraph.class.getName());
+ conf.put("keep", "it");
+ final MockGraph g = (MockGraph) GraphFactory.open(conf);
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaPropertiesFileConfig() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph.properties", ".properties");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaPropertiesFileConfigAsDefault() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph.properties", ".notrecognized");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaXmlFileConfig() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph.xml", ".xml");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaYamlFileConfig() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph.yaml", ".yaml");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test
+ public void shouldOpenViaYmlFileConfig() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph.yaml", ".yml");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void shouldThrowOnInvalidConfigTypeViaFileConfig() throws IOException {
+ final File confFile = TestHelper.generateTempFileFromResource(GraphFactoryTest.class, "mockgraph-busted.yaml", ".yaml");
+ final MockGraph g = (MockGraph) GraphFactory.open(confFile.getAbsolutePath());
+ assertEquals(MockGraph.class.getName(), g.getConf().getString(Graph.GRAPH));
+ assertEquals("it", g.getConf().getString("keep"));
+ }
+
+ public static class MockGraphWithoutOpen implements Graph {
+ @Override
+ public Vertex addVertex(final Object... keyValues) {
+ return null;
+ }
+
+ @Override
+ public <C extends GraphComputer> C compute(final Class<C> graphComputerClass) throws IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public GraphComputer compute() throws IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Object... vertexIds) {
+ return null;
+ }
+
+ @Override
+ public Iterator<Edge> edges(final Object... edgeIds) {
+ return null;
+ }
+
+ @Override
+ public Transaction tx() {
+ return null;
+ }
+
+ @Override
+ public Variables variables() {
+ return null;
+ }
+
+ @Override
+ public Configuration configuration() {
+ return null;
+ }
+
+ @Override
+ public void close() throws Exception {
+
+ }
+ }
+
+ public static class MockGraph implements Graph {
+
+ private final Configuration conf;
+ MockGraph(final Configuration conf) {
+ this.conf = conf;
+ }
+
+ public Configuration getConf() {
+ return conf;
+ }
+
+ public static Graph open(final Configuration conf) {
+ if (conf.containsKey("throw")) throw new RuntimeException("you said to throw me");
+ return new MockGraph(conf);
+ }
+
+ @Override
+ public Vertex addVertex(final Object... keyValues) {
+ return null;
+ }
+
+ @Override
+ public <C extends GraphComputer> C compute(final Class<C> graphComputerClass) throws IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public GraphComputer compute() throws IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(final Object... vertexIds) {
+ return null;
+ }
+
+ @Override
+ public Iterator<Edge> edges(final Object... edgeIds) {
+ return null;
+ }
+
+ @Override
+ public Transaction tx() {
+ return null;
+ }
+
+ @Override
+ public Variables variables() {
+ return null;
+ }
+
+ @Override
+ public Configuration configuration() {
+ return null;
+ }
+
+ @Override
+ public void close() throws Exception {
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelperTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelperTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelperTest.java
new file mode 100644
index 0000000..af67d8b
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphVariableHelperTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.structure.util;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class GraphVariableHelperTest {
+ @Test
+ public void shouldBeUtilityClass() throws Exception {
+ TestHelper.assertIsUtilityClass(GraphVariableHelper.class);
+ }
+
+ @Test
+ public void shouldThrowIfValueIsNull() {
+ try {
+ GraphVariableHelper.validateVariable("test", null);
+ fail("Should have thrown an exception when value is null");
+ } catch (Exception iae) {
+ final Exception expected = Graph.Variables.Exceptions.variableValueCanNotBeNull();
+ assertEquals(expected.getClass(), iae.getClass());
+ assertEquals(expected.getMessage(), iae.getMessage());
+ }
+ }
+
+ @Test
+ public void shouldThrowIfKeyIsNull() {
+ try {
+ GraphVariableHelper.validateVariable(null, "test");
+ fail("Should have thrown an exception when key is null");
+ } catch (Exception iae) {
+ final Exception expected = Graph.Variables.Exceptions.variableKeyCanNotBeNull();
+ assertEquals(expected.getClass(), iae.getClass());
+ assertEquals(expected.getMessage(), iae.getMessage());
+ }
+ }
+
+ @Test
+ public void shouldThrowIfKeyIsEmpty() {
+ try {
+ GraphVariableHelper.validateVariable("", "test");
+ fail("Should have thrown an exception when key is empty");
+ } catch (Exception iae) {
+ final Exception expected = Graph.Variables.Exceptions.variableKeyCanNotBeEmpty();
+ assertEquals(expected.getClass(), iae.getClass());
+ assertEquals(expected.getMessage(), iae.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/StringFactoryTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/StringFactoryTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/StringFactoryTest.java
new file mode 100644
index 0000000..3dca988
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/StringFactoryTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.structure.util;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.junit.Test;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class StringFactoryTest {
+ @Test
+ public void shouldBeUtilityClass() throws Exception {
+ TestHelper.assertIsUtilityClass(StringFactory.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph-busted.yaml
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph-busted.yaml b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph-busted.yaml
new file mode 100644
index 0000000..06adaf9
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph-busted.yaml
@@ -0,0 +1,20 @@
+# 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.
+gremlin: {
+ graph: org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest$MockGraph }
+keep: it
+x = y{]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.properties
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.properties b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.properties
new file mode 100644
index 0000000..81e0d65
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.properties
@@ -0,0 +1,18 @@
+# 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.
+gremlin.graph=org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest$MockGraph
+keep=it
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.xml
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.xml b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.xml
new file mode 100644
index 0000000..bab7273
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.xml
@@ -0,0 +1,22 @@
+<!--
+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.
+-->
+<tinkerpop>
+ <gremlin>
+ <graph>org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest$MockGraph</graph>
+ </gremlin>
+ <keep>it</keep>
+</tinkerpop>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b4e5552/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.yaml
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.yaml b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.yaml
new file mode 100644
index 0000000..b42f10f
--- /dev/null
+++ b/gremlin-core/src/test/resources/org/apache/tinkerpop/gremlin/structure/util/mockgraph.yaml
@@ -0,0 +1,19 @@
+# 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.
+gremlin: {
+ graph: org.apache.tinkerpop.gremlin.structure.util.GraphFactoryTest$MockGraph }
+keep: it
\ No newline at end of file
[2/2] incubator-tinkerpop git commit: Merge branch 'master' into
neo4j-gremlin-apache
Posted by ok...@apache.org.
Merge branch 'master' into neo4j-gremlin-apache
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/81d125ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/81d125ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/81d125ab
Branch: refs/heads/neo4j-gremlin-apache
Commit: 81d125ab808d13fa97ebf4c0b787fd15ace1a4d7
Parents: c850d5e 0b4e555
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu May 28 15:52:12 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu May 28 15:52:12 2015 -0600
----------------------------------------------------------------------
gremlin-core/pom.xml | 7 +
.../gremlin/structure/util/GraphFactory.java | 14 +-
.../structure/util/GraphVariableHelper.java | 4 +-
.../apache/tinkerpop/gremlin/TestHelper.java | 20 ++
.../structure/util/GraphFactoryTest.java | 323 +++++++++++++++++++
.../structure/util/GraphVariableHelperTest.java | 72 +++++
.../structure/util/StringFactoryTest.java | 32 ++
.../structure/util/mockgraph-busted.yaml | 20 ++
.../gremlin/structure/util/mockgraph.properties | 18 ++
.../gremlin/structure/util/mockgraph.xml | 22 ++
.../gremlin/structure/util/mockgraph.yaml | 19 ++
11 files changed, 545 insertions(+), 6 deletions(-)
----------------------------------------------------------------------