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());
}
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());
}
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());
}
Aggregations