Search in sources :

Example 6 with PropertyField

use of io.atlasmap.v2.PropertyField in project atlasmap by atlasmap.

the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldDuplicateCustomOrdering.

@Test
public void testProcessPropertyFieldDuplicateCustomOrdering() throws Exception {
    PropertyField propField = AtlasModelFactory.createPropertyField();
    propField.setName("dupe-string");
    propStrategy.setPropertyOrderValue(Arrays.asList(AtlasPropertyType.MAPPING_DEFINED_PROPERTIES.value(), AtlasPropertyType.RUNTIME_PROPERTIES.value()));
    propStrategy.processPropertyField(AtlasTestData.generateAtlasMapping(), propField, AtlasTestData.generateRuntimeProperties());
    assertNotNull(propField);
    assertNotNull(propField.getValue());
    assertTrue(propField.getValue() instanceof String);
    assertEquals("whatup", propField.getValue());
}
Also used : PropertyField(io.atlasmap.v2.PropertyField) Test(org.junit.Test)

Example 7 with PropertyField

use of io.atlasmap.v2.PropertyField in project atlasmap by atlasmap.

the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldMappingDefinedNullRuntime.

@Test
public void testProcessPropertyFieldMappingDefinedNullRuntime() throws Exception {
    PropertyField propField = AtlasModelFactory.createPropertyField();
    propField.setName("prop-int");
    propStrategy.processPropertyField(AtlasTestData.generateAtlasMapping(), propField, null);
    assertNotNull(propField);
    assertNotNull(propField.getValue());
    assertTrue(propField.getValue() instanceof Integer);
    assertEquals(new Integer(Integer.MIN_VALUE), new Integer((Integer) propField.getValue()));
}
Also used : PropertyField(io.atlasmap.v2.PropertyField) Test(org.junit.Test)

Example 8 with PropertyField

use of io.atlasmap.v2.PropertyField in project atlasmap by atlasmap.

the class PropertyModuleTest method testProcessSourceFieldMapping.

@Test
public void testProcessSourceFieldMapping() throws AtlasException {
    PropertyField field = mock(PropertyField.class);
    when(field.getValue()).thenReturn("fieldValue");
    Head head = mock(Head.class);
    when(head.getSourceField()).thenReturn(field);
    AtlasInternalSession session = mock(AtlasInternalSession.class);
    when(session.head()).thenReturn(head);
    DefaultAtlasConversionService atlasConversionService = mock(DefaultAtlasConversionService.class);
    when(atlasConversionService.fieldTypeFromClass(any(String.class))).thenReturn(FieldType.ANY);
    module.setConversionService(atlasConversionService);
    module.processSourceFieldMapping(session);
}
Also used : PropertyField(io.atlasmap.v2.PropertyField) Head(io.atlasmap.spi.AtlasInternalSession.Head) AtlasInternalSession(io.atlasmap.spi.AtlasInternalSession) Test(org.junit.Test)

Example 9 with PropertyField

use of io.atlasmap.v2.PropertyField in project atlasmap by atlasmap.

the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldMappingDefinedNoConversionService.

@Test
public void testProcessPropertyFieldMappingDefinedNoConversionService() throws Exception {
    PropertyField propField = AtlasModelFactory.createPropertyField();
    propField.setName("prop-int");
    propStrategy.setAtlasConversionService(null);
    propStrategy.processPropertyField(AtlasTestData.generateAtlasMapping(), propField, AtlasTestData.generateRuntimeProperties());
    assertNotNull(propField);
    assertNotNull(propField.getValue());
    assertTrue(propField.getValue() instanceof String);
    assertEquals(new Integer(Integer.MIN_VALUE).toString(), propField.getValue());
}
Also used : PropertyField(io.atlasmap.v2.PropertyField) Test(org.junit.Test)

Example 10 with PropertyField

use of io.atlasmap.v2.PropertyField in project atlasmap by atlasmap.

the class DefaultAtlasPropertyStrategyTest method testProcessPropertyFieldNullName.

@Test
public void testProcessPropertyFieldNullName() throws Exception {
    PropertyField propField = AtlasModelFactory.createPropertyField();
    propStrategy.processPropertyField(AtlasTestData.generateAtlasMapping(), propField, AtlasTestData.generateRuntimeProperties());
}
Also used : PropertyField(io.atlasmap.v2.PropertyField) Test(org.junit.Test)

Aggregations

PropertyField (io.atlasmap.v2.PropertyField)22 Test (org.junit.Test)20 AtlasMapping (io.atlasmap.v2.AtlasMapping)5 Mapping (io.atlasmap.v2.Mapping)2 AtlasInternalSession (io.atlasmap.spi.AtlasInternalSession)1 Head (io.atlasmap.spi.AtlasInternalSession.Head)1 Actions (io.atlasmap.v2.Actions)1 Properties (io.atlasmap.v2.Properties)1 Property (io.atlasmap.v2.Property)1 Trim (io.atlasmap.v2.Trim)1