Search in sources :

Example 1 with LowerCase

use of org.talend.dataprep.transformation.actions.text.LowerCase in project data-prep by Talend.

the class InjectorUtilTest method testInjectPreparationDetailsDTO.

@Test
public void testInjectPreparationDetailsDTO() throws IllegalAccessException, InstantiationException {
    PreparationDetailsDTO prep = new PreparationDetailsDTO();
    List<Action> actions = new ArrayList<>();
    actions.add(getSimpleAction("uppercase", "column_name", "lastname"));
    actions.add(getSimpleAction("lowercase", "column_name", "lastname"));
    when(actionRegistry.get("uppercase")).thenReturn(UpperCase.class.newInstance());
    when(actionRegistry.get("lowercase")).thenReturn(LowerCase.class.newInstance());
    PreparationDetailsDTO detailsPrep = injectorUtil.injectPreparationDetails(actions, prep);
    detailsPrep.getMetadata().forEach(af -> {
        af.getParameters().forEach(p -> {
            // we check if action create new column then it is on readonly mode
            if (p.getName().equals(CREATE_NEW_COLUMN)) {
                assertTrue(p.isReadonly());
            }
        });
    });
    assertEquals("Number of action should be the same", actions.size(), detailsPrep.getActions().size());
    assertEquals("Number of ActionForm should be the same", actions.size(), detailsPrep.getMetadata().size());
}
Also used : Action(org.talend.dataprep.api.preparation.Action) UpperCase(org.talend.dataprep.transformation.actions.text.UpperCase) PreparationDetailsDTO(org.talend.dataprep.api.preparation.PreparationDetailsDTO) ArrayList(java.util.ArrayList) LowerCase(org.talend.dataprep.transformation.actions.text.LowerCase) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Action (org.talend.dataprep.api.preparation.Action)1 PreparationDetailsDTO (org.talend.dataprep.api.preparation.PreparationDetailsDTO)1 LowerCase (org.talend.dataprep.transformation.actions.text.LowerCase)1 UpperCase (org.talend.dataprep.transformation.actions.text.UpperCase)1