public Component getComplexTransformationComponent(final String firstInputAttributePath, final String secondInputAttributePath, final String outputAttributePath) throws Exception { final Transformation transformation2 = transformationsServiceTestUtils.getComplexTransformation(); final Map<String, String> transformationComponent3ParameterMappings = Maps.newLinkedHashMap(); transformationComponent3ParameterMappings.put(transformation2.getParameters().getFirst(), firstInputAttributePath); transformationComponent3ParameterMappings.put(transformation2.getParameters().get(1), secondInputAttributePath); transformationComponent3ParameterMappings.put("transformationOutputVariable", outputAttributePath); return createComponent(transformation2.getName() + " (component)", transformationComponent3ParameterMappings, transformation2, null, null); } }
public Component getTransformationComponentSimpleTrimComponent(final String inputAttributePath, final String outputAttributePath) throws Exception { final Transformation transformation = transformationsServiceTestUtils.getSimpleTrimTransformation(); final Map<String, String> transformationComponentParameterMappings = Maps.newLinkedHashMap(); transformationComponentParameterMappings.put(transformation.getParameters().get(0), inputAttributePath); transformationComponentParameterMappings.put("transformationOutputVariable", outputAttributePath); return createComponent(transformation.getName() + " (component)", transformationComponentParameterMappings, transformation, null, null); }
private static void testTransformation(final Transformation transformation) { MatcherAssert.assertThat(transformation.getUuid(), Matchers.equalTo("42")); MatcherAssert.assertThat(transformation.getFunctionType(), Matchers.equalTo(FunctionType.Transformation)); MatcherAssert.assertThat(transformation.getName(), Matchers.equalTo("transformation")); MatcherAssert.assertThat(transformation.getDescription(), Matchers.equalTo("transformation")); MatcherAssert.assertThat(transformation.getFunctionDescription(), Matchers.is(Matchers.nullValue())); MatcherAssert.assertThat(transformation.getParameters(), Matchers.hasSize(1)); MatcherAssert.assertThat(transformation.getParameters(), Matchers.hasItems("transformationInputString")); MatcherAssert.assertThat(transformation.getComponents(), Matchers.hasSize(3)); final Component c1 = CustomTransformationDeserializerTest.checkComponent(transformation, "1", "compose", "Add pre- or postfix to a string.", Lists.newArrayList("prefix", "postfix"), Tuple.tuple("inputString", "variable_name")); final Component c2 = CustomTransformationDeserializerTest.checkComponent(transformation, "2", "case", "Upper/lower-case transformation.", Lists.newArrayList("to", "language")); final Component c3 = CustomTransformationDeserializerTest .checkComponent(transformation, "3", "count", "Returns the an increasing count for each received literal.", Collections.<String>emptyList(), Tuple.tuple("inputString", "dataset")); // *C1* --> C2 MatcherAssert.assertThat(c1.getInputComponents(), Matchers.is(Matchers.nullValue())); MatcherAssert.assertThat(c1.getOutputComponents(), Matchers.hasSize(1)); MatcherAssert.assertThat(Iterators.getOnlyElement(c1.getOutputComponents().iterator()), Matchers.is(Matchers.sameInstance(c2))); // C1 --> *C2* MatcherAssert.assertThat(c2.getInputComponents(), Matchers.hasSize(1)); MatcherAssert.assertThat(c2.getOutputComponents(), Matchers.is(Matchers.nullValue())); MatcherAssert.assertThat(Iterators.getOnlyElement(c2.getInputComponents().iterator()), Matchers.is(Matchers.sameInstance(c1))); MatcherAssert.assertThat(c3.getInputComponents(), Matchers.is(Matchers.nullValue())); MatcherAssert.assertThat(c3.getOutputComponents(), Matchers.is(Matchers.nullValue())); }
/** * Create a new {@code Transformation} as a copy from a existing transformation with a specific id. <br> * <b>Use with care!</b> * <p> * This factory is to be used by {@link org.dswarm.persistence.model.job.utils.TransformationDeserializer} to avoid reflection * based access to a private/protected field, since the Json deserializer needs a way to set the id that was provided by the * JSON. * </p> * <p> * The id is otherwise assigned by the database/Hibernate layer. You should never need this outside of * {@code TransformationDeserializer}. * </p> * * @param transformation the base transformation that will be copied * @param uuid the target transformation's id value * @return a new transformation with the given id and all other attributes copied from the provided transformation. */ public static Transformation withId(final Transformation transformation, final String uuid) { final Transformation newTransformation = new Transformation(uuid); newTransformation.setComponents(transformation.getComponents()); newTransformation.setFunctionDescription(transformation.getFunctionDescription()); newTransformation.setParameters(transformation.getParameters()); newTransformation.setDescription(transformation.getDescription()); newTransformation.setName(transformation.getName()); return newTransformation; } }
Assert.assertNotNull("the transformation name shouldn't be null", transformation.getName()); Assert.assertEquals("the transformation names are not equal", transformationName, transformation.getName()); Assert.assertNotNull("the transformation description shouldn't be null", transformation.getDescription()); Assert.assertEquals("the transformation descriptions are not equal", transformationDescription, transformation.getDescription());
Assert.assertNotNull("the transformation name shouldn't be null", transformation.getName()); Assert.assertEquals("the transformation names are not equal", transformationName, transformation.getName()); Assert.assertNotNull("the transformation description shouldn't be null", transformation.getDescription()); Assert.assertEquals("the transformation descriptions are not equal", transformationDescription, transformation.getDescription());
transformationComponent3.setName(transformation2.getName() + " (component)"); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
transformationComponent3.setName(transformation2.getName() + " (component)"); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
transformationComponent3.setName(transformation2.getName() + " (component)"); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
transformationComponent3.setName(transformation2.getName() + " (component)"); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
transformationComponent3.setName(transformation2.getName() + " (component)"); transformationComponent3.setFunction(transformation2); transformationComponent3.setParameterMappings(transformationComponent3ParameterMappings);
transformationComponent.setName(transformation.getName() + " (component)"); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
transformationComponent.setName(transformation.getName() + " (component)"); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
transformationComponent.setName(transformation.getName() + " (component)"); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
transformationComponent.setName(transformation.getName() + " (component)"); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);
transformationComponent.setName(transformation.getName() + " (component)"); transformationComponent.setFunction(transformation); transformationComponent.setParameterMappings(transformationComponentParameterMappings);