@Test public void testStopAllJobExecutions() throws Exception { String jobName = generateJobName(); executeJobCreate(jobName, JOB_WITH_STEP_EXECUTIONS); checkForJobInList(jobName, JOB_WITH_STEP_EXECUTIONS, true); triggerJobWithDelay(jobName, "5"); Thread.sleep(5000); Table table = (Table) executeCommand("job execution list").getResult(); assertTrue(!table.getRows().isEmpty()); String executionId = table.getRows().get(0).getValue(1); String executionStatus = table.getRows().get(0).getValue(5); assertTrue(executionStatus.equals("STARTING") || executionStatus.equals("STARTED")); // Stop the execution by the given executionId. executeCommand("job execution all stop --force true"); // sleep for stop() until the step2 is invoked. Thread.sleep(3000); table = (Table) executeCommand("job execution list").getResult(); for (TableRow tr : table.getRows()) { // Match by above executionId if (tr.getValue(1).equals(executionId)) { executionStatus = tr.getValue(5); break; } } assertEquals("STOPPED", executionStatus); }
@Test public void testListRuntimeModulesByContainerId() { logger.info("Test listing of runtime modules by containerId"); String streamName = "foo-runtimeModulesByContainerIdTest"; stream().create(streamName, "time | log"); Table table = (Table) executeCommand("runtime modules").getResult(); List<TableRow> runtimeModules = new ArrayList<TableRow>(); for (TableRow row : table.getRows()) { // match by group name if (row.getValue(2).equals(streamName)) { runtimeModules.add(row); } } // Get containerId for a runtime module String containerId = runtimeModules.get(0).getValue(1); CommandResult cmdResult = executeCommand("runtime modules --containerId " + containerId); Table table1 = (Table) cmdResult.getResult(); List<TableRow> fooStreamModules = new ArrayList<TableRow>(); for (TableRow row : table1.getRows()) { // Verify all the rows have the same containerId assertTrue(row.getValue(1).equals(containerId)); // match by group name if (row.getValue(2).equals(runtimeModules.get(0).getValue(2))) { fooStreamModules.add(row); } } // Verify the module is listed for the containerId assertTrue(!fooStreamModules.isEmpty()); }
@Test public void testListContainers() { logger.info("List runtime containers"); CommandResult cmdResult = executeCommand("runtime containers"); Table table = (Table) cmdResult.getResult(); for (TableRow row : table.getRows()) { // Verify host name & ip address are not empty assertTrue(!StringUtils.isEmpty(row.getValue(2)) && !StringUtils.isEmpty(row.getValue(3))); } // Verify there should be at least one container in the list. assertTrue(table.getRows().size() > 0); }
@Test public void testListRuntimeModules() { logger.info("List runtime modules"); String streamName = "foo-runtimeModulesTest"; stream().create(streamName, "time | log"); CommandResult cmdResult = executeCommand("runtime modules"); Table table = (Table) cmdResult.getResult(); List<TableRow> fooStreamModules = new ArrayList<TableRow>(); for (TableRow row : table.getRows()) { // match by group name if (row.getValue(2).equals(streamName)) { fooStreamModules.add(row); } } assertEquals(2, fooStreamModules.size()); }