org.cloudfoundry.client.v2.organizations.OrganizationEntity Java Examples
The following examples show how to use
org.cloudfoundry.client.v2.organizations.OrganizationEntity.
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: CFAccessorSimulator.java From promregator with Apache License 2.0 | 6 votes |
@Override public Mono<ListOrganizationsResponse> retrieveOrgId(String orgName) { if ("simorg".equals(orgName)) { OrganizationResource or = OrganizationResource.builder().entity( OrganizationEntity.builder().name(orgName).build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(ORG_UUID).build() // Note that UpdatedAt is not set here, as this can also happen in real life! ).build(); List<OrganizationResource> list = new LinkedList<>(); list.add(or); ListOrganizationsResponse resp = ListOrganizationsResponse.builder().addAllResources(list).build(); return Mono.just(resp).delayElement(this.getSleepRandomDuration()); } log.error("Invalid OrgId request"); return null; }
Example #2
Source File: CFAccessorMassMock.java From promregator with Apache License 2.0 | 6 votes |
@Override public Mono<ListOrganizationsResponse> retrieveOrgId(String orgName) { if ("unittestorg".equals(orgName)) { OrganizationResource or = OrganizationResource.builder().entity( OrganizationEntity.builder().name(orgName).build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_ORG_UUID).build() // Note that UpdatedAt is not set here, as this can also happen in real life! ).build(); List<org.cloudfoundry.client.v2.organizations.OrganizationResource> list = new LinkedList<>(); list.add(or); ListOrganizationsResponse resp = org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse.builder().addAllResources(list).build(); return Mono.just(resp).delayElement(this.getSleepRandomDuration()); } Assert.fail("Invalid OrgId request"); return null; }
Example #3
Source File: CFAccessorMock.java From promregator with Apache License 2.0 | 5 votes |
@Override public Mono<ListOrganizationsResponse> retrieveOrgId(String orgName) { if ("unittestorg".equalsIgnoreCase(orgName)) { OrganizationResource or = OrganizationResource.builder().entity( OrganizationEntity.builder().name("unittestorg").build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_ORG_UUID).build() // Note that UpdatedAt is not set here, as this can also happen in real life! ).build(); List<org.cloudfoundry.client.v2.organizations.OrganizationResource> list = new LinkedList<>(); list.add(or); ListOrganizationsResponse resp = org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse.builder().addAllResources(list).build(); return Mono.just(resp); } else if ("doesnotexist".equals(orgName)) { return Mono.just(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse.builder().resources(new ArrayList<>()).build()); } else if ("exception".equals(orgName)) { return Mono.just(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse.builder().build()) .map(x -> {throw new Error("exception org name provided");}); } Assert.fail("Invalid OrgId request"); return null; }
Example #4
Source File: RawCloudOrganization.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
@Override public CloudOrganization derive() { Resource<OrganizationEntity> resource = getResource(); OrganizationEntity entity = resource.getEntity(); return ImmutableCloudOrganization.builder() .metadata(parseResourceMetadata(resource)) .name(entity.getName()) .build(); }
Example #5
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<? extends Resource<OrganizationEntity>> getOrganizationResource(UUID guid) { GetOrganizationRequest request = GetOrganizationRequest.builder() .organizationId(guid.toString()) .build(); return delegate.organizations() .get(request); }
Example #6
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<? extends Resource<OrganizationEntity>> getOrganizationResourceByName(String name) { IntFunction<ListOrganizationsRequest> pageRequestSupplier = page -> ListOrganizationsRequest.builder() .name(name) .page(page) .build(); return getOrganizationResources(pageRequestSupplier).singleOrEmpty(); }
Example #7
Source File: CloudFoundryAppDeployer.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
private Mono<OrganizationEntity> getOrganization(String organizationId) { return client.organizations() .get(GetOrganizationRequest.builder().organizationId(organizationId).build()) .map(GetOrganizationResponse::getEntity); }
Example #8
Source File: CloudFoundryAppDeployerTest.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
@Test void getServiceInstanceById() { given(operationsServices.getInstance(any(GetServiceInstanceRequest.class))) .willReturn(Mono.just(ServiceInstance.builder() .id("foo-service-instance-id") .name("my-foo-service") .service("foo-service") .plan("foo-plan") .type(ServiceInstanceType.MANAGED) .build())); given(clientServiceInstances .get(any(org.cloudfoundry.client.v2.serviceinstances.GetServiceInstanceRequest.class))) .willReturn(Mono.just(GetServiceInstanceResponse.builder() .entity(ServiceInstanceEntity.builder() .name("my-foo-service") .spaceId("foo-space-id") .build()) .build())); given(clientSpaces.get(GetSpaceRequest.builder() .spaceId("foo-space-id") .build())) .willReturn(Mono.just(GetSpaceResponse.builder() .entity(SpaceEntity.builder() .name("foo-space") .organizationId("foo-organization-id") .build()) .build())); given(clientOrganizations.get(GetOrganizationRequest.builder() .organizationId("foo-organization-id") .build())) .willReturn(Mono.just(GetOrganizationResponse.builder() .entity(OrganizationEntity.builder() .name("foo-organization") .build()) .build())); org.springframework.cloud.appbroker.deployer.GetServiceInstanceRequest request = org.springframework.cloud.appbroker.deployer.GetServiceInstanceRequest .builder() .serviceInstanceId("foo-service-instance-id") .properties(emptyMap()) .build(); StepVerifier.create(appDeployer.getServiceInstance(request)) .assertNext(response -> { assertThat(response.getName()).isEqualTo("my-foo-service"); assertThat(response.getService()).isEqualTo("foo-service"); assertThat(response.getPlan()).isEqualTo("foo-plan"); }) .verifyComplete(); then(operationsUtils).should() .getOperationsForOrgAndSpace(argThat("foo-organization"::equals), argThat("foo-space"::equals)); then(cloudFoundryClient).should().serviceInstances(); then(clientServiceInstances).should() .get(argThat(req -> "foo-service-instance-id".equals(req.getServiceInstanceId()))); then(cloudFoundryClient).should().spaces(); then(cloudFoundryClient).should().organizations(); then(clientSpaces).should().get(argThat(req -> "foo-space-id".equals(req.getSpaceId()))); then(clientOrganizations).should().get(argThat(req -> "foo-organization-id".equals(req.getOrganizationId()))); then(cloudFoundryOperations).should().services(); then(operationsServices).should().getInstance(argThat(req -> "my-foo-service".equals(req.getName()))); then(cloudFoundryClient).shouldHaveNoMoreInteractions(); then(cloudFoundryOperations).shouldHaveNoMoreInteractions(); then(operationsUtils).shouldHaveNoMoreInteractions(); }
Example #9
Source File: RawCloudOrganization.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
@Value.Parameter public abstract Resource<OrganizationEntity> getResource();
Example #10
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private Flux<? extends Resource<OrganizationEntity>> getOrganizationResources() { IntFunction<ListOrganizationsRequest> pageRequestSupplier = page -> ListOrganizationsRequest.builder() .page(page) .build(); return getOrganizationResources(pageRequestSupplier); }
Example #11
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private Flux<? extends Resource<OrganizationEntity>> getOrganizationResources(IntFunction<ListOrganizationsRequest> pageRequestSupplier) { return PaginationUtils.requestClientV2Resources(page -> delegate.organizations() .list(pageRequestSupplier.apply(page))); }
Example #12
Source File: RawCloudOrganizationTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static Resource<OrganizationEntity> buildTestResource() { return OrganizationResource.builder() .metadata(RawCloudEntityTest.METADATA) .entity(buildTestEntity()) .build(); }
Example #13
Source File: RawCloudOrganizationTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static OrganizationEntity buildTestEntity() { return OrganizationEntity.builder() .name(ORGANIZATION_NAME) .build(); }