use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestOozieCLIMethods method createCoordinatorAction.
private static CoordinatorAction createCoordinatorAction(DataObject dtObject) {
CoordinatorAction crdActionMock = mock(CoordinatorAction.class);
when(crdActionMock.getId()).thenReturn(dtObject.deamonName);
when(crdActionMock.getJobId()).thenReturn(dtObject.appName);
when(crdActionMock.getActionNumber()).thenReturn(11);
when(crdActionMock.getStatus()).thenReturn(CoordinatorAction.Status.SUBMITTED);
return crdActionMock;
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestOozieCLIMethods method createCoordinatorJob.
private static CoordinatorJob createCoordinatorJob(DataObject dtObject) {
CoordinatorJob coordinatorJobMock = mock(CoordinatorJob.class);
when(coordinatorJobMock.getId()).thenReturn(dtObject.deamonName);
when(coordinatorJobMock.getAppName()).thenReturn(dtObject.appName);
when(coordinatorJobMock.getAppPath()).thenReturn(dtObject.appPath);
when(coordinatorJobMock.getConcurrency()).thenReturn(15);
when(coordinatorJobMock.getStatus()).thenReturn(CoordinatorJob.Status.RUNNING);
when(coordinatorJobMock.getUser()).thenReturn("test");
when(coordinatorJobMock.getGroup()).thenReturn("test-group");
ImmutableList.Builder<CoordinatorAction> builder = ImmutableList.builder();
for (final String id : Arrays.asList("1", "2")) builder.add(createCoordinatorAction(new DataObject() {
{
this.deamonName = id;
this.appName = "testCoordinatorAction";
}
}));
when(coordinatorJobMock.getActions()).thenReturn(builder.build());
return coordinatorJobMock;
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestOozieCLIMethods method testValidateReadPrintCoordActionOutput.
/**
* Create {@code CoordinatorAction} mock,
* call {@code new OozieCLI().printCoordAction() },
* and validate {@code System.out} output on match with
* expected pattern
* <p>
* Method do pass only if output matched with predefined pattern
* </p>
*/
@Test
public void testValidateReadPrintCoordActionOutput() throws IOException {
final DataObject dtObject = new DataObject() {
{
this.deamonName = "testCoordinatorAction";
this.appName = "testCoordinatorJobApp";
this.appPath = "testCoordinatorJobAppPath";
}
};
CoordinatorAction coordinatorAction = createCoordinatorAction(dtObject);
assertPrintCoordActionOutput(readCoordAction(coordinatorAction), dtObject);
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestJsonToBean method testParseCoordinatorActions.
@SuppressWarnings("unchecked")
public void testParseCoordinatorActions() {
JSONArray array = createJsonCoordinatorActionList();
List<CoordinatorAction> list = JsonToBean.createCoordinatorActionList(array);
assertEquals(2, list.size());
assertEquals("ca1", list.get(0).getId());
assertEquals("ca2", list.get(1).getId());
}
use of org.apache.oozie.client.CoordinatorAction in project oozie by apache.
the class TestJsonToBean method testParseCoordinatorAction.
@SuppressWarnings("unchecked")
public void testParseCoordinatorAction() {
JSONObject json = createJsonCoordinatorAction();
CoordinatorAction action = JsonToBean.createCoordinatorAction(json);
assertEquals("a", action.getId());
assertEquals("b", action.getJobId());
assertEquals(1, action.getActionNumber());
assertEquals("c", action.getCreatedConf());
assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), action.getCreatedTime());
assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), action.getNominalTime());
assertEquals("d", action.getExternalId());
assertEquals(CoordinatorAction.Status.IGNORED, action.getStatus());
assertEquals("e", action.getRunConf());
assertEquals(JsonUtils.parseDateRfc822(LAST_MODIFIED), action.getLastModifiedTime());
assertEquals("f", action.getMissingDependencies());
assertEquals("ff", action.getPushMissingDependencies());
assertEquals("g", action.getExternalStatus());
assertEquals("h", action.getTrackerUri());
assertEquals("i", action.getConsoleUrl());
assertEquals("j", action.getErrorCode());
assertEquals("k", action.getErrorMessage());
}
Aggregations