Search in sources :

Example 26 with Mappings

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

the class JsonJavaFlatMappingTest method generateJsonJavaFlatMapping.

protected AtlasMapping generateJsonJavaFlatMapping() {
    AtlasMapping atlasMapping = AtlasModelFactory.createAtlasMapping();
    atlasMapping.setName("JsonJavaFlatMapping");
    atlasMapping.getDataSource().add(generateDataSource("atlas:json", DataSourceType.SOURCE));
    atlasMapping.getDataSource().add(generateDataSource("atlas:java?className=io.atlasmap.java.test.TargetFlatPrimitiveClass", DataSourceType.TARGET));
    List<BaseMapping> mappings = atlasMapping.getMappings().getMapping();
    // Add fieldMappings
    for (String fieldName : FLAT_FIELDS) {
        Mapping mfm = AtlasModelFactory.createMapping(MappingType.MAP);
        mfm.getInputField().add(generateJsonField("/" + fieldName));
        mfm.getOutputField().add(generateJavaField("/" + fieldName));
        mappings.add(mfm);
    }
    return atlasMapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping)

Example 27 with Mappings

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

the class JsonJsonFlatMappingTest method generateJsonJsonFlatMapping.

protected AtlasMapping generateJsonJsonFlatMapping() {
    AtlasMapping atlasMapping = AtlasModelFactory.createAtlasMapping();
    atlasMapping.setName("JsonJsonFlatMapping");
    atlasMapping.getDataSource().add(generateDataSource("atlas:json", DataSourceType.SOURCE));
    atlasMapping.getDataSource().add(generateDataSource("atlas:json", DataSourceType.TARGET));
    List<BaseMapping> mappings = atlasMapping.getMappings().getMapping();
    // Add fieldMappings
    for (String fieldName : FLAT_FIELDS) {
        Mapping mfm = AtlasModelFactory.createMapping(MappingType.MAP);
        mfm.getInputField().add(generateJsonField(fieldName));
        mfm.getOutputField().add(generateJavaField(fieldName));
        mappings.add(mfm);
    }
    return atlasMapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping)

Example 28 with Mappings

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

the class XmlJavaFlatMappingTest method testCreateXmlJavaFlatFieldMapping.

@Test
public void testCreateXmlJavaFlatFieldMapping() throws Exception {
    AtlasMapping atlasMapping = generateXmlJavaFlatMapping();
    AtlasMappingService atlasMappingService = new AtlasMappingService(Arrays.asList("io.atlasmap.v2", "io.atlasmap.java.v2", "io.atlasmap.xml.v2"));
    File path = new File("target/reference-mappings/xmlToJava");
    path.mkdirs();
    atlasMappingService.saveMappingAsFile(atlasMapping, new File(path, "atlasmapping-flatprimitive.xml"));
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) AtlasMappingService(io.atlasmap.core.AtlasMappingService) File(java.io.File) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 29 with Mappings

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

the class XmlJsonFlatMappingTest method testCreateXmlJsonFlatFieldMapping.

@Test
public void testCreateXmlJsonFlatFieldMapping() throws Exception {
    AtlasMapping atlasMapping = generateXmlJsonFlatMapping();
    AtlasMappingService atlasMappingService = new AtlasMappingService(Arrays.asList("io.atlasmap.v2", "io.atlasmap.json.v2", "io.atlasmap.xml.v2"));
    File path = new File("target/reference-mappings/xmlToJson");
    path.mkdirs();
    atlasMappingService.saveMappingAsFile(atlasMapping, new File(path, "atlasmapping-flatprimitive.xml"));
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) AtlasMappingService(io.atlasmap.core.AtlasMappingService) File(java.io.File) AtlasMappingBaseTest(io.atlasmap.reference.AtlasMappingBaseTest) Test(org.junit.Test)

Example 30 with Mappings

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

the class XmlJsonFlatMappingTest method generateXmlJsonFlatMapping.

protected AtlasMapping generateXmlJsonFlatMapping() {
    AtlasMapping atlasMapping = AtlasModelFactory.createAtlasMapping();
    atlasMapping.setName("XmlJsonFlatMapping");
    atlasMapping.getDataSource().add(generateDataSource("atlas:xml?complexType=XmlFlatPrimitiveAttribute", DataSourceType.SOURCE));
    atlasMapping.getDataSource().add(generateDataSource("atlas:json", DataSourceType.TARGET));
    List<BaseMapping> mappings = atlasMapping.getMappings().getMapping();
    // Add fieldMappings
    for (String fieldName : FLAT_FIELDS) {
        Mapping mfm = AtlasModelFactory.createMapping(MappingType.MAP);
        mfm.getInputField().add(generateXmlField("/XmlFPA/", fieldName));
        mfm.getOutputField().add(generateJsonField(fieldName));
        mappings.add(mfm);
    }
    return atlasMapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) BaseMapping(io.atlasmap.v2.BaseMapping)

Aggregations

AtlasMapping (io.atlasmap.v2.AtlasMapping)55 Test (org.junit.Test)41 Mapping (io.atlasmap.v2.Mapping)34 BaseMapping (io.atlasmap.v2.BaseMapping)14 JavaField (io.atlasmap.java.v2.JavaField)12 DataSource (io.atlasmap.v2.DataSource)11 Mappings (io.atlasmap.v2.Mappings)11 File (java.io.File)11 Validation (io.atlasmap.v2.Validation)10 MockField (io.atlasmap.v2.MockField)8 AtlasMappingService (io.atlasmap.core.AtlasMappingService)7 AtlasMappingUtil (io.atlasmap.core.AtlasMappingUtil)7 DefaultAtlasConversionService (io.atlasmap.core.DefaultAtlasConversionService)7 AtlasModuleDetail (io.atlasmap.spi.AtlasModuleDetail)7 AtlasModuleMode (io.atlasmap.spi.AtlasModuleMode)7 AtlasModelFactory (io.atlasmap.v2.AtlasModelFactory)7 DataSourceType (io.atlasmap.v2.DataSourceType)7 FieldType (io.atlasmap.v2.FieldType)7 MappingType (io.atlasmap.v2.MappingType)7 ValidationScope (io.atlasmap.v2.ValidationScope)7