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;
}
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);
}
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;
}
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());
}
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());
}
Aggregations