Search in sources :

Example 6 with LookupTables

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

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

the class LookupTableNameValidatorTest method testValidateDuplicatedNames.

@Test
public void testValidateDuplicatedNames() {
    LookupTables lookupTables = makeLookupTables();
    validator.validate(lookupTables, validations, null);
    assertTrue(validationHelper.hasErrors());
    assertEquals(ValidationScope.LOOKUP_TABLE, validationHelper.getValidation().get(0).getScope());
    assertNull(validationHelper.getValidation().get(0).getId());
    debugErrors(validationHelper);
}
Also used : LookupTables(io.atlasmap.v2.LookupTables) Test(org.junit.Test)

Example 8 with LookupTables

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

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

Example 10 with LookupTables

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

the class DefaultAtlasValidationServiceTest method testValidateAtlasMappingFileNoLookupFieldMappingsWithTablesDefined.

@Test
public void testValidateAtlasMappingFileNoLookupFieldMappingsWithTablesDefined() {
    AtlasMapping mapping = getAtlasMappingFullValid();
    LookupTables lookupTables = new LookupTables();
    mapping.setLookupTables(lookupTables);
    LookupTable lookupTable = new LookupTable();
    lookupTable.setName("table1");
    lookupTable.setDescription("desc_table1");
    lookupTables.getLookupTable().add(lookupTable);
    validations.addAll(validationService.validateMapping(mapping));
    assertFalse(validationHelper.hasErrors());
    assertTrue(validationHelper.hasWarnings());
    assertFalse(validationHelper.hasInfos());
}
Also used : AtlasMapping(io.atlasmap.v2.AtlasMapping) LookupTables(io.atlasmap.v2.LookupTables) LookupTable(io.atlasmap.v2.LookupTable) Test(org.junit.Test) BaseValidatorTest(io.atlasmap.validators.BaseValidatorTest)

Aggregations

LookupTables (io.atlasmap.v2.LookupTables)10 AtlasMapping (io.atlasmap.v2.AtlasMapping)6 LookupTable (io.atlasmap.v2.LookupTable)6 Test (org.junit.Test)5 Mapping (io.atlasmap.v2.Mapping)4 Field (io.atlasmap.v2.Field)3 Validation (io.atlasmap.v2.Validation)3 MockField (io.atlasmap.v2.MockField)2 BaseValidatorTest (io.atlasmap.validators.BaseValidatorTest)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonDataSource (io.atlasmap.json.v2.JsonDataSource)1 BaseMapping (io.atlasmap.v2.BaseMapping)1 DataSource (io.atlasmap.v2.DataSource)1 Mappings (io.atlasmap.v2.Mappings)1 Properties (io.atlasmap.v2.Properties)1 XmlDataSource (io.atlasmap.xml.v2.XmlDataSource)1 Step (io.syndesis.common.model.integration.Step)1 DataMapperStepDefinition (io.syndesis.qe.bdd.entities.DataMapperStepDefinition)1