Search in sources :

Example 1 with Builder

use of uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder in project Gaffer by gchq.

the class AddGraphWithHooksTest method builderShouldCreatePopulatedOperation.

@Test
@Override
public void builderShouldCreatePopulatedOperation() {
    Schema expectedSchema = new Schema.Builder().build();
    StoreProperties storeProperties = new AccumuloProperties();
    Log4jLogger log4jLogger = new Log4jLogger();
    AddGraphWithHooks op = new Builder().graphId(EXPECTED_GRAPH_ID).schema(expectedSchema).storeProperties(storeProperties).hooks(log4jLogger).readAccessPredicate(READ_ACCESS_PREDICATE).writeAccessPredicate(WRITE_ACCESS_PREDICATE).build();
    assertEquals(EXPECTED_GRAPH_ID, op.getGraphId());
    assertEquals(expectedSchema, op.getSchema());
    assertNotNull(op.getStoreProperties().getStorePropertiesClassName());
    assertEquals(AccumuloProperties.class, op.getStoreProperties().getStorePropertiesClass());
    assertThat(op.getHooks()).hasSize(1);
    assertEquals(log4jLogger, op.getHooks()[0]);
    assertEquals(READ_ACCESS_PREDICATE, op.getReadAccessPredicate());
    assertEquals(WRITE_ACCESS_PREDICATE, op.getWriteAccessPredicate());
}
Also used : AccumuloProperties(uk.gov.gchq.gaffer.accumulostore.AccumuloProperties) Schema(uk.gov.gchq.gaffer.store.schema.Schema) Builder(uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Log4jLogger(uk.gov.gchq.gaffer.graph.hook.Log4jLogger) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Example 2 with Builder

use of uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder in project Gaffer by gchq.

the class AddGraphWithHooksTest method shouldShallowCloneOperationWithNulls.

@Test
public void shouldShallowCloneOperationWithNulls() {
    final AddGraphWithHooks a = new Builder().graphId(null).parentPropertiesId(null).parentSchemaIds(null).schema(null).graphAuths(null).storeProperties(null).readAccessPredicate(READ_ACCESS_PREDICATE).writeAccessPredicate(WRITE_ACCESS_PREDICATE).build();
    final AddGraphWithHooks b = a.shallowClone();
    assertEquals(a.getGraphId(), b.getGraphId());
    assertEquals(a.getStoreProperties(), b.getStoreProperties());
    assertEquals(a.getSchema(), b.getSchema());
    assertEquals(a.getGraphAuths(), b.getGraphAuths());
    assertEquals(a.getReadAccessPredicate(), b.getReadAccessPredicate());
    assertEquals(a.getWriteAccessPredicate(), b.getWriteAccessPredicate());
}
Also used : Builder(uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Example 3 with Builder

use of uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder in project Gaffer by gchq.

the class AddGraphWithHooksTest method shouldShallowCloneOperation.

@Test
@Override
public void shouldShallowCloneOperation() {
    final AddGraphWithHooks a = new Builder().graphId("graphId").parentPropertiesId("testPropID").parentSchemaIds(Lists.newArrayList("testSchemaID")).schema(new Schema.Builder().build()).graphAuths("testAuth").storeProperties(new StoreProperties()).hooks(new Log4jLogger()).disabledByDefault(true).readAccessPredicate(READ_ACCESS_PREDICATE).writeAccessPredicate(WRITE_ACCESS_PREDICATE).build();
    final AddGraphWithHooks b = a.shallowClone();
    assertEquals(a.getGraphId(), b.getGraphId());
    assertEquals(a.getStoreProperties(), b.getStoreProperties());
    assertEquals(a.getSchema(), b.getSchema());
    assertEquals(a.getGraphAuths(), b.getGraphAuths());
    assertArrayEquals(a.getHooks(), b.getHooks());
    assertTrue(b.isDisabledByDefault());
    assertEquals(a.getReadAccessPredicate(), b.getReadAccessPredicate());
    assertEquals(a.getWriteAccessPredicate(), b.getWriteAccessPredicate());
}
Also used : Builder(uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder) Schema(uk.gov.gchq.gaffer.store.schema.Schema) StoreProperties(uk.gov.gchq.gaffer.store.StoreProperties) Log4jLogger(uk.gov.gchq.gaffer.graph.hook.Log4jLogger) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 Builder (uk.gov.gchq.gaffer.federatedstore.operation.AddGraphWithHooks.Builder)3 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)3 Log4jLogger (uk.gov.gchq.gaffer.graph.hook.Log4jLogger)2 StoreProperties (uk.gov.gchq.gaffer.store.StoreProperties)2 Schema (uk.gov.gchq.gaffer.store.schema.Schema)2 AccumuloProperties (uk.gov.gchq.gaffer.accumulostore.AccumuloProperties)1