Search in sources :

Example 41 with AtlasMapping

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

the class BaseMarshallerTest method generateMapping.

private void generateMapping(AtlasMapping atlasMapping) {
    Mapping mapping = AtlasModelFactory.createMapping(MappingType.MAP);
    generateInputField(mapping);
    generateOutputField(mapping);
    mapping.setMappingType(MappingType.MAP);
    mapping.setDelimiterString(",");
    mapping.setAlias("MapPropertyFieldAlias");
    mapping.setDelimiter(",");
    mapping.setDescription("description");
    mapping.setId("id");
    mapping.setLookupTableName("lookupTableName");
    mapping.setStrategy("strategy");
    mapping.setStrategyClassName("strategyClassName");
    atlasMapping.getMappings().getMapping().add(mapping);
}
Also used : Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

Example 42 with AtlasMapping

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

the class BaseMarshallerTest method generateLookupTables.

private void generateLookupTables(AtlasMapping atlasMapping) {
    LookupTable table = new LookupTable();
    table.setName("lookupTable");
    table.setDescription("lookupTableDescription");
    LookupEntry l1 = new LookupEntry();
    l1.setSourceType(FieldType.STRING);
    l1.setSourceValue("Foo");
    l1.setTargetType(FieldType.STRING);
    l1.setTargetValue("Bar");
    table.getLookupEntry().add(l1);
    atlasMapping.getLookupTables().getLookupTable().add(table);
}
Also used : LookupEntry(io.atlasmap.v2.LookupEntry) LookupTable(io.atlasmap.v2.LookupTable)

Example 43 with AtlasMapping

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

the class XmlMarshallerTest method testReferenceMapping.

@Test
public void testReferenceMapping() throws Exception {
    marshaller.marshal(generateAtlasMapping(), new File("target/junit/" + testName.getMethodName() + "/" + "atlasmapping.xml"));
    StreamSource fileSource = new StreamSource(new File("target/junit/" + testName.getMethodName() + "/" + "atlasmapping.xml"));
    JAXBElement<AtlasMapping> mappingElem = unmarshaller.unmarshal(fileSource, AtlasMapping.class);
    assertNotNull(mappingElem);
    assertNotNull(mappingElem.getValue());
    validateAtlasMapping(mappingElem.getValue());
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) StreamSource(javax.xml.transform.stream.StreamSource) File(java.io.File) Test(org.junit.Test)

Example 44 with AtlasMapping

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

the class AtlasMappingServiceTest method testLoadMappingReaderAtlasMappingFormat.

@Test
public void testLoadMappingReaderAtlasMappingFormat() throws Exception {
    BufferedReader reader = new BufferedReader(new FileReader("src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping.json"));
    AtlasMapping atlasMapping = atlasMappingService.loadMapping(reader, AtlasMappingFormat.JSON);
    assertNotNull(atlasMapping);
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) Test(org.junit.Test)

Example 45 with AtlasMapping

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

the class AtlasMappingServiceTest method testLoadMappingFileAtlasMappingFormat.

@Test
public void testLoadMappingFileAtlasMappingFormat() throws AtlasValidationException {
    File file = Paths.get("src" + File.separator + "test" + File.separator + "resources" + File.separator + "atlasmapping.json").toFile();
    AtlasMapping atlasMapping = atlasMappingService.loadMapping(file, AtlasMappingFormat.JSON);
    assertNotNull(atlasMapping);
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) File(java.io.File) 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