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);
}
Aggregations