org.cloudfoundry.client.v2.applications.ApplicationEntity Java Examples
The following examples show how to use
org.cloudfoundry.client.v2.applications.ApplicationEntity.
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: ServiceInstanceRecentLogsTest.java From spring-cloud-app-broker with Apache License 2.0 | 6 votes |
@BeforeEach void setUp() { expectedTestMessage = "test message " + UUID.randomUUID(); RecentLogsRequest request = RecentLogsRequest.builder().applicationId(RecentLogsTestApp.getAppId()).build(); LogMessage testMessage = LogMessage .builder() .message(expectedTestMessage) .timestamp(Instant.now().toEpochMilli()) .messageType(MessageType.OUT).build(); Envelope testEnvelope = Envelope .builder() .eventType(EventType.LOG_MESSAGE).origin("test") .logMessage(testMessage).build(); given(dopplerClient.recentLogs(request)) .willReturn(Flux.just(testEnvelope)); given(cloudFoundryClient.applicationsV2() .get(GetApplicationRequest.builder().applicationId(RecentLogsTestApp.getAppId()).build())) .willReturn(Mono.just( GetApplicationResponse.builder().entity(ApplicationEntity.builder().name("test-app").build()).build())); }
Example #2
Source File: CFAccessorSimulator.java From promregator with Apache License 2.0 | 6 votes |
@Override public Mono<ListApplicationsResponse> retrieveAllApplicationIdsInSpace(String orgId, String spaceId) { if (orgId.equals(ORG_UUID) && spaceId.equals(SPACE_UUID)) { List<ApplicationResource> list = new LinkedList<>(); for (int i = 1;i<=100;i++) { ApplicationResource ar = null; ar = ApplicationResource.builder().entity( ApplicationEntity.builder().name("testapp"+i).state("STARTED").build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(APP_UUID_PREFIX+i).build() ).build(); list.add(ar); } ListApplicationsResponse resp = ListApplicationsResponse.builder().addAllResources(list).build(); return Mono.just(resp).delayElement(this.getSleepRandomDuration()); } log.error("Invalid retrieveAllApplicationIdsInSpace request"); return null; }
Example #3
Source File: CFAccessorMassMock.java From promregator with Apache License 2.0 | 6 votes |
@Override public Mono<ListApplicationsResponse> retrieveAllApplicationIdsInSpace(String orgId, String spaceId) { if (orgId.equals(UNITTEST_ORG_UUID) && spaceId.equals(UNITTEST_SPACE_UUID)) { List<ApplicationResource> list = new LinkedList<>(); for (int i = 0;i<100;i++) { ApplicationResource ar = null; ar = ApplicationResource.builder().entity( ApplicationEntity.builder().name("testapp"+i).build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP_UUID_PREFIX+i).build() ).build(); list.add(ar); } ListApplicationsResponse resp = ListApplicationsResponse.builder().addAllResources(list).build(); return Mono.just(resp).delayElement(this.getSleepRandomDuration()); } Assert.fail("Invalid retrieveAllApplicationIdsInSpace request"); return null; }
Example #4
Source File: RawCloudApplication.java From cf-java-client-sap with Apache License 2.0 | 6 votes |
@Override public CloudApplication derive() { Resource<ApplicationEntity> resource = getResource(); ApplicationEntity entity = resource.getEntity(); SummaryApplicationResponse summary = getSummary(); return ImmutableCloudApplication.builder() .metadata(parseResourceMetadata(resource)) .name(summary.getName()) .memory(summary.getMemory()) .uris(toUrlStrings(summary.getRoutes())) .diskQuota(summary.getDiskQuota()) .instances(summary.getInstances()) .runningInstances(summary.getRunningInstances()) .state(parseState(summary.getState())) .staging(parseStaging(summary, getStack())) .packageState(parsePackageState(summary.getPackageState())) .stagingError(summary.getStagingFailedDescription()) .services(getNames(summary.getServices())) .env(parseEnv(entity.getEnvironmentJsons())) .space(getSpace().derive()) .build(); }
Example #5
Source File: RawCloudApplicationTest.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private static Resource<ApplicationEntity> buildApplicationResource(Map<String, Object> environmentJsons) { return ApplicationResource.builder() .metadata(RawCloudEntityTest.METADATA) .entity(ApplicationEntity.builder() .environmentJsons(environmentJsons) .build()) .build(); }
Example #6
Source File: ServiceInstanceLogStreamingTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@BeforeEach void setUp() { serviceInstanceId = UUID.randomUUID().toString(); String expectedTestMessage = "test message " + serviceInstanceId; org.cloudfoundry.doppler.LogMessage testMessage = org.cloudfoundry.doppler.LogMessage .builder() .message(expectedTestMessage) .timestamp(Instant.now().toEpochMilli()) .messageType(MessageType.OUT).build(); org.cloudfoundry.doppler.Envelope testEnvelope = org.cloudfoundry.doppler.Envelope .builder() .eventType(EventType.LOG_MESSAGE).origin("test") .logMessage(testMessage).build(); // expectations are instances of Dropsnode Envelope + LogMessage Envelope envelope = LoggingUtils.convertDopplerEnvelopeToDropsonde(testEnvelope); org.cloudfoundry.dropsonde.events.LogMessage expectedMessage = new org.cloudfoundry.dropsonde.events.LogMessage.Builder() .message_type(envelope.logMessage.message_type) .source_instance("test-app null") .timestamp(envelope.logMessage.timestamp) .message(envelope.logMessage.message) .build(); expectedEnvelope = new Envelope.Builder() .eventType(envelope.eventType) .logMessage(expectedMessage) .origin("test") .build(); StreamRequest request = StreamRequest.builder().applicationId(LogStreamingTestApp.getAppId()).build(); given(dopplerClient.stream(request)).willReturn(Flux.just(testEnvelope)); given(cloudFoundryClient.applicationsV2().get( GetApplicationRequest.builder().applicationId(LogStreamingTestApp.getAppId()).build())) .willReturn(Mono.just( GetApplicationResponse.builder().entity(ApplicationEntity.builder().name("test-app").build()).build())); }
Example #7
Source File: RawCloudApplicationTest.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private static RawCloudApplication buildRawApplication(Resource<ApplicationEntity> applicationResource, SummaryApplicationResponse summary) { return ImmutableRawCloudApplication.builder() .resource(applicationResource) .summary(summary) .stack(STACK) .space(SPACE) .build(); }
Example #8
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<Derivable<CloudApplication>> zipWithAuxiliaryApplicationContent(Resource<ApplicationEntity> applicationResource) { UUID applicationGuid = getGuid(applicationResource); return getApplicationSummary(applicationGuid).zipWhen(this::getApplicationStackResource) .map(tuple -> ImmutableRawCloudApplication.builder() .resource(applicationResource) .summary(tuple.getT1()) .stack(ImmutableRawCloudStack.of(tuple.getT2())) .space(target) .build()); }
Example #9
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Flux<? extends Resource<ApplicationEntity>> getApplicationResourcesByNames(Collection<String> names) { if (names.isEmpty()) { return Flux.empty(); } IntFunction<ListSpaceApplicationsRequest> pageRequestSupplier = page -> ListSpaceApplicationsRequest.builder() .spaceId(getTargetSpaceGuid().toString()) .addAllNames(names) .page(page) .build(); return PaginationUtils.requestClientV2Resources(page -> delegate.spaces() .listApplications(pageRequestSupplier.apply(page))); }
Example #10
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<? extends Resource<ApplicationEntity>> getApplicationResourceByName(String name) { IntFunction<ListApplicationsRequest> pageRequestSupplier = page -> ListApplicationsRequest.builder() .spaceId(getTargetSpaceGuid().toString()) .name(name) .page(page) .build(); return PaginationUtils.requestClientV2Resources(page -> delegate.applicationsV2() .list(pageRequestSupplier.apply(page))) .singleOrEmpty(); }
Example #11
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Mono<? extends Resource<ApplicationEntity>> getApplicationResource(UUID guid) { GetApplicationRequest request = GetApplicationRequest.builder() .applicationId(guid.toString()) .build(); return delegate.applicationsV2() .get(request); }
Example #12
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
private Flux<? extends Resource<ApplicationEntity>> getApplicationResources() { IntFunction<ListSpaceApplicationsRequest> pageRequestSupplier = page -> ListSpaceApplicationsRequest.builder() .spaceId(getTargetSpaceGuid().toString()) .page(page) .build(); return PaginationUtils.requestClientV2Resources(page -> delegate.spaces() .listApplications(pageRequestSupplier.apply(page))); }
Example #13
Source File: CFAccessorMock.java From promregator with Apache License 2.0 | 5 votes |
@Override public Mono<ListApplicationsResponse> retrieveAllApplicationIdsInSpace(String orgId, String spaceId) { if (orgId.equals(UNITTEST_ORG_UUID) && spaceId.equals(UNITTEST_SPACE_UUID)) { List<ApplicationResource> list = new LinkedList<>(); ApplicationResource ar = ApplicationResource.builder().entity( ApplicationEntity.builder().name("testapp").state("STARTED").build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP1_UUID).build() ).build(); list.add(ar); ar = ApplicationResource.builder().entity( ApplicationEntity.builder().name("testapp2").state("STARTED").build() ).metadata( Metadata.builder().createdAt(CREATED_AT_TIMESTAMP).id(UNITTEST_APP2_UUID).build() ).build(); list.add(ar); ListApplicationsResponse resp = ListApplicationsResponse.builder().addAllResources(list).build(); return Mono.just(resp); } else if (UNITTEST_SPACE_UUID_DOESNOTEXIST.equals(spaceId)) { return Mono.just(ListApplicationsResponse.builder().build()); } else if (UNITTEST_SPACE_UUID_EXCEPTION.equals(spaceId)) { return Mono.just(ListApplicationsResponse.builder().build()).map( x-> { throw new Error("exception on AllAppIdsInSpace"); }); } Assert.fail("Invalid process request"); return null; }
Example #14
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private Flux<? extends Resource<ApplicationEntity>> getApplicationResourcesByNamesInBatches(Collection<String> names) { return Flux.fromIterable(toBatches(names, MAX_CHAR_LENGTH_FOR_PARAMS_IN_REQUEST)) .flatMap(this::getApplicationResourcesByNames); }
Example #15
Source File: RawCloudApplicationTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static Resource<ApplicationEntity> buildApplicationResource() { return buildApplicationResource(ENVIRONMENT); }
Example #16
Source File: RawCloudApplicationTest.java From cf-java-client-sap with Apache License 2.0 | 4 votes |
private static Resource<ApplicationEntity> buildApplicationResourceWithoutEnvironment() { return buildApplicationResource(null); }
Example #17
Source File: RawCloudApplication.java From cf-java-client-sap with Apache License 2.0 | votes |
public abstract Resource<ApplicationEntity> getResource();