Search in sources :

Example 1 with SchemaOptimiser

use of uk.gov.gchq.gaffer.store.schema.SchemaOptimiser in project Gaffer by gchq.

the class StoreTest method setup.

@BeforeEach
public void setup() {
    System.clearProperty(JSONSerialiser.JSON_SERIALISER_CLASS_KEY);
    System.clearProperty(JSONSerialiser.JSON_SERIALISER_MODULES);
    JSONSerialiser.update();
    schemaOptimiser = mock(SchemaOptimiser.class);
    operationChainValidator = mock(OperationChainValidator.class);
    store = new StoreImpl();
    given(operationChainValidator.validate(any(OperationChain.class), any(User.class), any(Store.class))).willReturn(new ValidationResult());
    addElementsHandler = mock(OperationHandler.class);
    getElementsHandler = mock(OutputOperationHandler.class);
    getAllElementsHandler = mock(OutputOperationHandler.class);
    getAdjacentIdsHandler = mock(OutputOperationHandler.class);
    validateHandler = mock(OperationHandler.class);
    exportToGafferResultCacheHandler = mock(OperationHandler.class);
    getGafferResultCacheExportHandler = mock(OperationHandler.class);
    jobTracker = mock(JobTracker.class);
    schema = new Schema.Builder().edge(TestGroups.EDGE, new SchemaEdgeDefinition.Builder().source("string").destination("string").directed("true").property(TestPropertyNames.PROP_1, "string").property(TestPropertyNames.PROP_2, "string").build()).edge(TestGroups.EDGE_2, new SchemaEdgeDefinition.Builder().source("string").destination("string").directed("true").property(TestPropertyNames.PROP_1, "string").property(TestPropertyNames.PROP_2, "string").build()).entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().vertex("string").property(TestPropertyNames.PROP_1, "string").property(TestPropertyNames.PROP_2, "string").build()).entity(TestGroups.ENTITY_2, new SchemaEntityDefinition.Builder().vertex("string").property(TestPropertyNames.PROP_1, "string").property(TestPropertyNames.PROP_2, "string").build()).type("string", new TypeDefinition.Builder().clazz(String.class).serialiser(new StringSerialiser()).aggregateFunction(new StringConcat()).build()).type("true", Boolean.class).build();
}
Also used : StringSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser) StringToStringSerialiser(uk.gov.gchq.gaffer.serialisation.implementation.tostring.StringToStringSerialiser) StringConcat(uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat) User(uk.gov.gchq.gaffer.user.User) JobTracker(uk.gov.gchq.gaffer.jobtracker.JobTracker) OutputOperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OutputOperationHandler) SchemaEntityDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition) OperationChainValidator(uk.gov.gchq.gaffer.store.operation.OperationChainValidator) ValidationResult(uk.gov.gchq.koryphe.ValidationResult) SchemaOptimiser(uk.gov.gchq.gaffer.store.schema.SchemaOptimiser) ValidateOperationChain(uk.gov.gchq.gaffer.operation.impl.ValidateOperationChain) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) SchemaEdgeDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition) OutputOperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OutputOperationHandler) OperationHandler(uk.gov.gchq.gaffer.store.operation.handler.OperationHandler) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with SchemaOptimiser

use of uk.gov.gchq.gaffer.store.schema.SchemaOptimiser in project Gaffer by gchq.

the class TestUtils method gafferSchema.

public static Schema gafferSchema(final String schemaFolder) {
    final Schema schema = Schema.fromJson(StreamUtil.openStreams(TestUtils.class, schemaFolder));
    final SchemaOptimiser schemaOptimiser = new SchemaOptimiser(new SerialisationFactory(ParquetStore.SERIALISERS));
    return schemaOptimiser.optimise(schema, true);
}
Also used : Schema(uk.gov.gchq.gaffer.store.schema.Schema) SchemaOptimiser(uk.gov.gchq.gaffer.store.schema.SchemaOptimiser) SerialisationFactory(uk.gov.gchq.gaffer.store.SerialisationFactory)

Aggregations

SchemaOptimiser (uk.gov.gchq.gaffer.store.schema.SchemaOptimiser)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 JobTracker (uk.gov.gchq.gaffer.jobtracker.JobTracker)1 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)1 ValidateOperationChain (uk.gov.gchq.gaffer.operation.impl.ValidateOperationChain)1 StringSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.StringSerialiser)1 StringToStringSerialiser (uk.gov.gchq.gaffer.serialisation.implementation.tostring.StringToStringSerialiser)1 SerialisationFactory (uk.gov.gchq.gaffer.store.SerialisationFactory)1 OperationChainValidator (uk.gov.gchq.gaffer.store.operation.OperationChainValidator)1 OperationHandler (uk.gov.gchq.gaffer.store.operation.handler.OperationHandler)1 OutputOperationHandler (uk.gov.gchq.gaffer.store.operation.handler.OutputOperationHandler)1 Schema (uk.gov.gchq.gaffer.store.schema.Schema)1 SchemaEdgeDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEdgeDefinition)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1 User (uk.gov.gchq.gaffer.user.User)1 ValidationResult (uk.gov.gchq.koryphe.ValidationResult)1 StringConcat (uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat)1