Search in sources :

Example 6 with LookupTable

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

use of io.atlasmap.v2.LookupTable 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 8 with LookupTable

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

the class BaseMappingTest method getAtlasMappingWithLookupTables.

protected AtlasMapping getAtlasMappingWithLookupTables(String... names) {
    AtlasMapping mapping = this.getAtlasMappingFullValid();
    LookupTables lookupTables = new LookupTables();
    mapping.setLookupTables(lookupTables);
    for (String name : names) {
        LookupTable lookupTable = new LookupTable();
        lookupTable.setName(name);
        lookupTable.setDescription("desc_".concat(name));
        lookupTables.getLookupTable().add(lookupTable);
        Mapping lookupFieldMapping = AtlasModelFactory.createMapping(MappingType.LOOKUP);
        lookupFieldMapping.setDescription("field_desc_".concat(name));
        lookupFieldMapping.setLookupTableName(name);
        Field inputField = createInputJavaField("inputName");
        Field outputField = createInputJavaField("outputName");
        lookupFieldMapping.getInputField().add(inputField);
        lookupFieldMapping.getOutputField().add(outputField);
        mapping.getMappings().getMapping().add(lookupFieldMapping);
    }
    return mapping;
}
Also used : MockField(io.atlasmap.v2.MockField) Field(io.atlasmap.v2.Field) AtlasMapping(io.atlasmap.v2.AtlasMapping) LookupTables(io.atlasmap.v2.LookupTables) LookupTable(io.atlasmap.v2.LookupTable) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping)

Example 9 with LookupTable

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

the class LookupTableNameValidatorTest method makeLookupTables.

private LookupTables makeLookupTables() {
    LookupTables lookupTables = new LookupTables();
    LookupTable lookupTable = new LookupTable();
    LookupTable lookupTable2 = new LookupTable();
    LookupTable lookupTableDup = new LookupTable();
    lookupTable.setName("qwerty");
    lookupTable2.setName("anotherName");
    lookupTableDup.setName("qwerty");
    lookupTables.getLookupTable().add(lookupTable);
    lookupTables.getLookupTable().add(lookupTable2);
    lookupTables.getLookupTable().add(lookupTableDup);
    return lookupTables;
}
Also used : LookupTables(io.atlasmap.v2.LookupTables) LookupTable(io.atlasmap.v2.LookupTable)

Example 10 with LookupTable

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

the class DefaultAtlasValidationServiceTest method testValidateAtlasMappingFileLookupFieldMappingUnusedLookupTable.

@Test
public void testValidateAtlasMappingFileLookupFieldMappingUnusedLookupTable() {
    AtlasMapping mapping = getAtlasMappingFullValid();
    LookupTables lookupTables = new LookupTables();
    mapping.setLookupTables(lookupTables);
    LookupTable lookupTable = new LookupTable();
    lookupTable.setName("table1");
    lookupTable.setDescription("desc_table1");
    LookupTable lookupTable2 = new LookupTable();
    lookupTable2.setName("table2");
    lookupTable2.setDescription("desc_table2");
    lookupTables.getLookupTable().add(lookupTable);
    lookupTables.getLookupTable().add(lookupTable2);
    Mapping lookupFieldMapping = AtlasModelFactory.createMapping(MappingType.LOOKUP);
    lookupFieldMapping.setLookupTableName("table1");
    Field inputField = createInputJavaField("inputName");
    Field outputField = createInputJavaField("outputName");
    lookupFieldMapping.getInputField().add(inputField);
    lookupFieldMapping.getOutputField().add(outputField);
    mapping.getMappings().getMapping().add(lookupFieldMapping);
    validations.addAll(validationService.validateMapping(mapping));
    assertFalse(validationHelper.hasErrors());
    assertTrue(validationHelper.hasWarnings());
    assertFalse(validationHelper.hasInfos());
}
Also used : Field(io.atlasmap.v2.Field) AtlasMapping(io.atlasmap.v2.AtlasMapping) LookupTables(io.atlasmap.v2.LookupTables) LookupTable(io.atlasmap.v2.LookupTable) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) Test(org.junit.Test) BaseValidatorTest(io.atlasmap.validators.BaseValidatorTest)

Aggregations

LookupTable (io.atlasmap.v2.LookupTable)16 Field (io.atlasmap.v2.Field)7 AtlasMapping (io.atlasmap.v2.AtlasMapping)6 LookupEntry (io.atlasmap.v2.LookupEntry)6 LookupTables (io.atlasmap.v2.LookupTables)6 AtlasException (io.atlasmap.api.AtlasException)5 Mapping (io.atlasmap.v2.Mapping)5 AtlasConversionException (io.atlasmap.api.AtlasConversionException)4 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)3 JavaField (io.atlasmap.java.v2.JavaField)3 FieldType (io.atlasmap.v2.FieldType)3 Test (org.junit.Test)3 BaseMapping (io.atlasmap.v2.BaseMapping)2 MockField (io.atlasmap.v2.MockField)2 Validation (io.atlasmap.v2.Validation)2 BaseValidatorTest (io.atlasmap.validators.BaseValidatorTest)2 AtlasFieldActionService (io.atlasmap.api.AtlasFieldActionService)1 AtlasPath (io.atlasmap.core.AtlasPath)1 SegmentContext (io.atlasmap.core.AtlasPath.SegmentContext)1 TargetAddress (io.atlasmap.java.test.TargetAddress)1