use of uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore in project Gaffer by gchq.
the class AccumuloStoreRelationTest method testBuildScanSpecifyColumnsWithView.
private void testBuildScanSpecifyColumnsWithView(final String name, final View view, final String[] requiredColumns, final Predicate<Element> returnElement) throws OperationException, StoreException {
// Given
final SQLContext sqlContext = getSqlContext(name);
final Schema schema = getSchema();
final AccumuloProperties properties = AccumuloProperties.loadStoreProperties(getClass().getResourceAsStream("/store.properties"));
final SingleUseMockAccumuloStore store = new SingleUseMockAccumuloStore();
store.initialise(schema, properties);
addElements(store);
// When
final AccumuloStoreRelation relation = new AccumuloStoreRelation(sqlContext, Collections.emptyList(), view, store, new User());
final RDD<Row> rdd = relation.buildScan(requiredColumns);
final Row[] returnedElements = (Row[]) rdd.collect();
// Then
// - Actual results are:
final Set<Row> results = new HashSet<>();
for (int i = 0; i < returnedElements.length; i++) {
results.add(returnedElements[i]);
}
// - Expected results are:
final SchemaToStructTypeConverter schemaConverter = new SchemaToStructTypeConverter(schema, view, new ArrayList<>());
final ConvertElementToRow elementConverter = new ConvertElementToRow(new LinkedHashSet<>(Arrays.asList(requiredColumns)), schemaConverter.getPropertyNeedsConversion(), schemaConverter.getConverterByProperty());
final Set<Row> expectedRows = new HashSet<>();
StreamSupport.stream(getElements().spliterator(), false).filter(returnElement).map(elementConverter::apply).forEach(expectedRows::add);
assertEquals(expectedRows, results);
sqlContext.sparkContext().stop();
}
use of uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore in project Gaffer by gchq.
the class RowIdAggregatorTest method setup.
@BeforeClass
public static void setup() throws StoreException, AccumuloException, AccumuloSecurityException, IOException {
byteEntityStore = new SingleUseMockAccumuloStore();
gaffer1KeyStore = new SingleUseMockAccumuloStore();
gaffer1ElementConverter = new ClassicAccumuloElementConverter(schema);
byteEntityElementConverter = new ByteEntityAccumuloElementConverter(schema);
}
use of uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore in project Gaffer by gchq.
the class GetElementsinRangesHandlerTest method setup.
@BeforeClass
public static void setup() throws StoreException, IOException {
byteEntityStore = new SingleUseMockAccumuloStore();
gaffer1KeyStore = new SingleUseMockAccumuloStore();
}
use of uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore in project Gaffer by gchq.
the class AccumuloIDWithinSetRetrieverTest method setup.
@BeforeClass
public static void setup() throws StoreException, IOException {
byteEntityStore = new SingleUseMockAccumuloStore();
gaffer1KeyStore = new SingleUseMockAccumuloStore();
defaultView = new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
}
use of uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore in project Gaffer by gchq.
the class AccumuloSingleIDRetrieverTest method setup.
@BeforeClass
public static void setup() throws StoreException, IOException {
byteEntityStore = new SingleUseMockAccumuloStore();
gaffer1KeyStore = new SingleUseMockAccumuloStore();
}
Aggregations