use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class CombineSeparateChangeDelimiterTest method test.
@Test
public void test() throws Exception {
URL url = Thread.currentThread().getContextClassLoader().getResource("mappings/issue/combine-separate-change-delimiter-mapping.xml");
AtlasMapping mapping = mappingService.loadMapping(url, AtlasMappingFormat.XML);
AtlasContext context = DefaultAtlasContextFactory.getInstance().createContext(mapping);
AtlasSession session = context.createSession();
SourceClass source = new SourceClass().setSourceFirstName("Manjiro").setSourceLastName("Nakahama").setSourceName("Manjiro,Nakahama");
session.setSourceDocument("io.atlasmap.core.issue.SourceClass", source);
context.process(session);
assertFalse(TestHelper.printAudit(session), session.hasErrors());
assertFalse(TestHelper.printAudit(session), session.hasWarns());
Object output = session.getTargetDocument("io.atlasmap.core.issue.TargetClass");
assertEquals(TargetClass.class, output.getClass());
TargetClass target = TargetClass.class.cast(output);
assertEquals("Manjiro", target.getTargetFirstName());
assertEquals("Nakahama", target.getTargetLastName());
assertEquals("Manjiro,Nakahama", target.getTargetName());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldMappingDefinedNullMapping.
@Test
public void testProcessPropertyFieldMappingDefinedNullMapping() throws Exception {
PropertyField propField = AtlasModelFactory.createPropertyField();
propField.setName("prop-int");
AtlasMapping mapping = AtlasTestData.generateAtlasMapping();
mapping.setProperties(null);
propStrategy.processPropertyField(null, propField, AtlasTestData.generateRuntimeProperties());
assertNotNull(propField);
assertNull(propField.getValue());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldMappingDefinedNullProperties.
@Test
public void testProcessPropertyFieldMappingDefinedNullProperties() throws Exception {
PropertyField propField = AtlasModelFactory.createPropertyField();
propField.setName("prop-int");
AtlasMapping mapping = AtlasTestData.generateAtlasMapping();
mapping.setProperties(null);
propStrategy.processPropertyField(mapping, propField, AtlasTestData.generateRuntimeProperties());
assertNotNull(propField);
assertNull(propField.getValue());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class DefaultAtlasValidationServiceTest method testValidateAtlasMappingFileHappyPath.
@Test
public void testValidateAtlasMappingFileHappyPath() {
AtlasMapping mapping = getAtlasMappingFullValid();
assertNotNull(mapping);
// validation
validations.addAll(validationService.validateMapping(mapping));
assertFalse(validationHelper.hasErrors());
assertFalse(validationHelper.hasWarnings());
assertFalse(validationHelper.hasInfos());
}
use of io.atlasmap.v2.AtlasMapping in project atlasmap by atlasmap.
the class DefaultAtlasValidationServiceTest method testValidateAtlasMappingFileLookupTablesDuplicateNames.
@Test
public void testValidateAtlasMappingFileLookupTablesDuplicateNames() {
AtlasMapping mapping = getAtlasMappingWithLookupTables("duplicate_name", "duplicate_name");
validations.addAll(validationService.validateMapping(mapping));
assertTrue(validationHelper.hasErrors());
assertFalse(validationHelper.hasWarnings());
assertFalse(validationHelper.hasInfos());
}
Aggregations