use of uk.gov.gchq.gaffer.hbasestore.coprocessor.processor.ValidationProcessor in project Gaffer by gchq.
the class QueryScannerTest method shouldConstructProcessorsWhenViewIsNull.
@Test
public void shouldConstructProcessorsWhenViewIsNull() throws OperationException, IOException {
// Given
final Scan scan = mock(Scan.class);
given(scan.getAttribute(HBaseStoreConstants.VIEW)).willReturn(null);
// When
final List<GafferScannerProcessor> processors = QueryScanner.createProcessors(scan, SCHEMA, serialisation);
// Then
assertThat(processors).hasSize(2);
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());
}
use of uk.gov.gchq.gaffer.hbasestore.coprocessor.processor.ValidationProcessor in project Gaffer by gchq.
the class StoreScannerTest method shouldConstructProcessors.
@Test
public void shouldConstructProcessors() throws OperationException, IOException {
// Given
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));
// When
final List<GafferScannerProcessor> processors = StoreScanner.createProcessors(SCHEMA, serialisation);
// Then
assertThat(processors).hasSize(2);
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());
}
use of uk.gov.gchq.gaffer.hbasestore.coprocessor.processor.ValidationProcessor in project Gaffer by gchq.
the class StoreScannerTest method shouldConstructProcessorsWithNoAggregation.
@Test
public void shouldConstructProcessorsWithNoAggregation() throws OperationException, IOException {
// Given
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));
// When
final List<GafferScannerProcessor> processors = StoreScanner.createProcessors(SCHEMA_NO_AGGREGATION, serialisation);
// Then
assertThat(processors).hasSize(1);
int i = 0;
assertTrue(processors.get(i) instanceof ValidationProcessor);
assertEquals(SCHEMA_NO_AGGREGATION, ((ValidationProcessor) processors.get(i)).getSchema());
}
use of uk.gov.gchq.gaffer.hbasestore.coprocessor.processor.ValidationProcessor in project Gaffer by gchq.
the class QueryScannerTest method shouldConstructProcessorsWithNoExtras.
@Test
public void shouldConstructProcessorsWithNoExtras() throws OperationException, IOException {
// Given
final Scan scan = mock(Scan.class);
given(scan.getAttribute(HBaseStoreConstants.VIEW)).willReturn(VIEW.toCompactJson());
given(scan.getAttribute(HBaseStoreConstants.EXTRA_PROCESSORS)).willReturn(null);
// When
final List<GafferScannerProcessor> processors = QueryScanner.createProcessors(scan, SCHEMA, serialisation);
// Then
assertThat(processors).hasSize(6);
int i = 0;
assertTrue(processors.get(i) instanceof GroupFilterProcessor);
assertEquals(VIEW, ((GroupFilterProcessor) processors.get(i)).getView());
i++;
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());
i++;
assertTrue(processors.get(i) instanceof PreAggregationFilterProcessor);
assertEquals(VIEW, ((PreAggregationFilterProcessor) processors.get(i)).getView());
i++;
assertTrue(processors.get(i) instanceof QueryAggregationProcessor);
assertEquals(SCHEMA, ((QueryAggregationProcessor) processors.get(i)).getSchema());
assertEquals(VIEW, ((QueryAggregationProcessor) processors.get(i)).getView());
i++;
assertTrue(processors.get(i) instanceof PostAggregationFilterProcessor);
assertEquals(VIEW, ((PostAggregationFilterProcessor) processors.get(i)).getView());
}
use of uk.gov.gchq.gaffer.hbasestore.coprocessor.processor.ValidationProcessor in project Gaffer by gchq.
the class QueryScannerTest method shouldConstructProcessors.
@Test
public void shouldConstructProcessors() throws OperationException, IOException {
// Given
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));
given(scan.getAttribute(HBaseStoreConstants.DIRECTED_TYPE)).willReturn(Bytes.toBytes(DirectedType.DIRECTED.name()));
// When
final List<GafferScannerProcessor> processors = QueryScanner.createProcessors(scan, SCHEMA, serialisation);
// Then
assertThat(processors).hasSize(7);
int i = 0;
assertTrue(processors.get(i) instanceof GroupFilterProcessor);
assertEquals(VIEW, ((GroupFilterProcessor) processors.get(i)).getView());
i++;
assertTrue(processors.get(i) instanceof ElementDedupeFilterProcessor);
assertTrue(((ElementDedupeFilterProcessor) processors.get(i)).isEntities());
assertTrue(((ElementDedupeFilterProcessor) processors.get(i)).isEdges());
assertTrue(((ElementDedupeFilterProcessor) processors.get(i)).isDirectedEdges());
assertFalse(((ElementDedupeFilterProcessor) processors.get(i)).isUnDirectedEdges());
i++;
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());
i++;
assertTrue(processors.get(i) instanceof PreAggregationFilterProcessor);
assertEquals(VIEW, ((PreAggregationFilterProcessor) processors.get(i)).getView());
i++;
assertTrue(processors.get(i) instanceof QueryAggregationProcessor);
assertEquals(SCHEMA, ((QueryAggregationProcessor) processors.get(i)).getSchema());
assertEquals(VIEW, ((QueryAggregationProcessor) processors.get(i)).getView());
i++;
assertTrue(processors.get(i) instanceof PostAggregationFilterProcessor);
assertEquals(VIEW, ((PostAggregationFilterProcessor) processors.get(i)).getView());
}
Aggregations