Example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudAppDashElement getMemory

List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudAppDashElement getMemory

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudAppDashElement getMemory.

Prototype

public Integer getMemory() 

Source Link

Usage

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

@Test
public void simpleDeployWithManifest() throws Exception {
    CFClientParams targetParams = CfTestTargetParams.fromEnv();
    MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName());
    CloudFoundryBootDashModel model = harness.createCfTarget(targetParams);

    IProject project = projects.createBootProject("to-deploy", withStarters("actuator", "web"));

    final String appName = appHarness.randomAppName();

    IFile manifestFile = createFile(project, "manifest.yml",
            "applications:\n" + "- name: " + appName + "\n" + "  memory: 512M\n");

    harness.answerDeploymentPrompt(ui, (dialog) -> {
        dialog.okPressed();//w ww  . j  a  va  2  s .c om
    });

    model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING);

    waitForApps(model, appName);

    CloudAppDashElement app = model.getApplication(appName);

    waitForState(app, RunState.RUNNING, 10000);

    assertEquals((Integer) 1, space.getPushCount(appName).getValue());
    assertEquals(manifestFile, app.getDeploymentManifestFile());
    assertEquals(512, (int) app.getMemory());
}

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

@Test
public void simpleDeployWithDefaultManualManifest() throws Exception {
    CFClientParams targetParams = CfTestTargetParams.fromEnv();
    MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName());
    CloudFoundryBootDashModel model = harness.createCfTarget(targetParams);

    IProject project = projects.createBootProject("to-deploy", withStarters("actuator", "web"));

    final String appName = project.getName();

    harness.answerDeploymentPrompt(ui, (dialog) -> {
        dialog.okPressed();/*  w w  w. j  av  a2  s. com*/
    });

    model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING);

    waitForApps(model, appName);

    CloudAppDashElement app = model.getApplication(appName);

    waitForState(app, RunState.RUNNING, 10000);

    assertEquals((Integer) 1, space.getPushCount(appName).getValue());
    assertNull(app.getDeploymentManifestFile());
    assertEquals(1024, (int) app.getMemory());
    assertEquals(appName, app.getName());
}

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

@Test
public void manifestDiffDialogChooseUseManfifest() throws Exception {
    //Setup initial state for our test
    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"));
    IFile manifest = createFile(project, "manifest.yml",
            "applications:\n" + "- name: " + appName + "\n" + "  memory: 1111M\n");

    harness.answerDeploymentPrompt(ui, manifest);

    CloudFoundryBootDashModel model = harness.createCfTarget(targetParams);
    model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING);

    waitForApps(model, appName);/*from  www . jav a  2  s .  com*/
    CloudAppDashElement app = model.getApplication(appName);
    waitForState(app, RunState.RUNNING, APP_DEPLOY_TIMEOUT);

    {
        MockCFApplication appInCloud = space.getApplication(appName);
        assertEquals(1111, appInCloud.getMemory());
        Mockito.reset(ui);

        //// real test begins here

        appInCloud.setMemory(2222);
    }

    harness.answerManifestDiffDialog(ui, (ManifestDiffDialogModel dialog) -> {
        //??? code to check what's in the dialog???
        return ManifestDiffDialogModel.Result.USE_MANIFEST;
    });

    app.restart(RunState.RUNNING, ui);

    waitForJobsToComplete();
    {
        MockCFApplication appInCloud = space.getApplication(appName);
        assertEquals(2, appInCloud.getPushCount());
        assertEquals(RunState.RUNNING, app.getRunState());
        assertEquals(1111, appInCloud.getMemory());
        assertEquals(1111, (int) app.getMemory());
    }
}

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

@Test
public void manifestDiffDialogChooseForgetManfifest() throws Exception {
    //Setup initial state for our test
    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"));
    IFile manifest = createFile(project, "manifest.yml",
            "applications:\n" + "- name: " + appName + "\n" + "  memory: 1111M\n");

    harness.answerDeploymentPrompt(ui, manifest);

    CloudFoundryBootDashModel model = harness.createCfTarget(targetParams);
    model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING);

    waitForApps(model, appName);/* w  w  w  . j a  v a 2 s .co  m*/
    CloudAppDashElement app = model.getApplication(appName);
    waitForState(app, RunState.RUNNING, APP_DEPLOY_TIMEOUT);

    MockCFApplication appInCloud = space.getApplication(appName);
    assertEquals(1111, appInCloud.getMemory());
    Mockito.reset(ui);

    //// real test begins here

    appInCloud.setMemory(2222);

    harness.answerManifestDiffDialog(ui, (ManifestDiffDialogModel dialog) -> {
        //??? code to check what's in the dialog???
        return ManifestDiffDialogModel.Result.FORGET_MANIFEST;
    });

    app.restart(RunState.RUNNING, ui);

    waitForJobsToComplete();

    assertEquals(2, appInCloud.getPushCount());
    assertEquals(RunState.RUNNING, app.getRunState());
    assertEquals(2222, appInCloud.getMemory());
    assertEquals(2222, (int) app.getMemory());
}