StoreScanner extends GafferScanner { protected static List<GafferScannerProcessor> createProcessors(final Schema schema, final ElementSerialisation serialisation) { final List<GafferScannerProcessor> processors = new ArrayList<>(); if (schema.isAggregationEnabled()) { processors.add(new StoreAggregationProcessor(serialisation, schema)); } processors.add(new ValidationProcessor(schema)); return processors; } StoreScanner(final InternalScanner scanner,
                        final Schema schema,
                        final ElementSerialisation serialisation);   }
@Test public void shouldConstructProcessors() throws OperationException, IOException { final Scan scan = mock(Scan.class); given(scan.getAttribute(HBaseStoreConstants.VIEW)).willReturn(VIEW.toCompactJson()); given(scan.getAttribute(HBaseStoreConstants.EXTRA_PROCESSORS)).willReturn(StringUtil.toCsv(ElementDedupeFilterProcessor.class)); final List<GafferScannerProcessor> processors = StoreScanner.createProcessors(SCHEMA, serialisation); assertEquals(2, processors.size()); int i = 0; assertTrue(processors.get(i) instanceof StoreAggregationProcessor); assertEquals(SCHEMA, ((StoreAggregationProcessor) processors.get(i)).getSchema()); i++; assertTrue(processors.get(i) instanceof ValidationProcessor); assertEquals(SCHEMA, ((ValidationProcessor) processors.get(i)).getSchema()); }
@Test public void shouldConstructProcessorsWithNoAggregation() throws OperationException, IOException { final Scan scan = mock(Scan.class); given(scan.getAttribute(HBaseStoreConstants.VIEW)).willReturn(VIEW.toCompactJson()); given(scan.getAttribute(HBaseStoreConstants.EXTRA_PROCESSORS)).willReturn(StringUtil.toCsv(ElementDedupeFilterProcessor.class)); final List<GafferScannerProcessor> processors = StoreScanner.createProcessors(SCHEMA_NO_AGGREGATION, serialisation); assertEquals(1, processors.size()); int i = 0; assertTrue(processors.get(i) instanceof ValidationProcessor); assertEquals(SCHEMA_NO_AGGREGATION, ((ValidationProcessor) processors.get(i)).getSchema()); }