use of org.apache.tinkerpop.gremlin.driver.Client in project janusgraph by JanusGraph.
the class ConfigurationManagementGraphServerTest method bindingShouldExistAfterGraphIsCreated.
@Test
public void bindingShouldExistAfterGraphIsCreated() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
// create newGraph
client.submit("Map<String, Object> map = new HashMap<String, Object>(); map.put(\"storage.backend\", \"inmemory\"); " + "org.janusgraph.core.ConfiguredGraphFactory.createTemplateConfiguration(" + "org.janusgraph.util.system.ConfigurationUtil.loadMapConfiguration(map));" + "org.janusgraph.core.ConfiguredGraphFactory.create(\"newGraph\")");
Thread.sleep(1000, 0);
// assert newGraph is indeed bound
assertEquals(0, client.submit("newGraph.vertices().size()").all().get().get(0).getInt());
// assert newGraph_traversal is bound and the graphs are equivalent
assertEquals("newGraph", client.submit("newGraph_traversal.getGraph().getGraphName()").all().get().get(0).getString());
// Ensure that we can open a remote graph traversal source against the created graph, and execute traversals
GraphTraversalSource newGraphTraversal = traversal().withRemote(DriverRemoteConnection.using(cluster, "newGraph_traversal"));
assertEquals(0, newGraphTraversal.V().count().next().longValue());
cluster.close();
}
use of org.apache.tinkerpop.gremlin.driver.Client in project janusgraph by JanusGraph.
the class ConfigurationManagementGraphServerTest method bindingForConfigurationManagementGraphShouldExists.
@Test
public void bindingForConfigurationManagementGraphShouldExists() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
assertEquals(0, client.submit("ConfigurationManagementGraph.vertices().size()").all().get().get(0).getInt());
}
use of org.apache.tinkerpop.gremlin.driver.Client in project janusgraph by JanusGraph.
the class ConfigurationManagementGraphServerTest method newGraphDoesntExistsBeforeCreation.
@Test
public void newGraphDoesntExistsBeforeCreation() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
// assert ConfigurationManagementGraph is bound
assertEquals(0, client.submit("ConfigurationManagementGraph.vertices().size()").all().get().get(0).getInt());
// assert new graph is not bound
ExecutionException executionException = assertThrows(ExecutionException.class, () -> {
client.submit("newGraph").all().get();
});
assertEquals("org.apache.tinkerpop.gremlin.driver.exception.ResponseException: No such property: newGraph for class: Script3", executionException.getMessage());
}
use of org.apache.tinkerpop.gremlin.driver.Client in project janusgraph by JanusGraph.
the class JanusGraphChannelizerTest method bindingShouldExistAfterGraphIsCreated.
@Test
public void bindingShouldExistAfterGraphIsCreated() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
try {
// assert server is running correctly
assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
// assert ConfigurationManagementGraph is bound
assertEquals(0, client.submit("ConfigurationManagementGraph.vertices().size()").all().get().get(0).getInt());
// assert new graph is not bound
thrown.expect(ExecutionException.class);
thrown.expectMessage(equalTo("org.apache.tinkerpop.gremlin.driver.exception.ResponseException: No such property: " + "newGraph for class: Script3"));
client.submit("newGraph").all().get();
// create newGraph
client.submit("Map<String, Object> map = new HashMap<String, Object>(); map.put(\"storage.backend\", \"inmemory\"); " + "org.janusgraph.core.ConfiguredGraphFactory.createTemplateConfiguration(new MapConfiguration(map));" + "org.janusgraph.core.ConfiguredGraphFactory.create(\"newGraph\")");
// assert newGraph is indeed bound
assertEquals(0, client.submit("newGraph.vertices().size()").all().get().get(0).getInt());
// assert newGraph_traversal is bound and the graphs are equivalent
assertEquals("newGraph", client.submit("newGraph_traversal.getGraph().getGraphName()").all().get().get(0).getString());
} finally {
cluster.close();
}
}
use of org.apache.tinkerpop.gremlin.driver.Client in project cypher-for-gremlin by opencypher.
the class BytecodeCypherGremlinClientTest method setUp.
@Before
public void setUp() {
Client aliasedClient = gremlinServer.gremlinClient().alias("g");
client = new BytecodeCypherGremlinClient(aliasedClient, TranslatorFlavor.gremlinServer());
}
Aggregations