Search in sources :

Example 51 with Mapping

use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.

the class AtlasModuleSupportTest method testListTargetPathsAtlasMapping.

@Test
public void testListTargetPathsAtlasMapping() {
    AtlasMapping atlasMapping = null;
    assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
    atlasMapping = new AtlasMapping();
    assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
    Mappings mappings = new Mappings();
    atlasMapping.setMappings(mappings);
    assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
    Mapping mapping = new Mapping();
    mappings.getMapping().add(mapping);
    assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
    class MockMapping extends Mappings {

        private static final long serialVersionUID = 1L;

        @Override
        public List<BaseMapping> getMapping() {
            return null;
        }
    }
    Mappings mockMapping = new MockMapping();
    atlasMapping.setMappings(mockMapping);
    assertEquals(0, AtlasModuleSupport.listTargetPaths(atlasMapping).size());
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Mappings(io.atlasmap.v2.Mappings) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Test(org.junit.Test)

Example 52 with Mapping

use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.

the class AtlasMappingServiceTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() {
    atlasMappingService = new AtlasMappingService();
    atlasMapping = new AtlasMapping();
    atlasMapping.setName("testname");
    Mappings mappings = new Mappings();
    Mapping mapping = new Mapping();
    mapping.setId("1");
    mapping.setAlias("alias1");
    mappings.getMapping().add(mapping);
    mapping = new Mapping();
    mapping.setId("2");
    mapping.setAlias("alias2");
    mappings.getMapping().add(mapping);
    atlasMapping.setMappings(mappings);
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Mappings(io.atlasmap.v2.Mappings) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BeforeClass(org.junit.BeforeClass)

Example 53 with Mapping

use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.

the class BaseDefaultAtlasContextTest method prepareTargetField.

protected Field prepareTargetField(Mapping mapping, String path, int index) {
    Field field = prepareTargetField(mapping, path);
    field.setIndex(index);
    return field;
}
Also used : SimpleField(io.atlasmap.v2.SimpleField) Field(io.atlasmap.v2.Field)

Example 54 with Mapping

use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.

the class BaseDefaultAtlasContextTest method populateSourceField.

protected Field populateSourceField(Mapping mapping, FieldType type, Object value) {
    Field field = new SimpleField();
    field.setFieldType(type);
    field.setPath("/testPath" + value);
    mapping.getInputField().add(field);
    reader.sources.put(field.getPath(), value);
    return field;
}
Also used : SimpleField(io.atlasmap.v2.SimpleField) Field(io.atlasmap.v2.Field) SimpleField(io.atlasmap.v2.SimpleField)

Example 55 with Mapping

use of io.atlasmap.v2.Mapping in project atlasmap by atlasmap.

the class JavaValidationServiceTest method createMockMapping.

protected Mapping createMockMapping() {
    // Mock MappedField
    MockField inputField = new MockField();
    inputField.setName("input.name");
    MockField outputField = new MockField();
    outputField.setName("out.name");
    Mapping mapping = new Mapping();
    mapping.setMappingType(MappingType.MAP);
    mapping.getInputField().add(inputField);
    mapping.getOutputField().add(inputField);
    return mapping;
}
Also used : MockField(io.atlasmap.v2.MockField) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

Aggregations

AtlasMapping (io.atlasmap.v2.AtlasMapping)120 Mapping (io.atlasmap.v2.Mapping)83 Test (org.junit.Test)65 BaseMapping (io.atlasmap.v2.BaseMapping)29 Field (io.atlasmap.v2.Field)28 Validation (io.atlasmap.v2.Validation)26 DataSource (io.atlasmap.v2.DataSource)21 JavaField (io.atlasmap.java.v2.JavaField)19 MockField (io.atlasmap.v2.MockField)17 Mappings (io.atlasmap.v2.Mappings)11 SimpleField (io.atlasmap.v2.SimpleField)11 MappingType (io.atlasmap.v2.MappingType)10 PropertyField (io.atlasmap.v2.PropertyField)9 File (java.io.File)9 List (java.util.List)9 Collectors (java.util.stream.Collectors)9 AtlasContext (io.atlasmap.api.AtlasContext)8 AtlasSession (io.atlasmap.api.AtlasSession)8 Actions (io.atlasmap.v2.Actions)8 BaseValidatorTest (io.atlasmap.validators.BaseValidatorTest)8