Package org.springframework.xd.shell.util

Examples of org.springframework.xd.shell.util.Table


  @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.hasText(row.getValue(2)) && StringUtils.hasText(row.getValue(3)));
    }
    // Verify there should be at least one container in the list.
    assertTrue(table.getRows().size() > 0);
  }
View Full Code Here


  public void testListRuntimeModulesByModuleId() {
    logger.info("List runtime modules");
    String streamName = generateStreamName();
    stream().create(streamName, "time | log");
    CommandResult cmdResult = executeCommand("runtime modules --moduleId " + streamName + ".sink.log.1");
    Table table = (Table) cmdResult.getResult();
    assertEquals(1, table.getRows().size());
  }
View Full Code Here

    List<TableRow> runtimeModules = getRuntimeModulesForStream(streamName);

    // Get containerId for a runtime module
    String containerId = runtimeModules.get(0).getValue(2);
    CommandResult cmdResult = executeCommand("runtime modules --containerId " + containerId);
    Table table = (Table) cmdResult.getResult();
    List<TableRow> fooStreamModules = new ArrayList<TableRow>();
    for (TableRow row : table.getRows()) {
      // Verify all the rows have the same containerId
      assertTrue(row.getValue(2).equals(containerId));
      // match by group name
      if (row.getValue(1).equals(runtimeModules.get(0).getValue(1))) {
        fooStreamModules.add(row);
View Full Code Here

  public void testListRuntimeModulesByInvalidContainerId() {
    logger.info("Test listing of runtime modules by invalid containerId");
    String streamName = generateStreamName();
    stream().create(streamName, "time | log");
    CommandResult cmdResult = executeCommand("runtime modules --containerId 10000");
    Table table = (Table) cmdResult.getResult();
    assertEquals(0, table.getRows().size());
  }
View Full Code Here

   * @return list of table rows containing runtime module information
   *         for the requested stream
   */
  private List<TableRow> getRuntimeModulesForStream(String streamName) {
    CommandResult cmdResult = executeCommand("runtime modules");
    Table table = (Table) cmdResult.getResult();
    List<TableRow> modules = new ArrayList<TableRow>();
    for (TableRow row : table.getRows()) {
      if (row.getValue(1).contains(streamName)) {
        modules.add(row);
      }
    }
    return modules;
View Full Code Here

  @Test
  public void testModuleCompose() {
    compose().newModule("compositesource", "time | splitter");

    Table t = listAll();

    assertThat(t.getRows(), hasItem(rowWithValue(1, "(c) compositesource")));
  }
View Full Code Here

    stepExecution.setStatus(BatchStatus.COMPLETED);
    stepExecution.setExitStatus(ExitStatus.COMPLETED.addExitDescription("We are done."));
    final StepExecutionInfoResource stepExecutionInfoResource = new StepExecutionInfoResource(444L, stepExecution,
        StepType.TASKLET_STEP.getDisplayName());

    final Table table = JobCommandsUtils.prepareStepExecutionTable(stepExecutionInfoResource, TimeZone.getDefault());

    assertEquals("Step Execution Id", table.getRows().get(0).getValue(1));
    assertEquals("333", table.getRows().get(0).getValue(2));

    assertEquals("Job Execution Id", table.getRows().get(1).getValue(1));
    assertEquals("444", table.getRows().get(1).getValue(2));

    assertEquals("Step Name", table.getRows().get(2).getValue(1));
    assertEquals("coolStep", table.getRows().get(2).getValue(2));

    assertEquals("Start Time", table.getRows().get(3).getValue(1));
    assertEquals("2014-05-01 15:00:00,000", table.getRows().get(3).getValue(2));

    assertEquals("End Time", table.getRows().get(4).getValue(1));
    assertEquals("2014-05-01 15:01:00,000", table.getRows().get(4).getValue(2));

    assertEquals("Duration", table.getRows().get(5).getValue(1));
    assertEquals("60000 ms", table.getRows().get(5).getValue(2));

    assertEquals("Status", table.getRows().get(6).getValue(1));
    assertEquals("COMPLETED", table.getRows().get(6).getValue(2));

    assertEquals("Last Updated", table.getRows().get(7).getValue(1));
    assertEquals("2014-05-05 01:00:00,000", table.getRows().get(7).getValue(2));

    assertEquals("Read Count", table.getRows().get(8).getValue(1));
    assertEquals("0", table.getRows().get(8).getValue(2));
    assertEquals("Write Count", table.getRows().get(9).getValue(1));
    assertEquals("0", table.getRows().get(9).getValue(2));
    assertEquals("Filter Count", table.getRows().get(10).getValue(1));
    assertEquals("0", table.getRows().get(10).getValue(2));
    assertEquals("Read Skip Count", table.getRows().get(11).getValue(1));
    assertEquals("0", table.getRows().get(11).getValue(2));
    assertEquals("Write Skip Count", table.getRows().get(12).getValue(1));
    assertEquals("0", table.getRows().get(12).getValue(2));
    assertEquals("Process Skip Count", table.getRows().get(13).getValue(1));
    assertEquals("0", table.getRows().get(13).getValue(2));
    assertEquals("Commit Count", table.getRows().get(14).getValue(1));
    assertEquals("0", table.getRows().get(14).getValue(2));

    assertEquals("Rollback Count", table.getRows().get(15).getValue(1));
    assertEquals("0", table.getRows().get(15).getValue(2));

    assertEquals("Exit Status", table.getRows().get(16).getValue(1));
    assertEquals("COMPLETED", table.getRows().get(16).getValue(2));

    assertEquals("Exit Description", table.getRows().get(17).getValue(1));
    assertEquals("We are done.", table.getRows().get(17).getValue(2));
  }
View Full Code Here

  @Test
  public void testPrepareStepExecutionTableWithNullStepExecution() {

    final StepExecutionInfoResource stepExecutionInfoResource = new StepExecutionInfoResource();

    final Table table = JobCommandsUtils.prepareStepExecutionTable(stepExecutionInfoResource, TimeZone.getDefault());

    assertEquals("Step Execution Id", table.getRows().get(0).getValue(1));
    assertEquals("N/A", table.getRows().get(0).getValue(2));

    assertEquals("Job Execution Id", table.getRows().get(1).getValue(1));
    assertEquals("N/A", table.getRows().get(1).getValue(2));

    assertEquals("Step Name", table.getRows().get(2).getValue(1));
    assertEquals("N/A", table.getRows().get(2).getValue(2));

    assertEquals("Start Time", table.getRows().get(3).getValue(1));
    assertEquals("N/A", table.getRows().get(3).getValue(2));

    assertEquals("End Time", table.getRows().get(4).getValue(1));
    assertEquals("N/A", table.getRows().get(4).getValue(2));

    assertEquals("Duration", table.getRows().get(5).getValue(1));
    assertEquals("N/A", table.getRows().get(5).getValue(2));

    assertEquals("Status", table.getRows().get(6).getValue(1));
    assertEquals("N/A", table.getRows().get(6).getValue(2));

    assertEquals("Last Updated", table.getRows().get(7).getValue(1));
    assertEquals("N/A", table.getRows().get(7).getValue(2));

    assertEquals("Read Count", table.getRows().get(8).getValue(1));
    assertEquals("N/A", table.getRows().get(8).getValue(2));
    assertEquals("Write Count", table.getRows().get(9).getValue(1));
    assertEquals("N/A", table.getRows().get(9).getValue(2));
    assertEquals("Filter Count", table.getRows().get(10).getValue(1));
    assertEquals("N/A", table.getRows().get(10).getValue(2));
    assertEquals("Read Skip Count", table.getRows().get(11).getValue(1));
    assertEquals("N/A", table.getRows().get(11).getValue(2));
    assertEquals("Write Skip Count", table.getRows().get(12).getValue(1));
    assertEquals("N/A", table.getRows().get(12).getValue(2));
    assertEquals("Process Skip Count", table.getRows().get(13).getValue(1));
    assertEquals("N/A", table.getRows().get(13).getValue(2));
    assertEquals("Commit Count", table.getRows().get(14).getValue(1));
    assertEquals("N/A", table.getRows().get(14).getValue(2));

    assertEquals("Rollback Count", table.getRows().get(15).getValue(1));
    assertEquals("N/A", table.getRows().get(15).getValue(2));

    assertEquals("Exit Status", table.getRows().get(16).getValue(1));
    assertEquals("N/A", table.getRows().get(16).getValue(2));

    assertEquals("Exit Description", table.getRows().get(17).getValue(1));
    assertEquals("N/A", table.getRows().get(17).getValue(2));
  }
View Full Code Here

    stepExecution.setStatus(BatchStatus.COMPLETED);
    stepExecution.setExitStatus(ExitStatus.COMPLETED);
    final StepExecutionInfoResource stepExecutionInfoResource = new StepExecutionInfoResource(444L, stepExecution,
        StepType.TASKLET_STEP.getDisplayName());

    final Table table = JobCommandsUtils.prepareStepExecutionTable(stepExecutionInfoResource, TimeZone.getDefault());

    assertEquals("Exit Description", table.getRows().get(17).getValue(1));
    assertEquals("N/A", table.getRows().get(17).getValue(2));
  }
View Full Code Here

    new ModuleList(null);
  }

  @Test
  public void rendersTableByType() {
    Table modules = new ModuleList(newArrayList(
        resource("jms", "source", false),
        resource("aggregator", "processor", false),
        resource("avro", "sink", false),
        resource("myfile", "source", true)
        )).renderByType();

    Map<Integer, String> header = headerNames(modules.getHeaders());
    assertThat(header.size(), equalTo(4));
    assertThat(header, allOf(
        hasEntry(1, "    Source"),
        hasEntry(2, "    Processor"),
        hasEntry(3, "    Sink"),
        hasEntry(4, "    Job")
        ));

    List<TableRow> rows = modules.getRows();
    assertThat(rows, hasSize(2));

    Iterator<TableRow> iterator = rows.iterator();
    TableRow firstRow = iterator.next();
    assertThat(firstRow.getValue(1), equalTo("    jms"));
View Full Code Here

TOP

Related Classes of org.springframework.xd.shell.util.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.