use of uk.gov.gchq.gaffer.store.schema.ViewValidator in project Gaffer by gchq.
the class ExamplesServiceTest method shouldCreateViewForEdges.
@Test
public void shouldCreateViewForEdges() {
final View.Builder builder = service.generateViewBuilder();
final View view = builder.build();
assertNotNull(view);
final ViewValidator viewValidator = new ViewValidator();
final boolean validate = viewValidator.validate(view, schema, false);
assertTrue(validate);
}
use of uk.gov.gchq.gaffer.store.schema.ViewValidator in project Gaffer by gchq.
the class StoreTest method shouldThrowExceptionIfOperationViewIsInvalid.
@Test
public void shouldThrowExceptionIfOperationViewIsInvalid() throws OperationException, StoreException {
// Given
// Given
final Schema schema = createSchemaMock();
final StoreProperties properties = mock(StoreProperties.class);
final AddElements addElements = new AddElements();
final View view = mock(View.class);
final ViewValidator viewValidator = mock(ViewValidator.class);
final StoreImpl store = new StoreImpl(viewValidator);
addElements.setView(view);
given(schema.validate()).willReturn(true);
given(viewValidator.validate(view, schema, true)).willReturn(false);
store.initialise(schema, properties);
// When / Then
try {
store.execute(addElements, user);
fail("Exception expected");
} catch (final SchemaException e) {
verify(viewValidator).validate(view, schema, true);
assertTrue(e.getMessage().contains("View"));
}
}
Aggregations