Search in sources :

Example 11 with ByteEntityAccumuloElementConverter

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

the class ElementPreAggregationFilterTest method shouldNotAcceptElementWhenViewValidatorDoesNotAcceptElement.

@Test
public void shouldNotAcceptElementWhenViewValidatorDoesNotAcceptElement() throws Exception {
    // Given
    final AbstractElementFilter filter = new ElementPreAggregationFilter();
    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 12 with ByteEntityAccumuloElementConverter

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

the class RowIdAggregatorTest 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 13 with ByteEntityAccumuloElementConverter

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

the class ValidatorFilterTest method shouldNotAcceptElementWhenSchemaValidatorDoesNotAcceptElement.

@Test
public void shouldNotAcceptElementWhenSchemaValidatorDoesNotAcceptElement() throws Exception {
    // Given
    final ValidatorFilter filter = new ValidatorFilter();
    final Map<String, String> options = new HashMap<>();
    options.put(AccumuloStoreConstants.SCHEMA, getSchemaJson());
    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, "invalid", "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 : 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