Search in sources :

Example 1 with MockField

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

the class BaseMappingTest method createMockMappedFields.

protected void createMockMappedFields(AtlasMapping mapping, Mapping mapFieldMapping) {
    // Mock MappedField
    MockField inputField = new MockField();
    inputField.setName("input.name");
    MockField outputField = new MockField();
    outputField.setName("out.name");
    mapFieldMapping.getInputField().add(inputField);
    mapFieldMapping.getOutputField().add(outputField);
    mapping.getMappings().getMapping().add(mapFieldMapping);
}
Also used : MockField(io.atlasmap.v2.MockField)

Example 2 with MockField

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

the class BaseMappingTest method createInputJavaField.

protected Field createInputJavaField(String inputName) {
    MockField inputJavaField = AtlasModelFactory.createMockField();
    inputJavaField.setFieldType(FieldType.STRING);
    inputJavaField.setCustom("java.lang.String");
    inputJavaField.setName(inputName);
    return inputJavaField;
}
Also used : MockField(io.atlasmap.v2.MockField)

Example 3 with MockField

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

the class BaseValidatorTest method getAtlasMappingFullValid.

protected AtlasMapping getAtlasMappingFullValid() {
    AtlasMapping mapping = AtlasModelFactory.createAtlasMapping();
    mapping.setName("thisis_a_valid.name");
    DataSource src = new DataSource();
    src.setDataSourceType(DataSourceType.SOURCE);
    src.setUri("atlas:java?2");
    DataSource tgt = new DataSource();
    tgt.setDataSourceType(DataSourceType.TARGET);
    tgt.setUri("atlas:java?3");
    mapping.getDataSource().add(src);
    mapping.getDataSource().add(tgt);
    Mapping mapFieldMapping = AtlasModelFactory.createMapping(MappingType.MAP);
    MockField inputField = AtlasModelFactory.createMockField();
    inputField.setFieldType(FieldType.STRING);
    inputField.setCustom("java.lang.String");
    inputField.setName("inputName");
    mapFieldMapping.getInputField().add(inputField);
    MockField outputField = AtlasModelFactory.createMockField();
    outputField.setFieldType(FieldType.STRING);
    outputField.setCustom("java.lang.String");
    outputField.setName("outputName");
    mapFieldMapping.getOutputField().add(outputField);
    Mapping separateMapping = AtlasModelFactory.createMapping(MappingType.SEPARATE);
    MockField sIJavaField = AtlasModelFactory.createMockField();
    sIJavaField.setFieldType(FieldType.STRING);
    sIJavaField.setCustom("java.lang.String");
    sIJavaField.setName("inputName");
    separateMapping.getInputField().add(sIJavaField);
    MockField sOJavaField = AtlasModelFactory.createMockField();
    sOJavaField.setFieldType(FieldType.STRING);
    sOJavaField.setCustom("java.lang.String");
    sOJavaField.setName("outputName");
    sOJavaField.setIndex(0);
    separateMapping.getOutputField().add(sOJavaField);
    mapping.getMappings().getMapping().add(mapFieldMapping);
    mapping.getMappings().getMapping().add(separateMapping);
    return mapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) MockField(io.atlasmap.v2.MockField) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) DataSource(io.atlasmap.v2.DataSource)

Example 4 with MockField

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

the class JsonValidationServiceTest 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)

Example 5 with MockField

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

the class AtlasModuleSupportTest method testListTargetPathsListOfBaseMapping.

@Test
public void testListTargetPathsListOfBaseMapping() {
    List<BaseMapping> mappings = null;
    assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
    mappings = new ArrayList<>();
    assertEquals(0, AtlasModuleSupport.listTargetPaths(mappings).size());
    Mapping mapping = new Mapping();
    Field field = new MockField();
    field.setPath("MockPath");
    mapping.getOutputField().add(field);
    mappings.add(mapping);
    assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
    Collection collection = null;
    mappings.add(collection);
    assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
    collection = new Collection();
    mappings.add(collection);
    assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
    Mappings mapings = new Mappings();
    collection.setMappings(mapings);
    assertEquals(1, AtlasModuleSupport.listTargetPaths(mappings).size());
}
Also used : MockField(io.atlasmap.v2.MockField) Field(io.atlasmap.v2.Field) MockField(io.atlasmap.v2.MockField) Mappings(io.atlasmap.v2.Mappings) Collection(io.atlasmap.v2.Collection) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Test(org.junit.Test)

Aggregations

MockField (io.atlasmap.v2.MockField)10 AtlasMapping (io.atlasmap.v2.AtlasMapping)6 Mapping (io.atlasmap.v2.Mapping)6 DataSource (io.atlasmap.v2.DataSource)2 BaseMapping (io.atlasmap.v2.BaseMapping)1 Collection (io.atlasmap.v2.Collection)1 Field (io.atlasmap.v2.Field)1 Mappings (io.atlasmap.v2.Mappings)1 Test (org.junit.Test)1