Search in sources :

Example 16 with ElementId

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);
}
Also used : EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) ElementId(uk.gov.gchq.gaffer.data.element.id.ElementId) Test(org.junit.jupiter.api.Test)

Example 17 with ElementId

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);
}
Also used : ElementId(uk.gov.gchq.gaffer.data.element.id.ElementId) Test(org.junit.jupiter.api.Test)

Example 18 with ElementId

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);
}
Also used : Entity(uk.gov.gchq.gaffer.data.element.Entity) ElementId(uk.gov.gchq.gaffer.data.element.id.ElementId) Test(org.junit.jupiter.api.Test)

Example 19 with ElementId

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());
}
Also used : View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) ElementId(uk.gov.gchq.gaffer.data.element.id.ElementId) Pair(uk.gov.gchq.gaffer.commonutil.pair.Pair) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Example 20 with ElementId

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());
}
Also used : View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) ElementId(uk.gov.gchq.gaffer.data.element.id.ElementId) Pair(uk.gov.gchq.gaffer.commonutil.pair.Pair) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ElementId (uk.gov.gchq.gaffer.data.element.id.ElementId)58 Test (org.junit.jupiter.api.Test)32 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)29 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)19 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)19 EdgeSeed (uk.gov.gchq.gaffer.operation.data.EdgeSeed)17 Edge (uk.gov.gchq.gaffer.data.element.Edge)14 Element (uk.gov.gchq.gaffer.data.element.Element)14 EdgeId (uk.gov.gchq.gaffer.data.element.id.EdgeId)14 EntityId (uk.gov.gchq.gaffer.data.element.id.EntityId)14 HashSet (java.util.HashSet)11 Entity (uk.gov.gchq.gaffer.data.element.Entity)9 User (uk.gov.gchq.gaffer.user.User)9 ArrayList (java.util.ArrayList)7 IteratorSettingException (uk.gov.gchq.gaffer.accumulostore.key.exception.IteratorSettingException)7 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)7 Test (org.junit.Test)6 JSONSerialisationTest (uk.gov.gchq.gaffer.JSONSerialisationTest)6 TraitRequirement (uk.gov.gchq.gaffer.integration.TraitRequirement)5 Key (org.apache.accumulo.core.data.Key)4