Example usage for org.springframework.ide.eclipse.boot.dash.model RunState UNKNOWN

List of usage examples for org.springframework.ide.eclipse.boot.dash.model RunState UNKNOWN

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.model RunState UNKNOWN.

Prototype

RunState UNKNOWN

To view the source code for org.springframework.ide.eclipse.boot.dash.model RunState UNKNOWN.

Click Source Link

Usage

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

@Test
public void runstateBecomesUnknownWhenStartOperationFails() throws Exception {
    final String appName = "foo";
    String projectName = "to-deploy";
    CFClientParams targetParams = CfTestTargetParams.fromEnv();
    MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName());
    MockCFApplication app = space.defApp(appName);
    final IProject project = projects.createProject(projectName);

    final CloudFoundryBootDashModel target = harness.createCfTarget(targetParams);
    waitForApps(target, appName);//from  w w w .  j  a  v  a  2s.c  om
    CloudAppDashElement appElement = target.getApplication(appName);
    appElement.setProject(project);

    //The state refressh is asynch so until state becomes 'INACTIVE' it will be unknown.
    waitForState(appElement, RunState.INACTIVE, 3000);
    IAction restartAction = actions.getRestartOnlyApplicationAction();

    RunStateHistory runstateHistory = new RunStateHistory();

    appElement.getBaseRunStateExp().addListener(runstateHistory);
    doThrow(IOException.class).when(app).start(any());

    System.out.println("restarting application...");
    harness.selection.setElements(appElement);
    restartAction.run();

    waitForState(appElement, RunState.UNKNOWN, 3000);

    runstateHistory.assertHistoryContains(RunState.INACTIVE, RunState.STARTING);
    runstateHistory.assertLast(RunState.UNKNOWN);
}

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

@Test
public void refreshClearsErrorState() throws Exception {
    final String appName = "foo";
    String projectName = "to-deploy";
    CFClientParams targetParams = CfTestTargetParams.fromEnv();
    MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName());
    space.defApp(appName);/*from  w ww.jav  a 2  s.c om*/
    final IProject project = projects.createProject(projectName);

    final CloudFoundryBootDashModel target = harness.createCfTarget(targetParams);
    waitForApps(target, appName);
    CloudAppDashElement appElement = target.getApplication(appName);
    appElement.setProject(project);

    waitForState(appElement, RunState.INACTIVE, 3000);
    //The state refressh is asynch so until state becomes 'INACTIVE' it will be unknown.
    appElement.setError(new IOException("Something bad happened"));
    waitForState(appElement, RunState.UNKNOWN, 3000);

    target.refresh(ui);

    waitForState(appElement, RunState.INACTIVE, 3000);
}