use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage in project Gaffer by gchq.
the class GenerateSplitPointsFromSampleHanderTest method before.
@BeforeEach
public void before() throws StoreException {
store = mock(AccumuloStore.class);
final AccumuloKeyPackage keyPackage = mock(AccumuloKeyPackage.class);
final AccumuloElementConverter converter = new ByteEntityAccumuloElementConverter(schema);
final List<String> tabletServers = Collections.nCopies(NUM_TABLET_SERVERS, null);
given(store.getKeyPackage()).willReturn(keyPackage);
given(keyPackage.getKeyConverter()).willReturn(converter);
given(store.getTabletServers()).willReturn(tabletServers);
}
use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage in project Gaffer by gchq.
the class AbstractCoreKeyIteratorSettingsFactoryTest method shouldReturnPostAggFilterIterator.
@Test
public void shouldReturnPostAggFilterIterator() throws Exception {
// Given
final AccumuloStore store = mock(AccumuloStore.class);
final Schema schema = createSchema();
final View view = new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().postAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.PROP_1).execute(new Exists()).build()).build()).build();
final AccumuloKeyPackage keyPackage = mock(AccumuloKeyPackage.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
given(store.getSchema()).willReturn(schema);
given(store.getKeyPackage()).willReturn(keyPackage);
given(keyPackage.getKeyConverter()).willReturn(converter);
// When
final IteratorSetting iterator = factory.getElementPostAggregationFilterIteratorSetting(view, store);
// Then
assertEquals(AccumuloStoreConstants.ELEMENT_POST_AGGREGATION_FILTER_ITERATOR_NAME, iterator.getName());
assertEquals(AccumuloStoreConstants.ELEMENT_POST_AGGREGATION_FILTER_ITERATOR_PRIORITY, iterator.getPriority());
assertEquals(ElementPostAggregationFilter.class.getName(), iterator.getIteratorClass());
JsonAssert.assertEquals(schema.toCompactJson(), iterator.getOptions().get(AccumuloStoreConstants.SCHEMA).getBytes());
JsonAssert.assertEquals(view.toCompactJson(), iterator.getOptions().get(AccumuloStoreConstants.VIEW).getBytes());
assertEquals(converter.getClass().getName(), iterator.getOptions().get(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS));
}
use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage in project Gaffer by gchq.
the class SampleElementsForSplitPointsHandlerTest method before.
@BeforeEach
public void before() throws StoreException {
store = mock(AccumuloStore.class);
final AccumuloKeyPackage keyPackage = mock(AccumuloKeyPackage.class);
final AccumuloElementConverter converter = new ByteEntityAccumuloElementConverter(schema);
final List<String> tabletServers = Collections.nCopies(NUM_TABLET_SERVERS, null);
given(store.getKeyPackage()).willReturn(keyPackage);
given(keyPackage.getKeyConverter()).willReturn(converter);
given(store.getTabletServers()).willReturn(tabletServers);
}
use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage in project Gaffer by gchq.
the class AbstractCoreKeyIteratorSettingsFactoryTest method shouldReturnIteratorValidatorIterator.
@Test
public void shouldReturnIteratorValidatorIterator() throws Exception {
// Given
final AccumuloStore store = mock(AccumuloStore.class);
final Schema schema = new Schema.Builder().merge(createSchema()).type("str", new TypeDefinition.Builder().validateFunctions(new Exists()).build()).build();
final AccumuloKeyPackage keyPackage = mock(AccumuloKeyPackage.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
given(store.getSchema()).willReturn(schema);
given(store.getKeyPackage()).willReturn(keyPackage);
given(keyPackage.getKeyConverter()).willReturn(converter);
// When
final IteratorSetting iterator = factory.getValidatorIteratorSetting(store);
// Then
assertEquals(AccumuloStoreConstants.VALIDATOR_ITERATOR_NAME, iterator.getName());
assertEquals(AccumuloStoreConstants.VALIDATOR_ITERATOR_PRIORITY, iterator.getPriority());
assertEquals(ValidatorFilter.class.getName(), iterator.getIteratorClass());
JsonAssert.assertEquals(schema.toCompactJson(), iterator.getOptions().get(AccumuloStoreConstants.SCHEMA).getBytes());
assertEquals(converter.getClass().getName(), iterator.getOptions().get(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS));
}
use of uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage in project Gaffer by gchq.
the class AbstractCoreKeyIteratorSettingsFactoryTest method shouldReturnPreAggFilterIterator.
@Test
public void shouldReturnPreAggFilterIterator() throws Exception {
// Given
final AccumuloStore store = mock(AccumuloStore.class);
final Schema schema = createSchema();
final View view = new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.PROP_1).execute(new Exists()).build()).build()).build();
final AccumuloKeyPackage keyPackage = mock(AccumuloKeyPackage.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
given(store.getSchema()).willReturn(schema);
given(store.getKeyPackage()).willReturn(keyPackage);
given(keyPackage.getKeyConverter()).willReturn(converter);
// When
final IteratorSetting iterator = factory.getElementPreAggregationFilterIteratorSetting(view, store);
// Then
assertEquals(AccumuloStoreConstants.ELEMENT_PRE_AGGREGATION_FILTER_ITERATOR_NAME, iterator.getName());
assertEquals(AccumuloStoreConstants.ELEMENT_PRE_AGGREGATION_FILTER_ITERATOR_PRIORITY, iterator.getPriority());
assertEquals(ElementPreAggregationFilter.class.getName(), iterator.getIteratorClass());
JsonAssert.assertEquals(schema.toCompactJson(), iterator.getOptions().get(AccumuloStoreConstants.SCHEMA).getBytes());
JsonAssert.assertEquals(view.toCompactJson(), iterator.getOptions().get(AccumuloStoreConstants.VIEW).getBytes());
assertEquals(converter.getClass().getName(), iterator.getOptions().get(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS));
}
Aggregations