use of org.apache.tinkerpop.gremlin.driver.Client in project cypher-for-gremlin by opencypher.
the class CypherRemoteAcceptor method connect.
@Override
public Object connect(List<String> args) throws RemoteException {
Object result = delegate.connect(args);
Client gremlinClient = getField(delegate, "currentClient");
Map<String, String> aliases = getField(delegate, "aliases");
if (aliases != null) {
gremlinClient = gremlinClient.alias(aliases);
}
client = configureClient(gremlinClient, args);
return result;
}
use of org.apache.tinkerpop.gremlin.driver.Client in project cypher-for-gremlin by opencypher.
the class CypherGremlinServerClient method translating.
@Test
public void translating() {
BaseConfiguration configuration = new BaseConfiguration();
configuration.setProperty("port", gremlinServer.getPort());
configuration.setProperty("hosts", Arrays.asList("localhost"));
Cluster cluster = Cluster.open(configuration);
Client gremlinClient = cluster.connect();
// freshReadmeSnippet: translating
CypherGremlinClient cypherGremlinClient = CypherGremlinClient.translating(gremlinClient);
// freshReadmeSnippet: translating
List<Map<String, Object>> results = cypherGremlinClient.submit("MATCH (p:person) WHERE p.age > 25 RETURN p.name").all();
assertThat(results).extracting("p.name").containsExactly("marko", "vadas", "josh", "peter");
}
use of org.apache.tinkerpop.gremlin.driver.Client in project cypher-for-gremlin by opencypher.
the class GremlinServerExternalResource method configuredGremlinClient.
private Client configuredGremlinClient() throws Exception {
Client gremlinClient;
String configPath = System.getProperty(GremlinClientFactory.TOKEN_CONFIG);
if (!Strings.isNullOrEmpty(configPath)) {
logger.info("Running tests using configuration " + configPath);
gremlinClient = Cluster.open(configPath).connect();
gremlinClient.submit(DROP_ALL).all().get();
gremlinClient.submit(CREATE_MODERN).all().get();
} else {
logger.info("Running tests using embeded TinkerGraph");
gremlinServer = tinkerGraph();
gremlinServer.start();
int port = gremlinServer.getPort();
gremlinClient = GremlinClientFactory.create(port);
}
return gremlinClient;
}
use of org.apache.tinkerpop.gremlin.driver.Client in project janusgraph by JanusGraph.
the class ConfigurationManagementGraphServerTest method ensureServerIsRunningCorrectly.
@Test
public void ensureServerIsRunningCorrectly() throws Exception {
final Cluster cluster = TestClientFactory.open();
final Client client = cluster.connect();
assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
}
Aggregations