GetElements implements
        InputOutput<Iterable<? extends ElementId>, CloseableIterable<? extends Element>>,
        MultiElementIdInput,
        SeededGraphFilters,
        SeedMatching { @Override public Iterable<? extends ElementId> getInput() { return input; }  @Deprecated @Override void setSeedMatching(final SeedMatchingType seedMatching); @Deprecated @Override SeedMatchingType getSeedMatching(); @Override IncludeIncomingOutgoingType getIncludeIncomingOutGoing(); @Override void setIncludeIncomingOutGoing(final IncludeIncomingOutgoingType inOutType); @Override View getView(); @Override void setView(final View view); @Override DirectedType getDirectedType(); @Override void setDirectedType(final DirectedType directedType); @Override Iterable<? extends ElementId> getInput(); @Override void setInput(final Iterable<? extends ElementId> input); @Override TypeReference<CloseableIterable<? extends Element>> getOutputTypeReference(); @Override Map<String, String> getOptions(); @Override void setOptions(final Map<String, String> options); @Override GetElements shallowClone(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void shouldSerialiseAndDeserialiseOperationWithElementIds() throws SerialisationException { final ElementSeed elementSeed1 = new EntitySeed("identifier"); final ElementSeed elementSeed2 = new EdgeSeed("source2", "destination2", true); final GetElements op = new GetElements.Builder() .input(elementSeed1, elementSeed2) .build(); byte[] json = JSONSerialiser.serialise(op, true); final GetElements deserialisedOp = JSONSerialiser.deserialise(json, GetElements.class); final Iterator itr = deserialisedOp.getInput().iterator(); assertEquals(elementSeed1, itr.next()); assertEquals(elementSeed2, itr.next()); assertFalse(itr.hasNext()); }
@Test public void shouldDeserialiseOperationWithVertices() throws SerialisationException { final String json = "{\"class\":\"uk.gov.gchq.gaffer.operation.impl.get.GetElements\"," + "\"input\":[" + "1," + "{\"class\":\"uk.gov.gchq.gaffer.types.TypeSubTypeValue\",\"type\":\"t\",\"subType\":\"s\",\"value\":\"v\"}," + "[\"java.lang.Long\",2]" + "]}"; final GetElements deserialisedOp = JSONSerialiser.deserialise(json, GetElements.class); assertEquals( Lists.newArrayList(new EntitySeed(1), new EntitySeed(new TypeSubTypeValue("t", "s", "v")), new EntitySeed(2L)), Lists.newArrayList(deserialisedOp.getInput()) ); }
@Test public void shouldDeserialiseOperationWithVerticesAndIds() throws SerialisationException { final String json = String.format("{\"class\":\"uk.gov.gchq.gaffer.operation.impl.get.GetElements\"," + "\"input\":[" + "1," + "{\"class\":\"uk.gov.gchq.gaffer.types.TypeSubTypeValue\",\"type\":\"t\",\"subType\":\"s\",\"value\":\"v\"}," + "{\"vertex\":{\"java.lang.Long\":2},\"class\":\"uk.gov.gchq.gaffer.operation.data.EntitySeed\"}" + "]}"); final GetElements deserialisedOp = JSONSerialiser.deserialise(json, GetElements.class); assertEquals( Lists.newArrayList(new EntitySeed(1), new EntitySeed(new TypeSubTypeValue("t", "s", "v")), new EntitySeed(2L)), Lists.newArrayList(deserialisedOp.getInput()) ); }
@Test public void shouldCreateInputFromVertices() { final GetElements op = new GetElements.Builder() .input("1", new EntitySeed("2"), new Entity("group1", "3"), new EdgeSeed("4", "5"), new Edge("group", "6", "7", true)) .build(); assertEquals( Lists.newArrayList(new EntitySeed("1"), new EntitySeed("2"), new Entity("group1", "3"), new EdgeSeed("4", "5"), new Edge("group", "6", "7", true)), Lists.newArrayList(op.getInput()) ); }