question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StartApplication is not working

See original GitHub issue

Hello, I have been assigned to create a method that will start an application. I have the code implemented correctly yet nothing is happening when I run my project. I’m an intern, so i am new to this and therefore I am not so familiar with cloudfoundry overall. If you can help me in any way that would be much appreciated.

My code is written below:

public Mono<Map<String, Object>> startApplication(String orgName, String spaceName, String appName){ 
        return this.getApplications(orgName, spaceName)
                .flatMap(ApplicationDetail ->  Mono.zip(Mono.just(ApplicationDetail.getName()),Mono.just(ApplicationDetail.getRequestedState().equals("STOPPED") ?
                                runApplication(orgName, spaceName, appName): "the application is already running")))
                .filter(hmap -> hmap.getT1().equalsIgnoreCase(appName))
                .collectMap(Tuple2::getT1,Tuple2::getT2);
    }
    public Mono<Void> runApplication(String appName, String orgName, String spaceName) {
        final CloudFoundryOperations cloudFoundryOperations = this.getCloudFoundryOperations(orgName, spaceName);
      
           return cloudFoundryOperations.applications()
                .start(StartApplicationRequest.builder()
                        .name(appName)
                        .build());
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
shirakurlandcommented, Oct 2, 2020

Thank you for all your help! The method now works properly 👍

0reactions
twoseatcommented, Oct 2, 2020

Reactor can do conditionals such as if in a variety of ways, but often the best approach is a filter. Excuse the formatting as I’m coding in a browser, but I think in your case that would look like this:

this.getApplications(orgName, spaceName)
            .filter(applicationDetail -> applicationDetail.getName().equals(appName))
            .filter(applicationDetail -> applicationDetail.getRequestedState().equals("STOPPED"))
            .flatMap(applicationDetail -> runApplication(orgName, spaceName, appName))

Incidentally, the start() method here already handles this scenario (and handles waiting for the application to start), so be sure you’re not reinventing the wheel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

startApplication() fails to launch the AUT
startApplication() may fail to launch the Android application. In such a case, please check/try ... Make sure Android Studio is not running.
Read more >
squish startApplication() won't start an application with space
You can map your application on the AUT settings and call the application without space while running your test case.
Read more >
Windows.startApplication URL address problem - Katalon Studio
Hi How to set the URL address on local machine for test cases? I'm trying to run windows app tests, i can open...
Read more >
Enable start application is not working in 32 bit machines ...
Hi, We are using the Installshield 2014 professional to generate a MSI setup for 32/64 bit machines. Modified the printer's config file ...
Read more >
Get-StartApps is not recognized as the name of a cmdlet ...
Powershell Debugger Not Loading all Modules : Get-StartApps is not recognized as the name of a cmdlet, function, script file, or operable program...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found