List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudFoundryBootDashModel add
@Override public void add(List<Object> sources, UserInteractions ui) throws Exception
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelIntegrationTest.java
/** * Test that tests a bunch of things.//from www. ja va2s. c o m * TODO: It isn't good practice to create 'test everything' tests... * but we do it anyway because ramping up a test that deploys an app takes about 90 seconds... * Maybe we can factor this better somehow so we have separate tests, but only deploy app once? */ @Test public void testDeployAppAndDeleteAndStuff() throws Exception { harness.createCfTarget(CfTestTargetParams.fromEnv()); final CloudFoundryBootDashModel model = harness.getCfTargetModel(); final BootProjectDashElement project = harness .getElementFor(projects.createBootProject("to-deploy", withStarters("actuator", "web"))); final String appName = appHarness.randomAppName(); harness.answerDeploymentPrompt(ui, appName, appName); model.add(ImmutableList.<Object>of(project), ui); //The resulting deploy is asynchronous new ACondition("wait for app '" + appName + "'to appear", APP_IS_VISIBLE_TIMEOUT) { public boolean test() throws Exception { assertNotNull(model.getApplication(appName)); return true; } }; new ACondition("wait for app '" + appName + "'to be RUNNING", APP_DEPLOY_TIMEOUT) { public boolean test() throws Exception { CloudAppDashElement element = model.getApplication(appName); assertEquals(RunState.RUNNING, element.getRunState()); return true; } }; //Try to get request mappings new ACondition("wait for request mappings", FETCH_REQUEST_MAPPINGS_TIMEOUT) { public boolean test() throws Exception { CloudAppDashElement element = model.getApplication(appName); List<RequestMapping> mappings = element.getLiveRequestMappings(); assertNotNull(mappings); //Why is the test sometimes failing here? assertTrue(!mappings.isEmpty()); //Even though this is an 'empty' app should have some mappings, // for example an 'error' page. return true; } }; //Try to delete the app... reset(ui); when(ui.confirmOperation(eq("Deleting Elements"), anyString())).thenReturn(true); CloudAppDashElement app = model.getApplication(appName); app.getCloudModel().delete(ImmutableList.<BootDashElement>of(app), ui); new ACondition("wait for app to be deleted", APP_DELETE_TIMEOUT) { @Override public boolean test() throws Exception { assertNull(model.getApplication(appName)); return true; } }; }