Package org.springframework.shell.core

Examples of org.springframework.shell.core.CommandResult


    String jobName = generateJobName();
    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);

    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);

    CommandResult cr = createJob(jobName, "job", "false");
    checkForFail(cr);
    checkDuplicateJobErrorMessage(cr, jobName);

    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);
  }
View Full Code Here


    final JobParametersHolder jobParametersHolder = new JobParametersHolder();
    String jobName = generateJobName();
    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);

    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);
    CommandResult cr = deployJob(jobName);
    checkForSuccess(cr);
    checkDeployedJobMessage(cr, jobName);
    triggerJob(jobName);
    assertTrue("Job did not complete within time alotted", jobParametersHolder.isDone());

    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, true);

    cr = undeployJob(jobName);
    checkForSuccess(cr);
    checkUndeployedJobMessage(cr, jobName);

    cr = deployJob(jobName);
    checkForSuccess(cr);
    assertEquals("Deployed job '" + jobName + "'", cr.getResult());

    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, true);
  }
View Full Code Here

  @Test
  public void testInvalidJobDescriptor() throws InterruptedException {
    JobParametersHolder.reset();
    final JobParametersHolder jobParametersHolder = new JobParametersHolder();
    CommandResult cr = getShell().executeCommand("job create --definition \"barsdaf\" --name " + generateJobName());
    checkForFail(cr);
    checkErrorMessages(cr, "Could not find module with name 'barsdaf'");
    assertFalse("Job did not complete within time alotted", jobParametersHolder.isDone());
  }
View Full Code Here

    assertFalse("Job did not complete within time alotted", jobParametersHolder.isDone());
  }

  @Test
  public void testMissingJobDescriptor() {
    CommandResult cr = getShell().executeCommand("job create --name " + generateJobName());
    checkForFail(cr);
  }
View Full Code Here

    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);
    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);

    final JobParametersHolder jobParametersHolder = new JobParametersHolder();

    CommandResult cr = deployJob(jobName);
    checkForSuccess(cr);
    checkDeployedJobMessage(cr, jobName);
    triggerJobWithParams(jobName, "{\"param1\":\"spring rocks!\"}");
    boolean done = jobParametersHolder.isDone();
View Full Code Here

    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);
    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);

    final JobParametersHolder jobParametersHolder = new JobParametersHolder();

    final CommandResult cr = deployJob(jobName);
    checkForSuccess(cr);
    checkDeployedJobMessage(cr, jobName);
    triggerJobWithParams(jobName, "{\"-param1(long)\":\"12345\",\"param2(date)\":\"1990-10-03\"}");

    boolean done = jobParametersHolder.isDone();
View Full Code Here

  @Test
  public void testInvalidNestedJobLaunch() {
    logger.info("Launch nested job");
    String jobName = generateJobName();
    CommandResult result = executeCommandExpectingFailure("job create --definition \"" +
                                INVALID_NESTED_JOB_DESCRIPTOR + "\" --name " + jobName);
    assertTrue(result.getException().getMessage().contains("Could not find module with name 'invalidJob' and type 'job'"));
  }
View Full Code Here

  @Test
  public void testLaunchNotDeployedJob() {
    logger.info("Launch batch job that is not deployed");
    String jobName = generateJobName();
    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR, false);
    CommandResult result = executeCommandExpectingFailure("job launch --name " + jobName);
    assertThat(result.getException().getMessage(),
        containsString(String.format("The job named '%s' is not currently deployed", jobName)));
  }
View Full Code Here

  /**
   * Execute a command and verify the command result.
   */
  protected CommandResult executeCommand(String command) {
    CommandResult cr = getShell().executeCommand(command);
    if (cr.getException() != null) {
      cr.getException().printStackTrace();
    }
    Assert.isTrue(cr.isSuccess(), "Failure.  CommandResult = " + cr.toString());
    return cr;
  }
View Full Code Here

  /**
   * Execute 'job destroy' for the supplied job names
   */
  protected void executeJobDestroy(String... jobNames) {
    for (String jobName : jobNames) {
      CommandResult cr = executeCommand("job destroy --name " + jobName);
      assertTrue("Failure to destroy job " + jobName + ".  CommandResult = " + cr.toString(), cr.isSuccess());
      jobStateVerifier.waitForDestroy(jobName);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.shell.core.CommandResult

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.