Search in sources :

Example 46 with Mapping

use of io.atlasmap.v2.Mapping 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 47 with Mapping

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

the class JsonValidationServiceTest method testValidateMappingInvalidModuleType.

@Test
public void testValidateMappingInvalidModuleType() {
    AtlasMapping mapping = AtlasModelFactory.createAtlasMapping();
    mapping.setName("thisis_a_valid.name");
    mapping.getDataSource().add(generateDataSource("atlas:xml", DataSourceType.SOURCE));
    mapping.getDataSource().add(generateDataSource("atlas:xml", DataSourceType.TARGET));
    validations.addAll(sourceValidationService.validateMapping(mapping));
    validations.addAll(targetValidationService.validateMapping(mapping));
    assertTrue(validationHelper.hasErrors());
    assertFalse(validationHelper.hasWarnings());
    assertFalse(validationHelper.hasInfos());
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Test(org.junit.Test)

Example 48 with Mapping

use of io.atlasmap.v2.Mapping 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 49 with Mapping

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

the class AtlasMappingUtil method loadMapping.

public AtlasMapping loadMapping(String fileName) throws Exception {
    AtlasMapping mapping = null;
    if (jaxbContext != null) {
        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        Path newFilePath = Paths.get(fileName);
        mapping = (AtlasMapping) ((javax.xml.bind.JAXBElement<?>) unmarshaller.unmarshal(newFilePath.toFile())).getValue();
    }
    return mapping;
}
Also used : Path(java.nio.file.Path) AtlasMapping(io.atlasmap.v2.AtlasMapping) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 50 with Mapping

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

AtlasMapping (io.atlasmap.v2.AtlasMapping)120 Mapping (io.atlasmap.v2.Mapping)83 Test (org.junit.Test)65 BaseMapping (io.atlasmap.v2.BaseMapping)29 Field (io.atlasmap.v2.Field)28 Validation (io.atlasmap.v2.Validation)26 DataSource (io.atlasmap.v2.DataSource)21 JavaField (io.atlasmap.java.v2.JavaField)19 MockField (io.atlasmap.v2.MockField)17 Mappings (io.atlasmap.v2.Mappings)11 SimpleField (io.atlasmap.v2.SimpleField)11 MappingType (io.atlasmap.v2.MappingType)10 PropertyField (io.atlasmap.v2.PropertyField)9 File (java.io.File)9 List (java.util.List)9 Collectors (java.util.stream.Collectors)9 AtlasContext (io.atlasmap.api.AtlasContext)8 AtlasSession (io.atlasmap.api.AtlasSession)8 Actions (io.atlasmap.v2.Actions)8 BaseValidatorTest (io.atlasmap.validators.BaseValidatorTest)8