Example usage for org.springframework.ide.eclipse.boot.dash.test.mocks MockCFApplication scaleInstances

List of usage examples for org.springframework.ide.eclipse.boot.dash.test.mocks MockCFApplication scaleInstances

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.test.mocks MockCFApplication scaleInstances.

Prototype

public void scaleInstances(int desiredInstances) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelMockingTest.java

@Test
public void manifestDiffDialogShownWhenInstancesChangedExternally() throws Exception {
    final String appName = "foo";

    CFClientParams targetParams = CfTestTargetParams.fromEnv();
    MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName());
    IProject project = projects.createBootProject("to-deploy", withStarters("web", "actuator"));
    createFile(project, "manifest.yml", "applications:\n" + "- name: " + appName + "\n");
    MockCFApplication deployedApp = space.defApp(appName);
    deployedApp.start(CancelationTokens.NULL);

    CloudFoundryBootDashModel model = harness.createCfTarget(targetParams);
    waitForApps(model, appName);/*  w  ww . java  2s . co m*/
    waitForJobsToComplete();

    CloudAppDashElement app = model.getApplication(appName);
    app.setDeploymentManifestFile(project.getFile("manifest.yml"));
    app.setProject(project);
    assertEquals(1, app.getActualInstances());

    deployedApp.scaleInstances(2); // change it 'externally'
    assertEquals(1, app.getActualInstances()); //The model doesn't know yet that it has changed!

    app.restart(RunState.RUNNING, ui);

    waitForJobsToComplete();

    //If the change was detected the deployment props dialog should have popped exactly once.
    verify(ui).openManifestDiffDialog(any());
}