use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testServicesFromTarget.
@Test
public void testServicesFromTarget() throws Exception {
ClientRequests client = cloudfoundry.client;
CFServiceInstance service = Mockito.mock(CFServiceInstance.class);
when(service.getName()).thenReturn("appdb");
when(service.getPlan()).thenReturn("spark");
when(service.getService()).thenReturn("cleardb");
when(client.getServices()).thenReturn(ImmutableList.of(service));
CFTarget target = targetCache.getOrCreate().get(0);
assertEquals("appdb", target.getServices().get(0).getName());
assertEquals("spark", target.getServices().get(0).getPlan());
assertEquals("cleardb", target.getServices().get(0).getService());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testNoServicesFromTarget.
@Test
public void testNoServicesFromTarget() throws Exception {
ClientRequests client = cloudfoundry.client;
when(client.getServices()).thenReturn(ImmutableList.of());
CFTarget target = targetCache.getOrCreate().get(0);
assertTrue(target.getServices().isEmpty());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testDomainsFromTarget.
@Test
public void testDomainsFromTarget() throws Exception {
ClientRequests client = cloudfoundry.client;
CFDomain domain = Mockito.mock(CFDomain.class);
when(domain.getName()).thenReturn("cfapps.io");
when(client.getDomains()).thenReturn(ImmutableList.of(domain));
CFTarget target = targetCache.getOrCreate().get(0);
assertEquals("cfapps.io", target.getDomains().get(0).getName());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testUnknownHostDomains.
@Test
public void testUnknownHostDomains() throws Exception {
ClientRequests client = cloudfoundry.client;
when(client.getDomains()).thenThrow(new UnknownHostException("api.run.pivotal.io"));
CFTarget target = targetCache.getOrCreate().get(0);
assertError(() -> target.getDomains(), ConnectionException.class, expectedMessages.noNetworkConnection());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testBuildpacksFromTarget.
@Test
public void testBuildpacksFromTarget() throws Exception {
ClientRequests client = cloudfoundry.client;
CFBuildpack buildpack = Mockito.mock(CFBuildpack.class);
when(buildpack.getName()).thenReturn("java_buildpack");
when(client.getBuildpacks()).thenReturn(ImmutableList.of(buildpack));
CFTarget target = targetCache.getOrCreate().get(0);
assertEquals("java_buildpack", target.getBuildpacks().get(0).getName());
}
Aggregations