Search in sources :

Example 11 with Actions

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

the class OverloadedFieldActionsTest method testListActions.

@Test
public void testListActions() throws Exception {
    List<ActionDetail> actions = DefaultAtlasContextFactory.getInstance().getFieldActionService().listActionDetails();
    Integer found = 0;
    for (ActionDetail d : actions) {
        if (d.getName().equals("DayOfWeek")) {
            found++;
        }
    }
    assertEquals(Integer.valueOf(2), found);
}
Also used : ActionDetail(io.atlasmap.v2.ActionDetail) Test(org.junit.Test)

Example 12 with Actions

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

the class DefaultAtlasFieldActionsServiceTest method testProcessActionsActionsField.

@Test
public void testProcessActionsActionsField() throws AtlasException {
    Actions actions = null;
    SimpleField field = new SimpleField();
    field.setFieldType(FieldType.COMPLEX);
    fieldActionsService.processActions(actions, field);
    field.setValue(null);
    field.setFieldType(FieldType.INTEGER);
    fieldActionsService.processActions(actions, field);
    field.setValue(new Integer(0));
    field.setFieldType(FieldType.INTEGER);
    fieldActionsService.processActions(actions, field);
    @SuppressWarnings("serial")
    class MockActions extends Actions {

        @Override
        public List<Action> getActions() {
            return null;
        }
    }
    fieldActionsService.processActions(new MockActions(), field);
    actions = new Actions();
    fieldActionsService.processActions(actions, field);
    actions.getActions().add(new Trim());
    field.setValue("testString");
    field.setFieldType(FieldType.STRING);
    fieldActionsService.processActions(actions, field);
    field.setValue(new Integer(8));
    field.setFieldType(FieldType.NUMBER);
    fieldActionsService.processActions(actions, field);
}
Also used : Action(io.atlasmap.v2.Action) Actions(io.atlasmap.v2.Actions) Trim(io.atlasmap.v2.Trim) SimpleField(io.atlasmap.v2.SimpleField) Test(org.junit.Test)

Example 13 with Actions

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

the class DefaultAtlasFieldActionsServiceTest method testProcessActionsActionsFieldAtlasConversionException.

@Test(expected = AtlasConversionException.class)
public void testProcessActionsActionsFieldAtlasConversionException() throws AtlasException {
    Actions actions = null;
    SimpleField field = new SimpleField();
    Object value = new Object();
    field.setValue(value);
    field.setFieldType(FieldType.INTEGER);
    fieldActionsService.processActions(actions, field);
}
Also used : Actions(io.atlasmap.v2.Actions) SimpleField(io.atlasmap.v2.SimpleField) Test(org.junit.Test)

Example 14 with Actions

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

the class DefaultAtlasFieldActionsServiceTest method testprocessActionsActionsObjectFieldType.

@Test
public void testprocessActionsActionsObjectFieldType() throws AtlasException {
    Actions actions = new Actions();
    assertNotNull(fieldActionsService.processActions(actions, "testString", FieldType.STRING));
    assertNotNull(fieldActionsService.processActions(actions, new Integer(8), FieldType.STRING));
}
Also used : Actions(io.atlasmap.v2.Actions) Test(org.junit.Test)

Example 15 with Actions

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

the class DefaultAtlasFieldActionsServiceTest method testprocessActionsActionsObjectFieldTypeAtlasConversionException.

@Test(expected = AtlasConversionException.class)
public void testprocessActionsActionsObjectFieldTypeAtlasConversionException() throws AtlasException {
    Actions actions = null;
    SimpleField field = new SimpleField();
    Object value = new Object();
    field.setValue(value);
    field.setFieldType(FieldType.INTEGER);
    fieldActionsService.processActions(actions, field);
}
Also used : Actions(io.atlasmap.v2.Actions) SimpleField(io.atlasmap.v2.SimpleField) Test(org.junit.Test)

Aggregations

Actions (io.atlasmap.v2.Actions)15 AtlasMapping (io.atlasmap.v2.AtlasMapping)10 Mapping (io.atlasmap.v2.Mapping)9 Test (org.junit.Test)8 Trim (io.atlasmap.v2.Trim)7 SimpleField (io.atlasmap.v2.SimpleField)5 ActionDetail (io.atlasmap.v2.ActionDetail)4 Capitalize (io.atlasmap.v2.Capitalize)4 Lowercase (io.atlasmap.v2.Lowercase)4 SeparateByDash (io.atlasmap.v2.SeparateByDash)4 SeparateByUnderscore (io.atlasmap.v2.SeparateByUnderscore)4 StringList (io.atlasmap.v2.StringList)4 TrimLeft (io.atlasmap.v2.TrimLeft)4 TrimRight (io.atlasmap.v2.TrimRight)4 Uppercase (io.atlasmap.v2.Uppercase)4 Camelize (io.atlasmap.v2.Camelize)3 Field (io.atlasmap.v2.Field)3 Length (io.atlasmap.v2.Length)3 Mappings (io.atlasmap.v2.Mappings)3 File (java.io.File)3