Search in sources :

Example 71 with AtlasMapping

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

the class JavaJsonFlatMappingTest method testCreateJavaJsonFlatFieldMappings.

@Test
public void testCreateJavaJsonFlatFieldMappings() throws Exception {
    AtlasMapping atlasMapping = generateJsonJavaFlatMapping();
    AtlasMappingService atlasMappingService = new AtlasMappingService(Arrays.asList("io.atlasmap.v2", "io.atlasmap.java.v2", "io.atlasmap.json.v2"));
    File path = new File("target/reference-mappings/javaToJson");
    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 72 with AtlasMapping

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

the class JsonJavaFlatMappingTest method testCreateJsonJavaFlatFieldMappings.

@Test
public void testCreateJsonJavaFlatFieldMappings() throws Exception {
    AtlasMapping atlasMapping = generateJsonJavaFlatMapping();
    AtlasMappingService atlasMappingService = new AtlasMappingService(Arrays.asList("io.atlasmap.v2", "io.atlasmap.java.v2", "io.atlasmap.json.v2"));
    File path = new File("target/reference-mappings/jsonToJava");
    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 73 with AtlasMapping

use of io.atlasmap.v2.AtlasMapping 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 74 with AtlasMapping

use of io.atlasmap.v2.AtlasMapping 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 75 with AtlasMapping

use of io.atlasmap.v2.AtlasMapping 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)

Aggregations

AtlasMapping (io.atlasmap.v2.AtlasMapping)131 Test (org.junit.Test)84 Mapping (io.atlasmap.v2.Mapping)62 File (java.io.File)30 DataSource (io.atlasmap.v2.DataSource)21 Validation (io.atlasmap.v2.Validation)20 JavaField (io.atlasmap.java.v2.JavaField)15 MockField (io.atlasmap.v2.MockField)13 Mappings (io.atlasmap.v2.Mappings)10 AtlasContext (io.atlasmap.api.AtlasContext)9 AtlasSession (io.atlasmap.api.AtlasSession)9 Actions (io.atlasmap.v2.Actions)8 BaseMapping (io.atlasmap.v2.BaseMapping)8 LookupTable (io.atlasmap.v2.LookupTable)8 MappingType (io.atlasmap.v2.MappingType)8 BaseValidatorTest (io.atlasmap.validators.BaseValidatorTest)8 List (java.util.List)8 Collectors (java.util.stream.Collectors)8 AtlasMappingUtil (io.atlasmap.core.AtlasMappingUtil)7 DefaultAtlasConversionService (io.atlasmap.core.DefaultAtlasConversionService)7