List of usage examples for org.springframework.ide.eclipse.boot.dash.model RunState RUNNING
RunState RUNNING
To view the source code for org.springframework.ide.eclipse.boot.dash.model RunState RUNNING.
Click Source Link
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java
public void restartWithRemoteClient(UserInteractions ui, CancelationToken cancelationToken) { String opName = "Restart Remote DevTools Client for application '" + getName() + "'"; getCloudModel().runAsynch(opName, getName(), (IProgressMonitor monitor) -> { doRestartWithRemoteClient(RunState.RUNNING, ui, cancelationToken, monitor); }, ui);//from w w w.j av a 2s .c om }
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java
@Override public RunState getRunState() { RunState state = baseRunState.getValue(); if (state == RunState.RUNNING) { DebugSupport debugSupport = getDebugSupport(); if (debugSupport.isDebuggerAttached(CloudAppDashElement.this)) { // if (DevtoolsUtil.isDevClientAttached(this, ILaunchManager.DEBUG_MODE)) { state = RunState.DEBUGGING;/*from w w w. j av a 2s .c o m*/ } } return state; }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelIntegrationTest.java
/** * Test that tests a bunch of things.// w w w. ja v a2 s. 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; } }; }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelIntegrationTest.java
@Test public void testEnvVarsSetOnFirstDeploy() throws Exception { CloudFoundryBootDashModel target = harness.createCfTarget(CfTestTargetParams.fromEnv()); final CloudFoundryBootDashModel model = harness.getCfTargetModel(); IProject project = projects.createBootProject("to-deploy", withStarters("actuator", "web")); final String appName = appHarness.randomAppName(); Map<String, String> env = new HashMap<>(); env.put("FOO", "something"); harness.answerDeploymentPrompt(ui, appName, appName, env); model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING); 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; }/* ww w . ja v a2 s . c o m*/ }; Map<String, String> actualEnv = harness.fetchEnvironment(target, appName); assertEquals("something", actualEnv.get("FOO")); }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelIntegrationTest.java
@Test public void testServicesBoundOnFirstDeploy() throws Exception { CloudFoundryBootDashModel target = harness.createCfTarget(CfTestTargetParams.fromEnv()); final CloudFoundryBootDashModel model = harness.getCfTargetModel(); IProject project = projects.createBootProject("to-deploy", withStarters("actuator", "web")); List<String> bindServices = ImmutableList.of(services.createTestService(), services.createTestService()); ACondition.waitFor("services exist " + bindServices, 30_000, () -> { Set<String> services = client.getServices().stream().map(CFServiceInstance::getName) .collect(Collectors.toSet()); System.out.println("services = " + services); assertTrue(services.containsAll(bindServices)); });//from ww w . ja v a2 s . c o m final String appName = appHarness.randomAppName(); harness.answerDeploymentPrompt(ui, appName, appName, bindServices); model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING); 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; } }; Set<String> actualServices = client.getBoundServicesSet(appName).block(); assertEquals(ImmutableSet.copyOf(bindServices), actualServices); }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelIntegrationTest.java
@Test public void testDeployManifestWithAbsolutePathAttribute() throws Exception { CFClientParams targetParams = CfTestTargetParams.fromEnv(); IProject project = projects.createProject("to-deploy"); CloudFoundryBootDashModel model = harness.createCfTarget(targetParams); waitForJobsToComplete();/*from ww w. ja v a2 s . c o m*/ File zipFile = getTestZip("testapp"); final String appName = appHarness.randomAppName(); IFile manifestFile = createFile(project, "manifest.yml", "applications:\n" + "- name: " + appName + "\n" + " path: " + zipFile.getAbsolutePath() + "\n" + " buildpack: staticfile_buildpack"); harness.answerDeploymentPrompt(ui, manifestFile); model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING); ACondition.waitFor("app to appear", APP_IS_VISIBLE_TIMEOUT, () -> { assertNotNull(model.getApplication(appName)); }); CloudAppDashElement app = model.getApplication(appName); ACondition.waitFor("app to be running", APP_DEPLOY_TIMEOUT, () -> { assertEquals(RunState.RUNNING, app.getRunState()); String url = pathJoin(app.getUrl(), "test.txt"); assertEquals(url, "some content here\n", IOUtils.toString(new URL(url))); }); verify(ui).promptApplicationDeploymentProperties(any()); verifyNoMoreInteractions(ui); }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelMockingTest.java
@Test public void testRefreshAppsRunState() throws Exception { CFClientParams targetParams = CfTestTargetParams.fromEnv(); MockCFSpace space = clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName()); final MockCFApplication foo = space.defApp("foo"); space.defApp("bar"); final CloudFoundryBootDashModel target = harness.createCfTarget(targetParams); waitForApps(target, "foo", "bar"); foo.start(CancelationTokens.NULL);// www . ja v a2 s .com target.refresh(ui); new ACondition("wait for app states", 3000) { @Override public boolean test() throws Exception { ImmutableSet<String> appNames = getNames(target.getApplications().getValues()); assertEquals(ImmutableSet.of("foo", "bar"), appNames); CloudAppDashElement appElement = harness.getCfTargetModel().getApplication("foo"); assertEquals(RunState.RUNNING, appElement.getRunState()); appElement = harness.getCfTargetModel().getApplication("bar"); assertEquals(RunState.INACTIVE, appElement.getRunState()); return true; } }; }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelMockingTest.java
@Test public void testEnvVarsSetOnFirstDeploy() throws Exception { CFClientParams targetParams = CfTestTargetParams.fromEnv(); clientFactory.defSpace(targetParams.getOrgName(), targetParams.getSpaceName()); CloudFoundryBootDashModel target = harness.createCfTarget(targetParams); final CloudFoundryBootDashModel model = harness.getCfTargetModel(); IProject project = projects.createBootProject("to-deploy", withStarters("actuator", "web")); final String appName = appHarness.randomAppName(); Map<String, String> env = new HashMap<>(); env.put("FOO", "something"); harness.answerDeploymentPrompt(ui, appName, appName, env); model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING); new ACondition("wait for app '" + appName + "'to be RUNNING", 30000) { //why so long? JDT searching for main type. public boolean test() throws Exception { CloudAppDashElement element = model.getApplication(appName); assertEquals(RunState.RUNNING, element.getRunState()); return true; }//from w w w . j av a 2 s . c o m }; Map<String, String> actualEnv = harness.fetchEnvironment(target, appName); assertEquals("something", actualEnv.get("FOO")); }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryBootDashModelMockingTest.java
@Test public void simpleDeploy() 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(); harness.answerDeploymentPrompt(ui, appName, appName); model.performDeployment(ImmutableSet.of(project), ui, RunState.RUNNING); waitForApps(model, appName);/*from www .j a v a 2 s . c om*/ CloudAppDashElement app = model.getApplication(appName); waitForState(app, RunState.RUNNING, 10000); assertEquals((Integer) 1, space.getPushCount(appName).getValue()); }
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 w w .j a va 2 s. c o m*/ }); 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()); }