use of uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder in project Gaffer by gchq.
the class AddSchemaToLibraryHandlerTest method shouldAddSchemaWithGraphLibrary.
@Test
public void shouldAddSchemaWithGraphLibrary() throws Exception {
// given
HashMapGraphLibrary library = new HashMapGraphLibrary();
store.setGraphLibrary(library);
store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
// when
store.execute(new Builder().schema(schema).id(TEST_SCHEMA_ID).build(), new Context(StoreUser.blankUser()));
// then
Schema actualSchema = library.getSchema(TEST_SCHEMA_ID);
assertEquals(schema, actualSchema);
}
use of uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder in project Gaffer by gchq.
the class AddSchemaToLibraryHandlerTest method shouldThrowWithNoGraphLibrary.
@Test
public void shouldThrowWithNoGraphLibrary() throws Exception {
// given
store.initialise(TEST_STORE_ID, new Schema(), new StoreProperties());
try {
// when
store.execute(new Builder().schema(schema).id(TEST_SCHEMA_ID).build(), new Context(StoreUser.blankUser()));
fail("Exception expected");
} catch (final Exception e) {
// then
assertEquals(String.format("Operation class %s is not supported by the %s.", AddSchemaToLibrary.class.getName(), TestAddToGraphLibraryImpl.class.getSimpleName()), e.getMessage());
}
}
use of uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder in project Gaffer by gchq.
the class AddSchemaToLibraryTest method setUp.
@BeforeAll
public static void setUp() throws Exception {
schema = new Schema.Builder().id("schemaID").build();
parentSchemaIds = Lists.newArrayList("value1");
op = new Builder().parentSchemaIds(parentSchemaIds).schema(schema).id(TEST_ID).build();
}
Aggregations