Search in sources :

Example 1 with SocialTraversalSource

use of com.datastax.dse.driver.api.core.graph.SocialTraversalSource in project java-driver by datastax.

the class GraphTraversalITBase method should_allow_use_of_dsl_graph_binary.

/**
 * A simple smoke test to ensure that a user can supply a custom {@link GraphTraversalSource} for
 * use with DSLs.
 *
 * @test_category dse:graph
 */
@Test
public void should_allow_use_of_dsl_graph_binary() throws Exception {
    Assumptions.assumeThat(isGraphBinary()).isTrue();
    SocialTraversalSource gSocial = socialTraversalSource();
    GraphStatement gs = newInstance(gSocial.persons("marko").knows("vadas").elementMap("name", "age"));
    GraphResultSet rs = session().execute(gs);
    List<GraphNode> results = rs.all();
    assertThat(results.size()).isEqualTo(1);
    assertThatContainsProperties(results.get(0).asMap(), "name", "marko", "age", 29);
    Assertions.assertThat(results.get(0).asMap().values()).contains("person");
}
Also used : GraphStatement(com.datastax.dse.driver.api.core.graph.GraphStatement) FluentGraphStatement(com.datastax.dse.driver.api.core.graph.FluentGraphStatement) ScriptGraphStatement(com.datastax.dse.driver.api.core.graph.ScriptGraphStatement) AsyncGraphResultSet(com.datastax.dse.driver.api.core.graph.AsyncGraphResultSet) GraphResultSet(com.datastax.dse.driver.api.core.graph.GraphResultSet) GraphNode(com.datastax.dse.driver.api.core.graph.GraphNode) SocialTraversalSource(com.datastax.dse.driver.api.core.graph.SocialTraversalSource) Test(org.junit.Test)

Example 2 with SocialTraversalSource

use of com.datastax.dse.driver.api.core.graph.SocialTraversalSource in project java-driver by datastax.

the class GraphTraversalITBase method should_allow_use_of_dsl_graphson.

/**
 * A simple smoke test to ensure that a user can supply a custom {@link GraphTraversalSource} for
 * use with DSLs.
 *
 * @test_category dse:graph
 */
@Test
public void should_allow_use_of_dsl_graphson() throws Exception {
    Assumptions.assumeThat(isGraphBinary()).isFalse();
    SocialTraversalSource gSocial = socialTraversalSource();
    GraphStatement gs = newInstance(gSocial.persons("marko").knows("vadas"));
    GraphResultSet rs = session().execute(gs);
    List<GraphNode> results = rs.all();
    assertThat(results.size()).isEqualTo(1);
    assertThat(results.get(0).asVertex()).hasProperty("name", "marko").hasProperty("age", 29).hasLabel("person");
}
Also used : GraphStatement(com.datastax.dse.driver.api.core.graph.GraphStatement) FluentGraphStatement(com.datastax.dse.driver.api.core.graph.FluentGraphStatement) ScriptGraphStatement(com.datastax.dse.driver.api.core.graph.ScriptGraphStatement) AsyncGraphResultSet(com.datastax.dse.driver.api.core.graph.AsyncGraphResultSet) GraphResultSet(com.datastax.dse.driver.api.core.graph.GraphResultSet) GraphNode(com.datastax.dse.driver.api.core.graph.GraphNode) SocialTraversalSource(com.datastax.dse.driver.api.core.graph.SocialTraversalSource) Test(org.junit.Test)

Aggregations

AsyncGraphResultSet (com.datastax.dse.driver.api.core.graph.AsyncGraphResultSet)2 FluentGraphStatement (com.datastax.dse.driver.api.core.graph.FluentGraphStatement)2 GraphNode (com.datastax.dse.driver.api.core.graph.GraphNode)2 GraphResultSet (com.datastax.dse.driver.api.core.graph.GraphResultSet)2 GraphStatement (com.datastax.dse.driver.api.core.graph.GraphStatement)2 ScriptGraphStatement (com.datastax.dse.driver.api.core.graph.ScriptGraphStatement)2 SocialTraversalSource (com.datastax.dse.driver.api.core.graph.SocialTraversalSource)2 Test (org.junit.Test)2