use of org.cloudfoundry.operations.applications.Task in project cf-java-client by cloudfoundry.
the class ApplicationsTest method runTask.
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_11)
@Test
public void runTask() throws IOException {
String applicationName = this.nameFactory.getApplicationName();
String taskName = this.nameFactory.getTaskName();
createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, false).then(this.cloudFoundryOperations.applications().runTask(RunApplicationTaskRequest.builder().applicationName(applicationName).command("ls").disk(64).memory(64).taskName(taskName).build())).map(Task::getName).as(StepVerifier::create).expectNext(taskName).expectComplete().verify(Duration.ofMinutes(5));
}
use of org.cloudfoundry.operations.applications.Task in project cf-java-client by cloudfoundry.
the class ApplicationsTest method terminateTask.
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_1_11)
@Test
public void terminateTask() throws IOException {
String applicationName = this.nameFactory.getApplicationName();
String taskName = this.nameFactory.getTaskName();
createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, false).then(getLongLivedTaskId(this.cloudFoundryOperations, applicationName, taskName)).flatMap(sequenceId -> this.cloudFoundryOperations.applications().terminateTask(TerminateApplicationTaskRequest.builder().applicationName(applicationName).sequenceId(sequenceId).build()).thenReturn(sequenceId)).flatMapMany(sequenceId -> requestListTasks(this.cloudFoundryOperations, applicationName).filter(task -> sequenceId.equals(task.getSequenceId()))).map(Task::getState).as(StepVerifier::create).expectNext(TaskState.FAILED).expectComplete().verify(Duration.ofMinutes(5));
}
Aggregations