use of uk.gov.gchq.gaffer.operation.data.EntitySeed in project Gaffer by gchq.
the class GetWalksTest method shouldValidateWhenOperationContainsMultipleHops.
@Test
public void shouldValidateWhenOperationContainsMultipleHops() {
// Given
final GetWalks getWalks = new GetWalks.Builder().input(new EntitySeed("1"), new EntitySeed("2")).operations(new OperationChain.Builder().first(new GetElements.Builder().input((Iterable<? extends ElementId>) null).view(new View.Builder().edge(TestGroups.EDGE).build()).build()).then(new GetElements.Builder().input((Iterable<? extends ElementId>) null).view(new View.Builder().edge(TestGroups.EDGE).build()).build()).build()).build();
// Then
final ValidationResult result = getWalks.validate();
assertFalse(result.isValid());
assertTrue(result.getErrorString().contains("All operations must contain a single hop. Operation ") && result.getErrorString().contains(" contains multiple hops"), result.getErrorString());
}
use of uk.gov.gchq.gaffer.operation.data.EntitySeed in project Gaffer by gchq.
the class GetWalksTest method shouldValidateWhenOperationListContainsAnEmptyOperationChain.
@Test
public void shouldValidateWhenOperationListContainsAnEmptyOperationChain() {
// Given
final GetWalks getWalks = new GetWalks.Builder().input(new EntitySeed("1"), new EntitySeed("2")).operations(new GetElements.Builder().input((Iterable<? extends ElementId>) null).view(new View.Builder().edge(TestGroups.EDGE).build()).build(), new OperationChain()).build();
// Then
final ValidationResult result = getWalks.validate();
assertFalse(result.isValid());
assertTrue(result.getErrorString().contains("Operation chain 1 contains no operations"), result.getErrorString());
}
use of uk.gov.gchq.gaffer.operation.data.EntitySeed in project Gaffer by gchq.
the class GetWalksTest method shouldValidateOperationWhenSecondOperationContainsNonNullInput.
@Test
public void shouldValidateOperationWhenSecondOperationContainsNonNullInput() {
// Given
final GetWalks getWalks = new GetWalks.Builder().input(new EntitySeed("1"), new EntitySeed("2")).addOperations(new GetElements.Builder().view(new View.Builder().edge(TestGroups.EDGE).build()).build(), new GetElements.Builder().input(new EntitySeed("seed")).view(new View.Builder().edge(TestGroups.EDGE).build()).build()).build();
// Then
assertFalse(getWalks.validate().isValid());
}
use of uk.gov.gchq.gaffer.operation.data.EntitySeed in project Gaffer by gchq.
the class GetWalksTest method shouldValidateWhenOperationListDoesNotContainAGetElementsOperation.
@Test
public void shouldValidateWhenOperationListDoesNotContainAGetElementsOperation() {
// Given
final GetWalks getWalks = new GetWalks.Builder().input(new EntitySeed("1"), new EntitySeed("2")).operations(new GetElements.Builder().input((Iterable<? extends ElementId>) null).view(new View.Builder().edge(TestGroups.EDGE).build()).build(), new OperationChain.Builder().first(new AddElements()).build(), new GetElements.Builder().input((Iterable<? extends ElementId>) null).view(new View.Builder().edge(TestGroups.EDGE).build()).build()).build();
// Then
final ValidationResult result = getWalks.validate();
assertFalse(result.isValid());
assertTrue(result.getErrorString().contains("All operations must contain a single hop. Operation 1 does not contain a hop."), result.getErrorString());
}
use of uk.gov.gchq.gaffer.operation.data.EntitySeed in project Gaffer by gchq.
the class ToElementIdTest method shouldReturnOriginalValueIfInputIsAnEntitySeed.
@Test
public void shouldReturnOriginalValueIfInputIsAnEntitySeed() {
// Given
final EntitySeed input = new EntitySeed("item");
final ToElementId function = new ToElementId();
// When
final ElementId output = function.apply(input);
// Then
assertSame(input, output);
}
Aggregations