Search in sources :

Example 6 with FunctionComposite

use of uk.gov.gchq.koryphe.function.FunctionComposite in project Gaffer by gchq.

the class TypeSubTypeValueToTupleTest method shouldGetAndSetUsingCompositeFunction.

@Test
public void shouldGetAndSetUsingCompositeFunction() {
    // Given
    final TypeSubTypeValue typeSubTypeValue = new TypeSubTypeValue("type", "subType", "value");
    final Function<Object, Object> compositeFunction = new FunctionComposite(Lists.newArrayList(new TypeSubTypeValueToTuple(), new TupleAdaptedFunctionComposite.Builder().select(new String[] { "value" }).execute(new FunctionComposite(Arrays.asList(new Length(), new ToString()))).project(new String[] { "type" }).build()));
    // When
    compositeFunction.apply(typeSubTypeValue);
    // Then
    assertEquals(new TypeSubTypeValue("5", "subType", "value"), typeSubTypeValue);
}
Also used : Length(uk.gov.gchq.koryphe.impl.function.Length) TypeSubTypeValue(uk.gov.gchq.gaffer.types.TypeSubTypeValue) ToString(uk.gov.gchq.koryphe.impl.function.ToString) ToString(uk.gov.gchq.koryphe.impl.function.ToString) TupleAdaptedFunctionComposite(uk.gov.gchq.koryphe.tuple.function.TupleAdaptedFunctionComposite) FunctionComposite(uk.gov.gchq.koryphe.function.FunctionComposite) FunctionTest(uk.gov.gchq.koryphe.function.FunctionTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)6 FunctionComposite (uk.gov.gchq.koryphe.function.FunctionComposite)6 DivideBy (uk.gov.gchq.koryphe.impl.function.DivideBy)3 FirstItem (uk.gov.gchq.koryphe.impl.function.FirstItem)3 ToLong (uk.gov.gchq.koryphe.impl.function.ToLong)3 ExtractProperty (uk.gov.gchq.gaffer.data.element.function.ExtractProperty)2 TypeSubTypeValue (uk.gov.gchq.gaffer.types.TypeSubTypeValue)2 FunctionTest (uk.gov.gchq.koryphe.function.FunctionTest)2 CallMethod (uk.gov.gchq.koryphe.impl.function.CallMethod)2 Length (uk.gov.gchq.koryphe.impl.function.Length)2 ToInteger (uk.gov.gchq.koryphe.impl.function.ToInteger)2 ToString (uk.gov.gchq.koryphe.impl.function.ToString)2 TupleAdaptedFunctionComposite (uk.gov.gchq.koryphe.tuple.function.TupleAdaptedFunctionComposite)2 Entity (uk.gov.gchq.gaffer.data.element.Entity)1 TypeValue (uk.gov.gchq.gaffer.types.TypeValue)1