use of uk.gov.gchq.gaffer.store.operation.GetSchema in project gaffer-doc by gchq.
the class GetSchemaExample method getFullSchema.
public void getFullSchema() {
// ---------------------------------------------------------
final GetSchema operation = new GetSchema();
// ---------------------------------------------------------
runExample(operation, "This operation defaults the compact field to false, " + "thereby returning the full Schema.");
}
use of uk.gov.gchq.gaffer.store.operation.GetSchema in project Gaffer by gchq.
the class FederatedGetSchemaHandlerTest method shouldReturnSchema.
@Test
public void shouldReturnSchema() throws OperationException {
library.addProperties(ACC_PROP_ID, PROPERTIES);
fStore.setGraphLibrary(library);
final Schema edgeSchema = new Schema.Builder().edge("edge", new SchemaEdgeDefinition.Builder().source("string").destination("string").directed(DIRECTED_EITHER).property("prop1", "string").build()).vertexSerialiser(new StringSerialiser()).type(DIRECTED_EITHER, Boolean.class).merge(STRING_SCHEMA).build();
library.addSchema(EDGE_SCHEMA_ID, edgeSchema);
fStore.execute(Operation.asOperationChain(new AddGraph.Builder().graphId("schema").parentPropertiesId(ACC_PROP_ID).parentSchemaIds(Lists.newArrayList(EDGE_SCHEMA_ID)).build()), context);
final GetSchema operation = new GetSchema.Builder().compact(true).build();
// When
final Schema result = handler.doOperation(operation, context, fStore);
// Then
assertNotNull(result);
JsonAssert.assertEquals(edgeSchema.toJson(true), result.toJson(true));
}
use of uk.gov.gchq.gaffer.store.operation.GetSchema in project Gaffer by gchq.
the class GetSchemaHandlerTest method shouldReturnCompactSchema.
@Test
public void shouldReturnCompactSchema() throws OperationException {
given(store.getProperties()).willReturn(properties);
given(store.getSchema()).willReturn(schema);
given(context.getUser()).willReturn(user);
final GetSchema operation = new GetSchema.Builder().compact(true).build();
// When
final Schema result = handler.doOperation(operation, context, store);
// Then
assertNotNull(result);
JsonAssert.assertNotEqual(schema.toJson(true), result.toJson(true));
JsonAssert.assertEquals(compactSchemaBytes, result.toJson(true));
}
use of uk.gov.gchq.gaffer.store.operation.GetSchema in project gaffer-doc by gchq.
the class GetSchemaExample method getCompactSchema.
public void getCompactSchema() {
// ---------------------------------------------------------
final GetSchema operation = new GetSchema.Builder().compact(true).build();
// ---------------------------------------------------------
runExample(operation, "This operation will retrieve the compact Schema from the store, " + "rather than the full schema.");
}
use of uk.gov.gchq.gaffer.store.operation.GetSchema in project Gaffer by gchq.
the class GetSchemaHandlerTest method shouldReturnFullSchema.
@Test
public void shouldReturnFullSchema() throws OperationException {
given(store.getProperties()).willReturn(properties);
given(store.getOriginalSchema()).willReturn(schema);
given(context.getUser()).willReturn(user);
final GetSchema operation = new GetSchema();
// When
final Schema result = handler.doOperation(operation, context, store);
// Then
assertNotNull(result);
JsonAssert.assertEquals(schema.toJson(true), result.toJson(true));
}
Aggregations