use of uk.gov.gchq.gaffer.data.element.id.ElementId 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);
}
use of uk.gov.gchq.gaffer.data.element.id.ElementId in project Gaffer by gchq.
the class ToElementIdTest method shouldReturnNullIfTheInputIsNull.
@Test
public void shouldReturnNullIfTheInputIsNull() {
// Given
final Object input = null;
final ToElementId function = new ToElementId();
// When
final ElementId output = function.apply(input);
// Then
assertNull(output);
}
use of uk.gov.gchq.gaffer.data.element.id.ElementId in project Gaffer by gchq.
the class ToElementIdTest method shouldReturnOriginalValueIfInputIsAnEntity.
@Test
public void shouldReturnOriginalValueIfInputIsAnEntity() {
// Given
final Entity input = new Entity("group", "item");
final ToElementId function = new ToElementId();
// When
final ElementId output = function.apply(input);
// Then
assertSame(input, output);
}
use of uk.gov.gchq.gaffer.data.element.id.ElementId in project Gaffer by gchq.
the class GetJavaRDDOfElementsInRangesTest method shouldShallowCloneOperation.
@Test
@Override
public void shouldShallowCloneOperation() {
// Given
final Pair<ElementId, ElementId> seed = new Pair<>(AccumuloTestData.SEED_A, AccumuloTestData.SEED_B);
final View view = new View.Builder().edge("testEdgeGroup").build();
final GetJavaRDDOfElementsInRanges GetJavaRDDOfElementsInRanges = new GetJavaRDDOfElementsInRanges.Builder().inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.EITHER).input(seed).directedType(DirectedType.UNDIRECTED).option(AccumuloTestData.TEST_OPTION_PROPERTY_KEY, "true").view(view).build();
// When
final GetJavaRDDOfElementsInRanges clone = GetJavaRDDOfElementsInRanges.shallowClone();
// Then
assertNotSame(GetJavaRDDOfElementsInRanges, clone);
assertEquals("true", clone.getOption(AccumuloTestData.TEST_OPTION_PROPERTY_KEY));
assertEquals(SeededGraphFilters.IncludeIncomingOutgoingType.EITHER, clone.getIncludeIncomingOutGoing());
assertEquals(DirectedType.UNDIRECTED, clone.getDirectedType());
assertThat(clone.getInput().iterator().next()).isEqualTo(seed);
assertEquals(view, clone.getView());
}
use of uk.gov.gchq.gaffer.data.element.id.ElementId in project Gaffer by gchq.
the class GetRDDOfElementsInRangesTest method shouldShallowCloneOperation.
@Test
@Override
public void shouldShallowCloneOperation() {
// Given
final Pair<ElementId, ElementId> seed = new Pair<>(AccumuloTestData.SEED_A, AccumuloTestData.SEED_B);
final View view = new View.Builder().edge("testEdgeGroup").build();
final GetRDDOfElementsInRanges GetRDDOfElementsInRanges = new GetRDDOfElementsInRanges.Builder().inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.EITHER).input(seed).directedType(DirectedType.UNDIRECTED).option(AccumuloTestData.TEST_OPTION_PROPERTY_KEY, "true").view(view).build();
// When
final GetRDDOfElementsInRanges clone = GetRDDOfElementsInRanges.shallowClone();
// Then
assertNotSame(GetRDDOfElementsInRanges, clone);
assertEquals("true", clone.getOption(AccumuloTestData.TEST_OPTION_PROPERTY_KEY));
assertEquals(SeededGraphFilters.IncludeIncomingOutgoingType.EITHER, clone.getIncludeIncomingOutGoing());
assertEquals(DirectedType.UNDIRECTED, clone.getDirectedType());
assertThat(clone.getInput().iterator().next()).isEqualTo(seed);
assertEquals(view, clone.getView());
}
Aggregations