Search in sources :

Example 56 with AtlasInternalSession

use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.

the class BaseDocumentWriterTest method write.

protected void write(Field field) throws AtlasException {
    AtlasInternalSession session = mock(AtlasInternalSession.class);
    when(session.head()).thenReturn(mock(Head.class));
    when(session.head().getTargetField()).thenReturn(field);
    writer.write(session);
}
Also used : Head(io.atlasmap.spi.AtlasInternalSession.Head) AtlasInternalSession(io.atlasmap.spi.AtlasInternalSession)

Example 57 with AtlasInternalSession

use of io.atlasmap.spi.AtlasInternalSession in project atlasmap by atlasmap.

the class BaseDocumentWriterTest method reset.

@Before
public void reset() {
    classLoader = Thread.currentThread().getContextClassLoader();
    writer = new DocumentJavaFieldWriter(conversionService);
    writer.setTargetValueConverter(new TargetValueConverter(classLoader, conversionService) {

        public Object convert(AtlasInternalSession session, LookupTable lookupTable, Field sourceField, Object parentObject, Field targetField) throws AtlasException {
            return targetField.getValue();
        }
    });
    field = null;
    segmentContexts = new LinkedList<>();
    targetTestClassInstance = new TargetTestClass();
    targetTestClassInstance.setContact(new TargetContact());
    targetTestClassInstance.setAddress(new TargetAddress());
    targetOrderListInstance = new TestListOrders();
    targetOrderListInstance.setOrders(new LinkedList<>());
    targetOrderListInstance.getOrders().add(new TargetOrder());
    targetOrderListInstance.getOrders().add(new TargetOrder());
    targetTestClassInstance.setListOrders(targetOrderListInstance);
    targetOrderArrayInstance = new TargetOrderArray();
    targetOrderArrayInstance.setOrders(new BaseOrder[2]);
    targetOrderArrayInstance.getOrders()[0] = new TargetOrder();
    targetOrderArrayInstance.getOrders()[1] = new TargetOrder();
    targetTestClassInstance.setOrderArray(targetOrderArrayInstance);
}
Also used : AtlasInternalSession(io.atlasmap.spi.AtlasInternalSession) TargetContact(io.atlasmap.java.test.TargetContact) TargetAddress(io.atlasmap.java.test.TargetAddress) AtlasException(io.atlasmap.api.AtlasException) TargetOrderArray(io.atlasmap.java.test.TargetOrderArray) Field(io.atlasmap.v2.Field) JavaEnumField(io.atlasmap.java.v2.JavaEnumField) JavaField(io.atlasmap.java.v2.JavaField) TestListOrders(io.atlasmap.java.test.TestListOrders) LookupTable(io.atlasmap.v2.LookupTable) TargetOrder(io.atlasmap.java.test.TargetOrder) TargetTestClass(io.atlasmap.java.test.TargetTestClass) Before(org.junit.Before)

Aggregations

AtlasInternalSession (io.atlasmap.spi.AtlasInternalSession)57 Test (org.junit.Test)37 Head (io.atlasmap.spi.AtlasInternalSession.Head)34 XmlField (io.atlasmap.xml.v2.XmlField)21 JsonField (io.atlasmap.json.v2.JsonField)11 Path (java.nio.file.Path)11 Audits (io.atlasmap.v2.Audits)4 Field (io.atlasmap.v2.Field)4 FieldType (io.atlasmap.v2.FieldType)3 AtlasFieldReader (io.atlasmap.spi.AtlasFieldReader)2 AtlasFieldWriter (io.atlasmap.spi.AtlasFieldWriter)2 LinkedHashMap (java.util.LinkedHashMap)2 AtlasException (io.atlasmap.api.AtlasException)1 TargetAddress (io.atlasmap.java.test.TargetAddress)1 TargetContact (io.atlasmap.java.test.TargetContact)1 TargetOrder (io.atlasmap.java.test.TargetOrder)1 TargetOrderArray (io.atlasmap.java.test.TargetOrderArray)1 TargetTestClass (io.atlasmap.java.test.TargetTestClass)1 TestListOrders (io.atlasmap.java.test.TestListOrders)1 JavaEnumField (io.atlasmap.java.v2.JavaEnumField)1