Search in sources :

Example 1 with AccumuloKeyPackage

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);
}
Also used : AccumuloKeyPackage(uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) AccumuloStore(uk.gov.gchq.gaffer.accumulostore.AccumuloStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with AccumuloKeyPackage

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));
}
Also used : AccumuloKeyPackage(uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) Schema(uk.gov.gchq.gaffer.store.schema.Schema) ElementFilter(uk.gov.gchq.gaffer.data.element.function.ElementFilter) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter) AccumuloStore(uk.gov.gchq.gaffer.accumulostore.AccumuloStore) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) ElementPostAggregationFilter(uk.gov.gchq.gaffer.accumulostore.key.impl.ElementPostAggregationFilter) Test(org.junit.jupiter.api.Test)

Example 3 with AccumuloKeyPackage

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);
}
Also used : AccumuloKeyPackage(uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) AccumuloStore(uk.gov.gchq.gaffer.accumulostore.AccumuloStore) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with AccumuloKeyPackage

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));
}
Also used : AccumuloKeyPackage(uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) Schema(uk.gov.gchq.gaffer.store.schema.Schema) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter) AccumuloStore(uk.gov.gchq.gaffer.accumulostore.AccumuloStore) ValidatorFilter(uk.gov.gchq.gaffer.accumulostore.key.impl.ValidatorFilter) Test(org.junit.jupiter.api.Test)

Example 5 with AccumuloKeyPackage

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));
}
Also used : AccumuloKeyPackage(uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) Schema(uk.gov.gchq.gaffer.store.schema.Schema) ElementFilter(uk.gov.gchq.gaffer.data.element.function.ElementFilter) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter) AccumuloStore(uk.gov.gchq.gaffer.accumulostore.AccumuloStore) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) ElementPreAggregationFilter(uk.gov.gchq.gaffer.accumulostore.key.impl.ElementPreAggregationFilter) Test(org.junit.jupiter.api.Test)

Aggregations

AccumuloStore (uk.gov.gchq.gaffer.accumulostore.AccumuloStore)5 AccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter)5 AccumuloKeyPackage (uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage)5 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)3 Test (org.junit.jupiter.api.Test)3 Schema (uk.gov.gchq.gaffer.store.schema.Schema)3 Exists (uk.gov.gchq.koryphe.impl.predicate.Exists)3 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ByteEntityAccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter)2 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 ElementPostAggregationFilter (uk.gov.gchq.gaffer.accumulostore.key.impl.ElementPostAggregationFilter)1 ElementPreAggregationFilter (uk.gov.gchq.gaffer.accumulostore.key.impl.ElementPreAggregationFilter)1 ValidatorFilter (uk.gov.gchq.gaffer.accumulostore.key.impl.ValidatorFilter)1