List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client.v2 CFPushArguments setServices
public void setServices(List<String> services)
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryClientTest.java
@Test public void testPushAndBindServices() throws Exception { //This test fails occasionally because service binding is 'unreliable'. Had a long discussion // with Ben Hale. The gist is errors happen and should be expected in distributed world. //They are coming from 'AppDirect' which manages the services. The errors are mediated through cloudfoundry // which doesn't knwow how it should handle them. So it passed the buck onto the its callers. //In this case.... cf-java-client which does the same thing and passes them to us. //All the reasons why they can't handle these errors also apply to us, which means that //the operation is simply unreliable and so failure is an expected outcome even when everything //works correctly. //To avoid this test case from failing too often we retry it a few times. RetryUtil.retryTimes("testPushAndBindServices", 4, () -> { System.out.println("Executing full test scenario."); String service1 = services.createTestService(); String service2 = services.createTestService(); String service3 = services.createTestService(); //An extra unused service (makes this a better test). String appName = appHarness.randomAppName(); CFPushArguments params = new CFPushArguments(); params.setAppName(appName);/*from w w w . ja va2s . c om*/ params.setApplicationData(getTestZip("testapp")); params.setBuildpack("staticfile_buildpack"); params.setServices(ImmutableList.of(service1, service2)); push(params); assertEquals(ImmutableSet.of(service1, service2), getBoundServiceNames(appName)); client.bindAndUnbindServices(appName, ImmutableList.of(service1)).block(); assertEquals(ImmutableSet.of(service1), getBoundServiceNames(appName)); client.bindAndUnbindServices(appName, ImmutableList.of(service2)).block(); assertEquals(ImmutableSet.of(service2), getBoundServiceNames(appName)); client.bindAndUnbindServices(appName, ImmutableList.of()).block(); assertEquals(ImmutableSet.of(), getBoundServiceNames(appName)); }); }
From source file:org.springframework.ide.eclipse.boot.dash.test.CloudFoundryClientTest.java
@Test public void testGetBoundServices() throws Exception { RetryUtil.retryWhen("testGetBoundServices", 5, FLAKY_SERVICE_BROKER, () -> { String service1 = services.createTestService(); String service2 = services.createTestService(); String service3 = services.createTestService(); String appName = appHarness.randomAppName(); CFPushArguments params = new CFPushArguments(); params.setAppName(appName);/* w ww . j av a 2s.c o m*/ params.setApplicationData(getTestZip("testapp")); params.setBuildpack("staticfile_buildpack"); params.setServices(ImmutableList.of(service1, service2)); push(params); List<CFApplication> allApps = client.getApplicationsWithBasicInfo(); CFApplication app = null; for (CFApplication a : allApps) { if (a.getName().equals(appName)) { app = a; } } assertEquals(ImmutableSet.of(service1, service2), ImmutableSet.copyOf(app.getServices())); app = client.getApplication(appName); assertEquals(ImmutableSet.of(service1, service2), ImmutableSet.copyOf(app.getServices())); }); }