Search in sources :

Example 1 with Metadata

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()));
}
Also used : ListEventsResponse(org.cloudfoundry.client.v2.events.ListEventsResponse) EventEntity(org.cloudfoundry.client.v2.events.EventEntity)

Example 2 with Metadata

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));
}
Also used : HashMap(java.util.HashMap) ServiceBindingSchema(org.cloudfoundry.client.v2.serviceplans.ServiceBindingSchema) Schema(org.cloudfoundry.client.v2.serviceplans.Schema) ServiceInstanceSchema(org.cloudfoundry.client.v2.serviceplans.ServiceInstanceSchema) AbstractClientApiTest(org.cloudfoundry.reactor.client.AbstractClientApiTest) Test(org.junit.Test)

Example 3 with Metadata

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;
}
Also used : ApplicationResource(org.cloudfoundry.client.v2.applications.ApplicationResource) ListApplicationsResponse(org.cloudfoundry.client.v2.applications.ListApplicationsResponse) LinkedList(java.util.LinkedList)

Example 4 with Metadata

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;
}
Also used : SpaceResource(org.cloudfoundry.client.v2.spaces.SpaceResource) LinkedList(java.util.LinkedList) ListSpacesResponse(org.cloudfoundry.client.v2.spaces.ListSpacesResponse)

Example 5 with Metadata

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;
}
Also used : ListOrganizationsResponse(org.cloudfoundry.client.v2.organizations.ListOrganizationsResponse) OrganizationResource(org.cloudfoundry.client.v2.organizations.OrganizationResource) LinkedList(java.util.LinkedList)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)5 Metadata (org.apache.cxf.ws.mex.model._2004_09.Metadata)5 MetadataExchange (org.apache.cxf.ws.mex.MetadataExchange)4 Test (org.junit.Test)4 LinkedList (java.util.LinkedList)3 MetadataSection (org.apache.cxf.ws.mex.model._2004_09.MetadataSection)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Definition (javax.wsdl.Definition)2 Element (org.w3c.dom.Element)2 JmxAttributeGauge (com.codahale.metrics.JmxAttributeGauge)1 MetricRegistry.name (com.codahale.metrics.MetricRegistry.name)1 HealthCheck (com.codahale.metrics.health.HealthCheck)1 Saml2ProviderAuthenticationModuleType (com.evolveum.midpoint.xml.ns._public.common.common_3.Saml2ProviderAuthenticationModuleType)1 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)1 ActiveMQBundle (com.kjetland.dropwizard.activemq.ActiveMQBundle)1 Application (io.dropwizard.Application)1 AssetsBundle (io.dropwizard.assets.AssetsBundle)1 HttpClientBuilder (io.dropwizard.client.HttpClientBuilder)1