use of io.atlasmap.v2.LookupTables in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method getAtlasMappingStep.
public Step getAtlasMappingStep(StepDefinition mapping, List<StepDefinition> precedingSteps, StepDefinition followingStep) {
processPrecedingSteps(precedingSteps);
processFolowingStep(followingStep);
List<DataMapperStepDefinition> mappings = mapping.getDataMapperDefinition().get().getDataMapperStepDefinition();
AtlasMapping atlasMapping = new AtlasMapping();
atlasMapping.setMappings(new Mappings());
for (DataSource s : processSources(precedingSteps)) {
atlasMapping.getDataSource().add(s);
}
atlasMapping.setName("REST." + UUID.randomUUID().toString());
atlasMapping.setLookupTables(new LookupTables());
atlasMapping.setProperties(new Properties());
atlasMapping.getDataSource().add(processTarget(followingStep));
atlasMapping.getMappings().getMapping().addAll(generateBaseMappings(mappings, precedingSteps, followingStep));
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
String mapperString = null;
try {
mapperString = mapper.writeValueAsString(atlasMapping);
log.debug(mapperString);
} catch (JsonProcessingException e) {
log.error("error: {}" + e);
}
final Step mapperStep = new Step.Builder().stepKind(StepKind.mapper).configuredProperties(TestUtils.map("atlasmapping", mapperString)).action(getMapperStepAction(followingStep.getConnectorDescriptor().get())).id(UUID.randomUUID().toString()).build();
return mapperStep;
}
use of io.atlasmap.v2.LookupTables in project atlasmap by atlasmap.
the class DefaultAtlasValidationService method validateLookupTables.
private void validateLookupTables(List<Mapping> lookupFieldMappings, LookupTables lookupTables, List<Validation> validations, Set<String> usedIds) {
if (lookupTables != null && lookupTables.getLookupTable() != null && !lookupTables.getLookupTable().isEmpty()) {
// check for duplicate names
Validators.LOOKUPTABLE_NAME_CHECK_FOR_DUPLICATE.get().validate(lookupTables, validations, null);
if (lookupFieldMappings.isEmpty()) {
Validation validation = new Validation();
validation.setScope(ValidationScope.LOOKUP_TABLE);
validation.setMessage("LookupTables are defined but no LookupFields are utilized.");
validation.setStatus(ValidationStatus.WARN);
validations.add(validation);
} else {
validateLookupFieldMapping(lookupFieldMappings, lookupTables, validations, usedIds);
}
}
}
use of io.atlasmap.v2.LookupTables in project atlasmap by atlasmap.
the class BaseValidatorTest 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 testValidateNoDuplicateNames.
@Test
public void testValidateNoDuplicateNames() {
LookupTables lookupTables = makeLookupTables();
lookupTables.getLookupTable().remove(2);
validator.validate(lookupTables, validations, null);
assertFalse(validationHelper.hasErrors());
}
use of io.atlasmap.v2.LookupTables in project atlasmap by atlasmap.
the class LookupTableNameValidatorTest method testSupportsLookupTables.
@Test
public void testSupportsLookupTables() {
LookupTables lookupTables = makeLookupTables();
assertTrue(validator.supports(lookupTables.getClass()));
}
Aggregations