@Test public void test_bind_applications_should_succeed() throws CloudFoundryException { ServiceBindingsV2 serviceBindings = mock(ServiceBindingsV2.class); when(cfClient.serviceBindingsV2()).thenReturn(serviceBindings); when(serviceBindings.create(any(CreateServiceBindingRequest.class))) .thenReturn(Mono.just(CreateServiceBindingResponse.builder() .metadata(Metadata.builder() .build()) .entity(ServiceBindingEntity.builder() .build()) .build())); cloudFoundryApi.bindApplications("service-instance-id", Collections.singletonList(ApplicationIdentity.builder() .guid("application-id") .name("application-name") .build())); verify(serviceBindings, times(1)).create(any(CreateServiceBindingRequest.class)); }
@Override public void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications) throws CloudFoundryException { bind(applications, application -> cfClient.serviceBindingsV2() .create( CreateServiceBindingRequest .builder() .applicationId(application.getGuid()) .serviceInstanceId(serviceInstanceId) .build())); }
CloudFoundryApi implements CloudFoundryApiService { @Override public void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications) throws CloudFoundryException { bind(applications, application -> cfClient.serviceBindingsV2() .create( CreateServiceBindingRequest .builder() .applicationId(application.getGuid()) .serviceInstanceId(serviceInstanceId) .build())); } }
CloudFoundryApi implements CloudFoundryApiService { @Override public void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications) throws CloudFoundryException { bind(applications, application -> cfClient.serviceBindingsV2() .create( CreateServiceBindingRequest .builder() .applicationId(application.getGuid()) .serviceInstanceId(serviceInstanceId) .build())); }  }
CloudFoundryApi implements CloudFoundryApiService { @Override public void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications) throws CloudFoundryException { bind(applications, application -> cfClient.serviceBindingsV2() .create( CreateServiceBindingRequest .builder() .applicationId(application.getGuid()) .serviceInstanceId(serviceInstanceId) .build())); }  @Override void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications); void bindRoutes(String serviceInstanceId, List<String> routeIds); @Override ApplicationActivity getApplicationActivity(String appUid); Instant getInstantFromLogMessageTimestamp(Long logMessageTimestamp); @Override String getApplicationState(String applicationUuid); @Override String getHost(String routeId); @Override boolean isAppRunning(String appUid); @Override List<ApplicationIdentity> listAliveApplications(String spaceUuid, Pattern excludeNames); @Override List<String> listApplicationRoutes(String applicationUuid); @Override List<String> listRouteApplications(String routeUuid); @Override boolean startApplication(String applicationUuid); @Override boolean stopApplication(String applicationUuid); @Override void unbind(String bindingId); boolean isValidOrganization(String organizationGuid); }
CloudFoundryApi implements CloudFoundryApiService { @Override public void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications) throws CloudFoundryException { bind(applications, application -> cfClient.serviceBindingsV2() .create( CreateServiceBindingRequest .builder() .applicationId(application.getGuid()) .serviceInstanceId(serviceInstanceId) .build())); }  @Override void bindApplications(String serviceInstanceId, List<ApplicationIdentity> applications); void bindRoutes(String serviceInstanceId, List<String> routeIds); @Override ApplicationActivity getApplicationActivity(String appUid); Instant getInstantFromLogMessageTimestamp(Long logMessageTimestamp); @Override String getApplicationState(String applicationUuid); @Override String getHost(String routeId); @Override boolean isAppRunning(String appUid); @Override List<ApplicationIdentity> listAliveApplications(String spaceUuid, Pattern excludeNames); @Override List<String> listApplicationRoutes(String applicationUuid); @Override List<String> listRouteApplications(String routeUuid); @Override boolean startApplication(String applicationUuid); @Override boolean stopApplication(String applicationUuid); @Override void unbind(String bindingId); boolean isValidOrganization(String organizationGuid);  }