Search in sources :

Example 1 with Sum

use of uk.gov.gchq.gaffer.function.aggregate.Sum in project Gaffer by gchq.

the class GraphTest method shouldThrowExceptionIfSchemaIsInvalid.

@Test
public void shouldThrowExceptionIfSchemaIsInvalid() throws OperationException {
    final StoreProperties storeProperties = new StoreProperties();
    storeProperties.setStoreClass(StoreImpl.class.getName());
    try {
        new Graph.Builder().addSchema(new Schema.Builder().type("intnoagg", new TypeDefinition.Builder().clazz(Integer.class).build()).type("int", new TypeDefinition.Builder().clazz(Integer.class).aggregateFunction(new Sum()).build()).type("string", new TypeDefinition.Builder().clazz(String.class).aggregateFunction(new StringConcat()).build()).type("boolean", Boolean.class).edge("EDGE", new SchemaEdgeDefinition.Builder().source("string").destination("string").directed("boolean").property("p", "intnoagg").build()).entity("ENTITY", new SchemaEntityDefinition.Builder().vertex("string").property("p2", "int").build()).build()).storeProperties(storeProperties).build();
        fail("exception expected");
    } catch (final SchemaException e) {
        assertNotNull(e.getMessage());
    }
}
Also used : SchemaException(uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException) StringConcat(uk.gov.gchq.gaffer.function.aggregate.StringConcat) Sum(uk.gov.gchq.gaffer.function.aggregate.Sum) TypeDefinition(uk.gov.gchq.gaffer.store.schema.TypeDefinition) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 SchemaException (uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException)1 StringConcat (uk.gov.gchq.gaffer.function.aggregate.StringConcat)1 Sum (uk.gov.gchq.gaffer.function.aggregate.Sum)1 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)1 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)1 TypeDefinition (uk.gov.gchq.gaffer.store.schema.TypeDefinition)1