use of org.cloudfoundry.client.v2.Metadata in project cf-java-client by cloudfoundry.
the class DefaultApplicationsTest method requestEvents.
private static void requestEvents(CloudFoundryClient cloudFoundryClient, String applicationId, EventEntity... entities) {
ListEventsResponse.Builder responseBuilder = fill(ListEventsResponse.builder());
for (EventEntity entity : entities) {
responseBuilder.resource(EventResource.builder().metadata(fill(Metadata.builder()).id("test-event-id").build()).entity(entity).build());
}
when(cloudFoundryClient.events().list(ListEventsRequest.builder().actee(applicationId).orderDirection(OrderDirection.DESCENDING).resultsPerPage(50).page(1).build())).thenReturn(Mono.just(responseBuilder.totalPages(1).build()));
}
use of org.cloudfoundry.client.v2.Metadata in project cf-java-client by cloudfoundry.
the class ReactorServicePlansTest method get.
@Test
public void get() {
Map<String, String> details = new HashMap<>();
details.put("description", "Billing account number used to charge use of shared fake server.");
details.put("type", "string");
Schema testSchema = Schema.builder().parameters(Parameters.builder().jsonSchema("http://json-schema.org/draft-04/schema#").properties(Collections.singletonMap("billing-account", details)).type("object").build()).build();
mockRequest(InteractionContext.builder().request(TestRequest.builder().method(GET).path("/service_plans/test-service-plan-id").build()).response(TestResponse.builder().status(OK).payload("fixtures/client/v2/service_plans/GET_{id}_response.json").build()).build());
this.servicePlans.get(GetServicePlanRequest.builder().servicePlanId("test-service-plan-id").build()).as(StepVerifier::create).expectNext(GetServicePlanResponse.builder().metadata(Metadata.builder().createdAt("2015-07-27T22:43:16Z").id("f6ceb8a2-e6fc-43d5-a11b-7ced9e1b47c7").url("/v2/service_plans/f6ceb8a2-e6fc-43d5-a11b-7ced9e1b47c7").build()).entity(ServicePlanEntity.builder().name("name-462").free(false).description("desc-52").serviceId("8ac39757-0f9d-4295-9b6f-e626f7ee3cd4").uniqueId("2aa0162c-9c88-4084-ad1d-566a09e8d316").publiclyVisible(true).active(true).schemas(Schemas.builder().serviceBinding(ServiceBindingSchema.builder().create(testSchema).build()).serviceInstance(ServiceInstanceSchema.builder().create(testSchema).update(testSchema).build()).build()).serviceUrl("/v2/services/8ac39757-0f9d-4295-9b6f-e626f7ee3cd4").serviceInstancesUrl("/v2/service_plans/f6ceb8a2-e6fc-43d5-a11b-7ced9e1b47c7/service_instances").build()).build()).expectComplete().verify(Duration.ofSeconds(5));
}
use of org.cloudfoundry.client.v2.Metadata in project promregator by promregator.
the class CFAccessorMock method retrieveApplicationId.
@Override
public Mono<ListApplicationsResponse> retrieveApplicationId(String orgId, String spaceId, String applicationName) {
if (orgId.equals(UNITTEST_ORG_UUID) && spaceId.equals(UNITTEST_SPACE_UUID)) {
ApplicationResource ar = null;
if (applicationName.equals("testapp")) {
ar = ApplicationResource.builder().entity(ApplicationEntity.builder().name(applicationName).build()).metadata(Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP1_UUID).build()).build();
} else if (applicationName.equals("testapp2")) {
ar = ApplicationResource.builder().entity(ApplicationEntity.builder().name(applicationName).build()).metadata(Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP2_UUID).build()).build();
} else {
Assert.fail("Invalid ApplicationId request, application name is invalid");
}
List<ApplicationResource> list = new LinkedList<>();
list.add(ar);
ListApplicationsResponse resp = ListApplicationsResponse.builder().addAllResources(list).build();
return Mono.just(resp);
}
Assert.fail("Invalid ApplicationId request");
return null;
}
use of org.cloudfoundry.client.v2.Metadata in project promregator by promregator.
the class CFAccessorMock method retrieveSpaceId.
@Override
public Mono<ListSpacesResponse> retrieveSpaceId(String orgId, String spaceName) {
if ("unittestspace".equals(spaceName) && orgId.equals(UNITTEST_ORG_UUID)) {
SpaceResource sr = SpaceResource.builder().entity(SpaceEntity.builder().name(spaceName).build()).metadata(Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_SPACE_UUID).build()).build();
List<SpaceResource> list = new LinkedList<>();
list.add(sr);
ListSpacesResponse resp = ListSpacesResponse.builder().addAllResources(list).build();
return Mono.just(resp);
}
Assert.fail("Invalid SpaceId request");
return null;
}
use of org.cloudfoundry.client.v2.Metadata in project promregator by promregator.
the class CFAccessorMock method retrieveOrgId.
@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()).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);
}
Assert.fail("Invalid OrgId request");
return null;
}
Aggregations