org.cloudfoundry.operations.applications.Applications Java Examples
The following examples show how to use
org.cloudfoundry.operations.applications.Applications.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CfPushDelegateTest.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 6 votes |
@Test public void testCfPushWithoutEnvOrServices() throws Exception { CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class); Applications mockApplications = mock(Applications.class); when(cfOperations.applications()).thenReturn(mockApplications); when(mockApplications.push(any(PushApplicationRequest.class))).thenReturn(Mono.empty()); when(mockApplications.restart(any(RestartApplicationRequest.class))).thenReturn(Mono.empty()); Services mockServices = mock(Services.class); when(cfOperations.services()).thenReturn(mockServices); ServiceInstance mockInstance = ServiceInstance.builder().name("testservice").id("id").type(ServiceInstanceType.MANAGED).build(); when(mockServices.getInstance(any(GetServiceInstanceRequest.class))).thenReturn(Mono.just(mockInstance)); CfProperties cfAppProperties = sampleApp(); cfPushDelegate.push(cfOperations, cfAppProperties); }
Example #2
Source File: CfAppEnvDelegateTest.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 6 votes |
@Test public void testGetEnvironmentsNoException() { CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class); CfProperties cfAppProperties = sampleApp(); ApplicationEnvironments appEnvironment = sampleAppEnvironment(); Applications mockApplications = mock(Applications.class); when(cfOperations.applications()).thenReturn(mockApplications); when(mockApplications.getEnvironments(any(GetApplicationEnvironmentsRequest.class))).thenReturn(Mono.just(appEnvironment)); Mono<Optional<ApplicationEnvironments>> appEnvMono = appEnvDelegate.getAppEnv(cfOperations, cfAppProperties); StepVerifier .create(appEnvMono) .expectNextMatches(appEnv -> appEnv.isPresent()) .expectComplete() .verify(); }
Example #3
Source File: CfAppEnvDelegateTest.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 6 votes |
@Test public void testGetEnvironmentsNoApplication() { CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class); CfProperties cfAppProperties = sampleApp(); Applications mockApplications = mock(Applications.class); when(cfOperations.applications()).thenReturn(mockApplications); when(mockApplications.getEnvironments(any(GetApplicationEnvironmentsRequest.class))) .thenReturn(Mono.error(new RuntimeException("No such Environment"))); Mono<Optional<ApplicationEnvironments>> appDetailsMono = appEnvDelegate.getAppEnv(cfOperations, cfAppProperties); StepVerifier .create(appDetailsMono) .expectNextMatches(appEnv -> !appEnv.isPresent()) .expectComplete() .verify(); }
Example #4
Source File: CloudFoundryNativeReactiveDiscoveryClientTests.java From spring-cloud-cloudfoundry with Apache License 2.0 | 5 votes |
@Test public void shouldReturnFluxOfServices() { Applications apps = mock(Applications.class); when(operations.applications()).thenReturn(apps); ApplicationSummary summary = ApplicationSummary.builder() .id(UUID.randomUUID().toString()).instances(1).memoryLimit(1024) .requestedState("requestedState").diskQuota(1024).name("service") .runningInstances(1).build(); when(apps.list()).thenReturn(Flux.just(summary)); Flux<String> services = this.client.getServices(); StepVerifier.create(services).expectNext("service").expectComplete().verify(); }
Example #5
Source File: CloudFoundryDiscoveryClientTest.java From spring-cloud-cloudfoundry with Apache License 2.0 | 5 votes |
@Test public void testServiceResolution() { Applications apps = mock(Applications.class); ApplicationSummary s = ApplicationSummary.builder() .id(UUID.randomUUID().toString()).instances(2).memoryLimit(1024) .requestedState("requestedState").diskQuota(1024) .name(this.hiServiceServiceId).runningInstances(2).build(); Mockito.when(apps.list()).thenReturn(Flux.just(s)); Mockito.when(this.ops.applications()).thenReturn(apps); List<String> serviceNames = this.cloudFoundryDiscoveryClient.getServices(); assertThat(serviceNames.contains(this.hiServiceServiceId)) .as("there should be one registered service.").isTrue(); serviceNames.forEach(serviceName -> this.log .debug("\t discovered serviceName: " + serviceName)); }
Example #6
Source File: CfGetDetailsTaskDelegateTest.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 4 votes |
@Test public void testGetDetailsNoException() { CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class); CfProperties cfAppProperties = sampleApp(); ApplicationDetail appDetail = sampleApplicationDetail(); Applications mockApplications = mock(Applications.class); when(cfOperations.applications()).thenReturn(mockApplications); when(mockApplications.get(any(GetApplicationRequest.class))).thenReturn(Mono.just(appDetail)); Mono<Optional<ApplicationDetail>> appDetailsMono = detailsTaskDelegate.getAppDetails(cfOperations, cfAppProperties); assertThat(appDetailsMono.block().isPresent()).isTrue(); }
Example #7
Source File: CfGetDetailsTaskDelegateTest.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 4 votes |
@Test public void testGetDetailsNoApplication() { CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class); CfProperties cfAppProperties = sampleApp(); Applications mockApplications = mock(Applications.class); when(cfOperations.applications()).thenReturn(mockApplications); when(mockApplications.get(any(GetApplicationRequest.class))).thenReturn(Mono.error(new RuntimeException("No such app"))); Mono<Optional<ApplicationDetail>> appDetailsMono = detailsTaskDelegate.getAppDetails(cfOperations, cfAppProperties); Optional<ApplicationDetail> appDetailOptional = appDetailsMono.block(); assertThat(appDetailOptional.isPresent()).isFalse(); }