Search in sources :

Example 1 with Builder

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);
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) HashMapGraphLibrary(uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 2 with Builder

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());
    }
}
Also used : Context(uk.gov.gchq.gaffer.store.Context) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder) AddSchemaToLibrary(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Test(org.junit.jupiter.api.Test)

Example 3 with Builder

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();
}
Also used : Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

Builder (uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary.Builder)3 Schema (uk.gov.gchq.gaffer.store.schema.Schema)3 Test (org.junit.jupiter.api.Test)2 Context (uk.gov.gchq.gaffer.store.Context)2 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)2 BeforeAll (org.junit.jupiter.api.BeforeAll)1 HashMapGraphLibrary (uk.gov.gchq.gaffer.store.library.HashMapGraphLibrary)1 AddSchemaToLibrary (uk.gov.gchq.gaffer.store.operation.add.AddSchemaToLibrary)1