use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class ApplicationsTest method uploadDirectory.
@Test
public void uploadDirectory() {
String applicationName = this.nameFactory.getApplicationName();
this.spaceId.flatMap(spaceId -> createApplicationId(this.cloudFoundryClient, spaceId, applicationName)).flatMap(applicationId -> {
try {
return this.cloudFoundryClient.applicationsV2().upload(UploadApplicationRequest.builder().application(new ClassPathResource("test-application").getFile().toPath()).async(true).applicationId(applicationId).build()).flatMap(job -> JobUtils.waitForCompletion(this.cloudFoundryClient, Duration.ofMinutes(5), job));
} catch (IOException e) {
throw new RuntimeException(e);
}
}).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class BuildpacksTest method upload.
@Test
public void upload() throws IOException {
Path buildpack = new ClassPathResource("test-buildpack.zip").getFile().toPath();
String buildpackName = this.nameFactory.getBuildpackName();
createBuildpackId(this.cloudFoundryClient, buildpackName).flatMap(buildpackId -> this.cloudFoundryClient.buildpacks().upload(UploadBuildpackRequest.builder().buildpack(buildpack).buildpackId(buildpackId).filename(buildpack.getFileName().toString()).build())).map(ResourceUtils::getEntity).as(StepVerifier::create).expectNext(BuildpackEntity.builder().enabled(false).filename(buildpack.getFileName().toString()).locked(false).name(buildpackName).position(3).build()).expectComplete().verify(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class ApplicationsTest method startNotStarted.
@Test
public void startNotStarted() throws IOException {
String applicationName = this.nameFactory.getApplicationName();
createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, true).then(this.cloudFoundryOperations.applications().start(StartApplicationRequest.builder().name(applicationName).build())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier in project cf-java-client by cloudfoundry.
the class ApplicationsTest method restartNotStarted.
@Test
public void restartNotStarted() throws IOException {
String applicationName = this.nameFactory.getApplicationName();
createApplication(this.cloudFoundryOperations, new ClassPathResource("test-application.zip").getFile().toPath(), applicationName, true).then(this.cloudFoundryOperations.applications().restart(RestartApplicationRequest.builder().name(applicationName).build())).as(StepVerifier::create).expectComplete().verify(Duration.ofMinutes(5));
}
use of reactor.test.StepVerifier 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