Example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client CFServiceInstance getDashboardUrl

List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client CFServiceInstance getDashboardUrl

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client CFServiceInstance getDashboardUrl.

Prototype

String getDashboardUrl();

Source Link

Usage

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

@Test
public void getServices() throws Exception {
    RetryUtil.retryWhen("getServices", 5, FLAKY_SERVICE_BROKER, () -> {
        String[] serviceNames = new String[3];
        Set<String> userProvided = new HashSet<>();
        for (int i = 0; i < serviceNames.length; i++) {
            if (i % 2 == 0) {
                serviceNames[i] = services.createTestService();
            } else {
                serviceNames[i] = services.createTestUserProvidedService();
                userProvided.add(serviceNames[i]);
            }/*ww  w.  ja v a  2s . c o m*/
        }

        List<CFServiceInstance> actualServices = client.getServices();
        ImmutableSet<String> actualServiceNames = ImmutableSet
                .copyOf(actualServices.stream().map(CFServiceInstance::getName).collect(Collectors.toList()));

        for (CFServiceInstance s : actualServices) {
            //Note: because these test on CI host run in parallel with others using same space...
            // we should assume there might be 'extra stuff' on the space than what we just created here.
            //So only check that 'our stuff' exists and looks right and ignore the rest.
            String name = s.getName();
            if (ImmutableSet.copyOf(serviceNames).contains(name)) {
                System.out.println("Verifying service: " + name);
                if (userProvided.contains(name)) {
                    assertEquals("user-provided", s.getService());
                    System.out.println("  user provided => OK");
                } else {
                    assertEquals(services.getTestServiceAndPlan()[0], s.getService());
                    System.out.println("  getService() => OK");
                    String expectPlan = services.getTestServiceAndPlan()[1];
                    assertEquals(expectPlan, s.getPlan());
                    System.out.println("  getPlan() => OK");
                    assertIsURL(s.getDashboardUrl());
                    System.out.println("  getDashboardUrl() => OK");
                    assertIsURL(s.getDocumentationUrl());
                    System.out.println("  getDocumentationUrl() => OK");
                    assertText(s.getDescription());
                    System.out.println("  getDescription() => OK");
                }
            }
        }

        for (String s : serviceNames) {
            assertTrue(s + " not found in " + actualServiceNames, actualServiceNames.contains(s));
        }
    });
}

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

@Test
public void testGetServiceDashboardUrl() throws Exception {
    String serviceName = services.createTestService();
    CFServiceInstance service = null;
    for (CFServiceInstance s : client.getServices()) {
        if (s.getName().equals(serviceName)) {
            service = s;/*from  ww w  .ja  v  a2 s  .  co  m*/
        }
    }
    String dashUrl = service.getDashboardUrl();
    assertNotNull(dashUrl);
    assertTrue(dashUrl.startsWith("http"));
}