Search in sources :

Example 1 with ByteEntityAccumuloElementConverter

use of uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter in project Gaffer by gchq.

the class CoreKeyGroupByAggregatorIteratorTest 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);
}
Also used : SingleUseMockAccumuloStore(uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore) ClassicAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) BeforeClass(org.junit.BeforeClass)

Example 2 with ByteEntityAccumuloElementConverter

use of uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter in project Gaffer by gchq.

the class BloomFilterIT method setup.

@Before
public void setup() {
    Schema schema = new Schema.Builder().type(TestTypes.PROP_INTEGER, Integer.class).vertexSerialiser(new JavaSerialiser()).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(AccumuloPropertyNames.INT, TestTypes.PROP_INTEGER).build()).build();
    byteEntityRangeFactory = new ByteEntityRangeFactory(schema);
    byteEntityElementConverter = new ByteEntityAccumuloElementConverter(schema);
    Gaffer1RangeFactory = new ClassicRangeFactory(schema);
    gafferV1ElementConverter = new ClassicAccumuloElementConverter(schema);
}
Also used : ByteEntityRangeFactory(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityRangeFactory) ClassicRangeFactory(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicRangeFactory) JavaSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser) ClassicAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter) Schema(uk.gov.gchq.gaffer.store.schema.Schema) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Before(org.junit.Before)

Example 3 with ByteEntityAccumuloElementConverter

use of uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter in project Gaffer by gchq.

the class ElementPostAggregationFilterTest method shouldAcceptElementWhenViewValidatorAcceptsElement.

@Test
public void shouldAcceptElementWhenViewValidatorAcceptsElement() throws Exception {
    // Given
    final AbstractElementFilter filter = new ElementPostAggregationFilter();
    final Map<String, String> options = new HashMap<>();
    options.put(AccumuloStoreConstants.SCHEMA, getSchemaJson());
    options.put(AccumuloStoreConstants.VIEW, getViewJson());
    options.put(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS, ByteEntityAccumuloElementConverter.class.getName());
    filter.validateOptions(options);
    final ByteEntityAccumuloElementConverter converter = new ByteEntityAccumuloElementConverter(getSchema());
    final Element element = new Edge(TestGroups.EDGE, "source", "dest", true);
    final Pair<Key> key = converter.getKeysFromElement(element);
    final Value value = converter.getValueFromElement(element);
    // When
    final boolean accept = filter.accept(key.getFirst(), value);
    // Then
    assertTrue(accept);
}
Also used : AbstractElementFilter(uk.gov.gchq.gaffer.accumulostore.key.AbstractElementFilter) HashMap(java.util.HashMap) Element(uk.gov.gchq.gaffer.data.element.Element) Value(org.apache.accumulo.core.data.Value) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Edge(uk.gov.gchq.gaffer.data.element.Edge) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Example 4 with ByteEntityAccumuloElementConverter

use of uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter in project Gaffer by gchq.

the class ElementPostAggregationFilterTest method shouldNotAcceptElementWhenViewValidatorDoesNotAcceptElement.

@Test
public void shouldNotAcceptElementWhenViewValidatorDoesNotAcceptElement() throws Exception {
    // Given
    final AbstractElementFilter filter = new ElementPostAggregationFilter();
    final Map<String, String> options = new HashMap<>();
    options.put(AccumuloStoreConstants.SCHEMA, getSchemaJson());
    options.put(AccumuloStoreConstants.VIEW, getEmptyViewJson());
    options.put(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS, ByteEntityAccumuloElementConverter.class.getName());
    filter.validateOptions(options);
    final ByteEntityAccumuloElementConverter converter = new ByteEntityAccumuloElementConverter(getSchema());
    final Element element = new Edge(TestGroups.EDGE, "source", "dest", true);
    final Pair<Key> key = converter.getKeysFromElement(element);
    final Value value = converter.getValueFromElement(element);
    // When
    final boolean accept = filter.accept(key.getFirst(), value);
    // Then
    assertFalse(accept);
}
Also used : AbstractElementFilter(uk.gov.gchq.gaffer.accumulostore.key.AbstractElementFilter) HashMap(java.util.HashMap) Element(uk.gov.gchq.gaffer.data.element.Element) Value(org.apache.accumulo.core.data.Value) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Edge(uk.gov.gchq.gaffer.data.element.Edge) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Example 5 with ByteEntityAccumuloElementConverter

use of uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter in project Gaffer by gchq.

the class ElementPreAggregationFilterTest method shouldAcceptElementWhenViewValidatorAcceptsElement.

@Test
public void shouldAcceptElementWhenViewValidatorAcceptsElement() throws Exception {
    // Given
    final AbstractElementFilter filter = new ElementPreAggregationFilter();
    final Map<String, String> options = new HashMap<>();
    options.put(AccumuloStoreConstants.SCHEMA, getSchemaJson());
    options.put(AccumuloStoreConstants.VIEW, getViewJson());
    options.put(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS, ByteEntityAccumuloElementConverter.class.getName());
    filter.validateOptions(options);
    final ByteEntityAccumuloElementConverter converter = new ByteEntityAccumuloElementConverter(getSchema());
    final Element element = new Edge(TestGroups.EDGE, "source", "dest", true);
    final Pair<Key> key = converter.getKeysFromElement(element);
    final Value value = converter.getValueFromElement(element);
    // When
    final boolean accept = filter.accept(key.getFirst(), value);
    // Then
    assertTrue(accept);
}
Also used : AbstractElementFilter(uk.gov.gchq.gaffer.accumulostore.key.AbstractElementFilter) HashMap(java.util.HashMap) Element(uk.gov.gchq.gaffer.data.element.Element) Value(org.apache.accumulo.core.data.Value) ByteEntityAccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter) Edge(uk.gov.gchq.gaffer.data.element.Edge) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Aggregations

ByteEntityAccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.core.impl.byteEntity.ByteEntityAccumuloElementConverter)13 Test (org.junit.Test)8 Edge (uk.gov.gchq.gaffer.data.element.Edge)8 Element (uk.gov.gchq.gaffer.data.element.Element)8 Key (org.apache.accumulo.core.data.Key)7 Value (org.apache.accumulo.core.data.Value)7 HashMap (java.util.HashMap)6 AbstractElementFilter (uk.gov.gchq.gaffer.accumulostore.key.AbstractElementFilter)4 ClassicAccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.core.impl.classic.ClassicAccumuloElementConverter)4 Before (org.junit.Before)3 JavaSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.JavaSerialiser)3 Schema (uk.gov.gchq.gaffer.store.schema.Schema)3 DataOutputStream (java.io.DataOutputStream)2 File (java.io.File)2 HashSet (java.util.HashSet)2 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)2 Configuration (org.apache.hadoop.conf.Configuration)2 SparkConf (org.apache.spark.SparkConf)2 BeforeClass (org.junit.BeforeClass)2 SingleUseMockAccumuloStore (uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore)2