use of org.graphframes.GraphFrame in project Gaffer by gchq.
the class GraphFrameToIterableRowTest method shouldConvertGraphFrameToIterableOfRows.
@Test
public void shouldConvertGraphFrameToIterableOfRows() {
// Given
final SparkSession sparkSession = SparkSessionProvider.getSparkSession();
final Function<GraphFrame, Iterable<? extends Row>> function = new GraphFrameToIterableRow();
final GraphFrame graphFrame = Graphs$.MODULE$.friends();
// When
final Iterable<? extends Row> result = function.apply(graphFrame);
final List<Row> resultList = Lists.newArrayList(result);
// Then
assertThat(resultList).hasSize(15);
}
use of org.graphframes.GraphFrame in project Gaffer by gchq.
the class GetGraphFrameOfElementsHandlerTest method shouldGetCorrectElementsInGraphFrameWithNoElements.
@Test
public void shouldGetCorrectElementsInGraphFrameWithNoElements() throws OperationException {
// Given
final Graph graph = getGraph("/schema-GraphFrame/elements.json", new ArrayList<>());
final GetGraphFrameOfElements gfOperation = new GetGraphFrameOfElements.Builder().view(new View.Builder().edge(TestGroups.EDGE).edge(TestGroups.EDGE_2).entity(TestGroups.ENTITY).entity(TestGroups.ENTITY_2).build()).build();
// When
final GraphFrame graphFrame = graph.execute(gfOperation, new User());
// Then
assertTrue(graphFrame.edges().javaRDD().isEmpty());
assertTrue(graphFrame.vertices().javaRDD().isEmpty());
}
Aggregations