Search in sources :

Example 6 with Max

use of uk.gov.gchq.koryphe.impl.binaryoperator.Max in project Gaffer by gchq.

the class AccumuloStoreTest method shouldFailSchemaValidationWhenTimestampPropertyDoesNotHaveMaxAggregator.

@Test
public void shouldFailSchemaValidationWhenTimestampPropertyDoesNotHaveMaxAggregator() throws StoreException {
    // Given
    final AccumuloStore store = new MiniAccumuloStore();
    final Schema schema = new Schema.Builder().entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().vertex(TestTypes.ID_STRING).property(TestPropertyNames.TIMESTAMP, TestTypes.TIMESTAMP).build()).edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().source(TestTypes.ID_STRING).destination(TestTypes.ID_STRING).property(TestPropertyNames.TIMESTAMP, TestTypes.TIMESTAMP_2).build()).type(TestTypes.ID_STRING, String.class).type(TestTypes.TIMESTAMP, new TypeDefinition.Builder().clazz(Long.class).aggregateFunction(new Max()).build()).type(TestTypes.TIMESTAMP_2, new TypeDefinition.Builder().clazz(Long.class).aggregateFunction(new Min()).build()).timestampProperty(TestPropertyNames.TIMESTAMP).build();
    // When / Then
    final String expectedMessage = "Schema is not valid. Validation errors: \n" + "The aggregator for the timestamp property must be set to: uk.gov.gchq.koryphe.impl.binaryoperator.Max " + "this cannot be overridden for this Accumulo Store, as you have told Accumulo to store this property " + "in the timestamp column.";
    assertThatExceptionOfType(SchemaException.class).isThrownBy(() -> store.initialise("graphId", schema, PROPERTIES)).withMessage(expectedMessage);
}
Also used : Min(uk.gov.gchq.koryphe.impl.binaryoperator.Min) Max(uk.gov.gchq.koryphe.impl.binaryoperator.Max) Schema(uk.gov.gchq.gaffer.store.schema.Schema) TypeDefinition(uk.gov.gchq.gaffer.store.schema.TypeDefinition) Test(org.junit.jupiter.api.Test)

Aggregations

Max (uk.gov.gchq.koryphe.impl.binaryoperator.Max)6 Test (org.junit.jupiter.api.Test)5 Schema (uk.gov.gchq.gaffer.store.schema.Schema)4 TypeDefinition (uk.gov.gchq.gaffer.store.schema.TypeDefinition)3 Edge (uk.gov.gchq.gaffer.data.element.Edge)2 Element (uk.gov.gchq.gaffer.data.element.Element)2 ElementAggregator (uk.gov.gchq.gaffer.data.element.function.ElementAggregator)2 Aggregate (uk.gov.gchq.gaffer.operation.impl.function.Aggregate)2 AggregatePair (uk.gov.gchq.gaffer.operation.util.AggregatePair)2 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)2 Sum (uk.gov.gchq.koryphe.impl.binaryoperator.Sum)2 ChainedIterable (uk.gov.gchq.gaffer.commonutil.iterable.ChainedIterable)1 Entity (uk.gov.gchq.gaffer.data.element.Entity)1 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)1 ElementTransformer (uk.gov.gchq.gaffer.data.element.function.ElementTransformer)1 SchemaElementDefinition (uk.gov.gchq.gaffer.store.schema.SchemaElementDefinition)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1 Min (uk.gov.gchq.koryphe.impl.binaryoperator.Min)1 IsEqual (uk.gov.gchq.koryphe.impl.predicate.IsEqual)1 IsLessThan (uk.gov.gchq.koryphe.impl.predicate.IsLessThan)1