use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class FilterToOperationConverterTest method testSpecifySource.
@Test
public void testSpecifySource() {
final Schema schema = getSchema();
final SparkSession sparkSession = SparkSessionProvider.getSparkSession();
final Filter[] filters = new Filter[1];
filters[0] = new EqualTo(SchemaToStructTypeConverter.SRC_COL_NAME, "0");
FiltersToOperationConverter converter = new FiltersToOperationConverter(getViewFromSchema(schema), schema, filters);
Operation operation = converter.getOperation();
assertTrue(operation instanceof GetRDDOfElements);
assertEquals(0, ((GraphFilters) operation).getView().getEntityGroups().size());
assertEquals(EDGE_GROUPS, ((GraphFilters) operation).getView().getEdgeGroups());
final Set<EntityId> seeds = new HashSet<>();
for (final Object seed : ((GetRDDOfElements) operation).getInput()) {
seeds.add((EntitySeed) seed);
}
assertEquals(Collections.singleton(new EntitySeed("0")), seeds);
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class FilterToOperationConverterTest method testSpecifyDestination.
@Test
public void testSpecifyDestination() {
final Schema schema = getSchema();
final SparkSession sparkSession = SparkSessionProvider.getSparkSession();
final Filter[] filters = new Filter[1];
filters[0] = new EqualTo(SchemaToStructTypeConverter.DST_COL_NAME, "0");
final FiltersToOperationConverter converter = new FiltersToOperationConverter(getViewFromSchema(schema), schema, filters);
final Operation operation = converter.getOperation();
assertTrue(operation instanceof GetRDDOfElements);
assertEquals(0, ((GraphFilters) operation).getView().getEntityGroups().size());
assertEquals(EDGE_GROUPS, ((GraphFilters) operation).getView().getEdgeGroups());
final Set<EntityId> seeds = new HashSet<>();
for (final Object seed : ((GetRDDOfElements) operation).getInput()) {
seeds.add((EntitySeed) seed);
}
assertEquals(Collections.singleton(new EntitySeed("0")), seeds);
}
use of uk.gov.gchq.gaffer.data.element.id.EntityId in project Gaffer by gchq.
the class FederatedGetAdjacentIdsHandlerTest method validateMergeResultsFromFieldObjects.
@Override
protected boolean validateMergeResultsFromFieldObjects(final CloseableIterable<? extends EntityId> result, final Object... resultParts) {
assertNotNull(result);
final Iterable[] resultPartItrs = Arrays.copyOf(resultParts, resultParts.length, Iterable[].class);
final ArrayList<Object> elements = Lists.newArrayList(new ChainedIterable<>(resultPartItrs));
int i = 0;
for (EntityId e : result) {
assertTrue(e instanceof Entity);
elements.contains(e);
i++;
}
assertEquals(elements.size(), i);
return true;
}
Aggregations