use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.
the class XmlFieldWriterTest method validateRangeOutValue.
private void validateRangeOutValue(FieldType fieldType, String fileName, Object testObject) throws Exception {
Path path = Paths.get("target" + File.separator + fileName);
AtlasInternalSession session = readSession(fieldType, path, testObject);
assertEquals(null, session.head().getSourceField().getValue());
assertEquals(1, session.getAudits().getAudit().size());
assertEquals("Failed to convert field value '" + testObject.toString() + "' into type '" + fieldType.value().toUpperCase() + "'", session.getAudits().getAudit().get(0).getMessage());
assertEquals(testObject.toString(), session.getAudits().getAudit().get(0).getValue());
assertEquals(AuditStatus.ERROR, session.getAudits().getAudit().get(0).getStatus());
}
use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.
the class XmlFieldWriterTest method writeValue.
public void writeValue(String path, Object value) throws Exception {
if (writer == null) {
createWriter();
}
XmlField xmlField = AtlasXmlModelFactory.createXmlField();
xmlField.setPath(path);
xmlField.setValue(value);
AtlasInternalSession session = mock(AtlasInternalSession.class);
when(session.head()).thenReturn(mock(Head.class));
when(session.head().getSourceField()).thenReturn(mock(Field.class));
when(session.head().getTargetField()).thenReturn(xmlField);
writer.write(session);
}
use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.
the class XmlFieldWriterTest method validateRangeOutMinValue.
private void validateRangeOutMinValue(FieldType fieldType, String fileName, Object testObject, Object expectedObject) throws Exception {
Path path = Paths.get("target" + File.separator + fileName);
AtlasInternalSession session = readSession(fieldType, path, testObject);
assertEquals(expectedObject, session.head().getSourceField().getValue());
assertEquals(0, session.getAudits().getAudit().size());
}
use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.
the class DefaultAtlasSessionTest method testSetFieldWriter.
@Test
public void testSetFieldWriter() {
AtlasFieldWriter writer = new AtlasFieldWriter() {
@Override
public void write(AtlasInternalSession session) throws AtlasException {
LOG.debug("write method");
}
};
session.setFieldWriter(null, writer);
session.setFieldWriter("", writer);
}
use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.
the class DefaultAtlasSessionTest method testGetFieldWriter.
@Test
public void testGetFieldWriter() {
AtlasFieldWriter writer = new AtlasFieldWriter() {
@Override
public void write(AtlasInternalSession session) throws AtlasException {
LOG.debug("write method");
}
};
session.setFieldWriter(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID, writer);
assertNotNull(session.getFieldWriter(null));
assertNotNull(session.getFieldWriter(""));
assertNotNull(session.getFieldWriter(AtlasConstants.DEFAULT_TARGET_DOCUMENT_ID));
assertNotNull(session.getFieldWriter("", AtlasFieldWriter.class));
}
Aggregations