public CommandResult executeCommand(String command) {
   CommandResult cr = this.shell.executeCommand(command);
   if (cr.getException() != null) {
     cr.getException().printStackTrace();
   }
   Assert.isTrue(cr.isSuccess(), "Failure.  CommandResult = " + cr.toString());
   return cr;
 }
예제 #2
0
 @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)));
 }
예제 #3
0
  @Test
  public void testLaunchJobTwiceWhereMakeUniqueIsFalse() throws Exception {
    logger.info("Launch batch job (makeUnique=false) twice");
    String jobName = generateJobName();
    // Batch 3.0 requires at least one parameter to reject duplicate executions of an instance
    String myJobParams = "{\"-param(long)\":\"12345\"}";
    JobParametersHolder.reset();
    final JobParametersHolder jobParametersHolder = new JobParametersHolder();

    executeJobCreate(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR + " --makeUnique=false");
    checkForJobInList(jobName, JOB_WITH_PARAMETERS_DESCRIPTOR + " --makeUnique=false", true);
    executeJobLaunch(jobName, myJobParams);
    assertTrue("The countdown latch expired and did not count down.", jobParametersHolder.isDone());

    CommandResult result =
        executeCommandExpectingFailure("job launch --name " + jobName + " --params " + myJobParams);
    assertThat(
        result.getException().getMessage(),
        containsString(
            "A job instance already exists and is complete for parameters={param=12345}."
                + "  If you want to run this job again, change the parameters."));
  }