use of com.datastax.dse.driver.api.core.graph.GraphStatement in project java-driver by datastax.
the class GraphSupportCheckerTest method should_pickup_graph_protocol_from_statement.
@Test
@UseDataProvider(location = DseTestDataProviders.class, value = "supportedGraphProtocols")
public void should_pickup_graph_protocol_from_statement(GraphProtocol graphProtocol) {
GraphStatement graphStatement = mock(GraphStatement.class);
DriverExecutionProfile executionProfile = mock(DriverExecutionProfile.class);
when(graphStatement.getSubProtocol()).thenReturn(graphProtocol.toInternalCode());
GraphProtocol inferredProtocol = new GraphSupportChecker().inferGraphProtocol(graphStatement, executionProfile, mock(InternalDriverContext.class));
assertThat(inferredProtocol).isEqualTo(graphProtocol);
verifyZeroInteractions(executionProfile);
}
use of com.datastax.dse.driver.api.core.graph.GraphStatement 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");
}
use of com.datastax.dse.driver.api.core.graph.GraphStatement in project java-driver by datastax.
the class GraphSupportCheckerTest method should_support_paging_when_statement_profile_not_present_but_context_profile_has_paging_enabled.
@Test
public void should_support_paging_when_statement_profile_not_present_but_context_profile_has_paging_enabled() {
// given
GraphStatement graphStatement = mock(GraphStatement.class);
InternalDriverContext context = protocolWithPagingSupport(true);
contextGraphPagingEnabled(context, ENABLED);
addNodeWithDseVersion(context, Collections.singletonList(Version.parse("6.8.0")));
// when
boolean pagingEnabled = new GraphSupportChecker().isPagingEnabled(graphStatement, context);
// then
assertThat(pagingEnabled).isEqualTo(true);
}
use of com.datastax.dse.driver.api.core.graph.GraphStatement in project java-driver by datastax.
the class GraphSupportCheckerTest method should_check_if_paging_is_supported.
@UseDataProvider("graphPagingEnabledAndDseVersions")
@Test
public void should_check_if_paging_is_supported(boolean protocolWithPagingSupport, PagingEnabledOptions statementGraphPagingEnabled, PagingEnabledOptions contextGraphPagingEnabled, List<Version> nodeDseVersions, boolean expected) {
// given
GraphStatement graphStatement = mock(GraphStatement.class);
InternalDriverContext context = protocolWithPagingSupport(protocolWithPagingSupport);
statementGraphPagingEnabled(graphStatement, statementGraphPagingEnabled);
contextGraphPagingEnabled(context, contextGraphPagingEnabled);
addNodeWithDseVersion(context, nodeDseVersions);
// when
boolean pagingEnabled = new GraphSupportChecker().isPagingEnabled(graphStatement, context);
// then
assertThat(pagingEnabled).isEqualTo(expected);
}
Aggregations