Search in sources :

Example 1 with AtlasMappingService

use of io.atlasmap.core.AtlasMappingService in project atlasmap by atlasmap.

the class AtlasMapXmlToJson method testConvertXmlToJson.

@Test
public void testConvertXmlToJson() throws Exception {
    String sourceXmlPath = "src/test/resources/atlasmapping.xml";
    String destJsonPath = "src/test/resources/atlasmapping.json";
    AtlasMappingService atlasMappingService = DefaultAtlasContextFactory.getInstance().getMappingService();
    AtlasMapping mappingFromXml = atlasMappingService.loadMapping(sourceXmlPath, AtlasMappingFormat.XML);
    atlasMappingService.saveMappingAsFile(mappingFromXml, new File(destJsonPath), AtlasMappingFormat.JSON);
    AtlasMapping mappingFromJson = atlasMappingService.loadMapping(destJsonPath, AtlasMappingFormat.JSON);
    assertEquals(mappingFromXml.getName(), mappingFromJson.getName());
    assertEquals(mappingFromXml.getDataSource().size(), mappingFromJson.getDataSource().size());
    assertEquals(mappingFromXml.getMappings().getMapping().size(), mappingFromJson.getMappings().getMapping().size());
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) AtlasMappingService(io.atlasmap.core.AtlasMappingService) File(java.io.File) Test(org.junit.Test)

Example 2 with AtlasMappingService

use of io.atlasmap.core.AtlasMappingService in project atlasmap by atlasmap.

the class JavaJavaFlatMappingTest method testCreateJavaJavaFlatFieldMapping.

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

use of io.atlasmap.core.AtlasMappingService 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 4 with AtlasMappingService

use of io.atlasmap.core.AtlasMappingService 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 5 with AtlasMappingService

use of io.atlasmap.core.AtlasMappingService 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

AtlasMappingService (io.atlasmap.core.AtlasMappingService)8 AtlasMapping (io.atlasmap.v2.AtlasMapping)8 File (java.io.File)8 Test (org.junit.Test)8 AtlasMappingBaseTest (io.atlasmap.reference.AtlasMappingBaseTest)7 JavaCollection (io.atlasmap.java.v2.JavaCollection)1 JavaField (io.atlasmap.java.v2.JavaField)1 DataSource (io.atlasmap.v2.DataSource)1 Mapping (io.atlasmap.v2.Mapping)1 Mappings (io.atlasmap.v2.Mappings)1