Search in sources :

Example 91 with AtlasMapping

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

the class BaseMarshallerTest method generateAtlasMapping.

protected AtlasMapping generateAtlasMapping() {
    AtlasMapping atlasMapping = AtlasModelFactory.createAtlasMapping();
    atlasMapping.setName("junit");
    generateDataSource(atlasMapping);
    generateLookupTables(atlasMapping);
    Actions actions = generateActions();
    StringList annotations = generateAnnotations();
    ModifierList modifierList = generateModifierList();
    StringList parameterizedTypes = generateParameterizedTypes();
    JavaField inputField = generateJavaField(actions, annotations, modifierList, parameterizedTypes);
    JavaField outputField = generateJavaField(actions, annotations, modifierList, parameterizedTypes);
    Mapping fm = AtlasModelFactory.createMapping(MappingType.MAP);
    fm.getInputField().add(inputField);
    fm.getOutputField().add(outputField);
    populateMapping(fm, MappingType.MAP, "MapPropertyFieldAlias", ",", ",");
    populateMappingString(fm, "description", "id", "lookupTableName", "strategy", "strategyClassName");
    atlasMapping.getMappings().getMapping().add(fm);
    generateProperties(atlasMapping);
    return atlasMapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Actions(io.atlasmap.v2.Actions) StringList(io.atlasmap.v2.StringList) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

Example 92 with AtlasMapping

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

the class BaseMarshallerTest method generateDataSource.

private void generateDataSource(AtlasMapping atlasMapping) {
    DataSource src = generateDataSource("srcId", "srcUri", DataSourceType.SOURCE);
    DataSource tgt = generateDataSource("tgtId", "tgtUri", DataSourceType.TARGET);
    atlasMapping.getDataSource().add(src);
    atlasMapping.getDataSource().add(tgt);
}
Also used : DataSource(io.atlasmap.v2.DataSource)

Example 93 with AtlasMapping

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

the class BaseMarshallerTest method generateCollectionMapping.

protected AtlasMapping generateCollectionMapping() {
    AtlasMapping innerMapping1 = generateAtlasMapping();
    AtlasMapping innerMapping2 = generateAtlasMapping();
    Collection cMapping = (Collection) AtlasModelFactory.createMapping(MappingType.COLLECTION);
    cMapping.setMappings(new Mappings());
    cMapping.getMappings().getMapping().addAll(innerMapping1.getMappings().getMapping());
    cMapping.getMappings().getMapping().addAll(innerMapping2.getMappings().getMapping());
    cMapping.setCollectionType(CollectionType.LIST);
    cMapping.setCollectionSize(new BigInteger("2"));
    cMapping.setAlias("alias");
    cMapping.setDescription("description");
    AtlasMapping mapping = generateAtlasMapping();
    mapping.getMappings().getMapping().clear();
    mapping.getMappings().getMapping().add(cMapping);
    return mapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Mappings(io.atlasmap.v2.Mappings) Collection(io.atlasmap.v2.Collection) BigInteger(java.math.BigInteger)

Example 94 with AtlasMapping

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

the class BaseMarshallerTest method generateActionMapping.

protected AtlasMapping generateActionMapping() {
    AtlasMapping mapping = generateAtlasMapping();
    JavaField outputField = (JavaField) ((Mapping) mapping.getMappings().getMapping().get(0)).getOutputField().get(0);
    populateJavaField(outputField, generateAnnotations(), generateModifierList(), generateParameterizedTypes(), Boolean.FALSE, Boolean.TRUE);
    populateJavaFieldString(outputField, "JavaField", "ArrayList", "getMethod", "setMethod", "foo");
    populateFieldComplexObject(outputField, generateActions(), CollectionType.ARRAY, FieldStatus.SUPPORTED, FieldType.INTEGER);
    populateFieldSimpleObject(outputField, 3, "docid", "/path", false, "bar");
    return mapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

Example 95 with AtlasMapping

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

the class BaseMarshallerTest method generatePropertyReferenceMapping.

protected AtlasMapping generatePropertyReferenceMapping() {
    AtlasMapping mapping = generateAtlasMapping();
    PropertyField inputField = new PropertyField();
    inputField.setName("foo");
    Actions actions = new Actions();
    actions.getActions().add(new Trim());
    populateFieldComplexObject(inputField, actions, CollectionType.ARRAY, FieldStatus.SUPPORTED, FieldType.INTEGER);
    populateFieldSimpleObject(inputField, 3, "docid", "/path", false, "bar");
    Mapping fm = (Mapping) mapping.getMappings().getMapping().get(0);
    fm.getInputField().add(inputField);
    fm.getOutputField().add(inputField);
    populateMapping(fm, MappingType.MAP, "MapPropertyFieldAlias", ",", ",");
    populateMappingString(fm, "description", "id", "lookupTableName", "strategy", "strategyClassName");
    generateProperties(mapping);
    return mapping;
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) PropertyField(io.atlasmap.v2.PropertyField) Actions(io.atlasmap.v2.Actions) Trim(io.atlasmap.v2.Trim) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

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