use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateProperties.
private void generateProperties(AtlasMapping mapping) {
Property p = new Property();
p.setName("foo");
p.setValue("bar");
p.setFieldType(FieldType.INTEGER);
mapping.setProperties(new Properties());
mapping.getProperties().getProperty().add(p);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class JsonMarshallerTest method testComplexRequests.
@Test
public void testComplexRequests() throws Exception {
runJSONSerializationTest(generatePropertyReferenceMapping(), "atlasmapping-property-request.json");
runJSONSerializationTest(generateConstantMapping(), "atlasmapping-constant-request.json");
runJSONSerializationTest(generateMultiSourceMapping(), "atlasmapping-multisource-request.json");
runJSONSerializationTest(generateCollectionMapping(), "atlasmapping-collection-request.json");
runJSONSerializationTest(generateCombineMapping(), "atlasmapping-combine-request.json");
runJSONSerializationTest(generateActionMapping(), "atlasmapping-field-action-request.json");
AtlasMapping action = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-field-action-request.json"), AtlasMapping.class);
assertNotNull(action);
validateAtlasMapping(action);
AtlasMapping collection = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-collection-request.json"), AtlasMapping.class);
assertNotNull(collection);
validateCollectionAtlasMapping(collection);
AtlasMapping multisource = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-multisource-request.json"), AtlasMapping.class);
assertNotNull(multisource);
validateMultisourceAtlasMapping(multisource);
AtlasMapping propertyMapping = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-property-request.json"), AtlasMapping.class);
assertNotNull(propertyMapping);
validatePropertyAtlasMapping(propertyMapping);
AtlasMapping constantMapping = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-constant-request.json"), AtlasMapping.class);
assertNotNull(constantMapping);
validateConstantAtlasMapping(constantMapping);
AtlasMapping combineAtlasMapping = mapper.readValue(new File("target" + File.separator + "junit" + File.separator + testName.getMethodName() + File.separator + "atlasmapping-combine-request.json"), AtlasMapping.class);
assertNotNull(combineAtlasMapping);
validateCombineAtlasMapping(combineAtlasMapping);
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class XmlMarshallerTest method readAtlasMapping.
private JAXBElement<AtlasMapping> readAtlasMapping() throws JAXBException {
StreamSource fileSource = new StreamSource(new File("target/junit/" + testName.getMethodName() + "/" + "atlasmapping.xml"));
JAXBElement<AtlasMapping> mappingElem = unmarshaller.unmarshal(fileSource, AtlasMapping.class);
assertNotNull(mappingElem);
assertNotNull(mappingElem.getValue());
return mappingElem;
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method generateConstantMapping.
protected AtlasMapping generateConstantMapping() {
AtlasMapping mapping = generateAtlasMapping();
ConstantField inputField = new ConstantField();
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");
return mapping;
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class BaseMarshallerTest method validateAtlasMapping.
protected void validateAtlasMapping(AtlasMapping atlasMapping) {
assertNotNull(atlasMapping);
assertEquals("junit", atlasMapping.getName());
assertEquals(2, atlasMapping.getDataSource().size());
valiateDataSource(atlasMapping.getDataSource().get(0), DataSourceType.SOURCE, "srcId", "srcUri");
valiateDataSource(atlasMapping.getDataSource().get(1), DataSourceType.TARGET, "tgtId", "tgtUri");
assertNotNull(atlasMapping.getLookupTables());
assertEquals(1, atlasMapping.getLookupTables().getLookupTable().size());
validateLookupTable(atlasMapping.getLookupTables().getLookupTable().get(0));
assertNotNull(atlasMapping.getMappings());
assertEquals(1, atlasMapping.getMappings().getMapping().size());
Mapping mapping = (Mapping) atlasMapping.getMappings().getMapping().get(0);
assertEquals(1, mapping.getInputField().size());
validateJavaField((JavaField) mapping.getInputField().get(0));
assertEquals(1, mapping.getOutputField().size());
validateJavaField((JavaField) mapping.getOutputField().get(0));
validateMapping(mapping, MappingType.MAP, generateMappingParams());
assertNotNull(atlasMapping.getProperties());
assertEquals(1, atlasMapping.getProperties().getProperty().size());
validateProperty(atlasMapping.getProperties().getProperty().get(0));
}
Aggregations