use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testOneTarget.
@Test
public void testOneTarget() throws Exception {
CFTarget target = targetCache.getOrCreate().get(0);
assertNotNull(target);
assertEquals(MockCfCli.DEFAULT_PARAMS, target.getParams());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class CFClientTest method testUnknownHostServices.
@Test
public void testUnknownHostServices() throws Exception {
ClientRequests client = cloudfoundry.client;
when(client.getServices()).thenThrow(new UnknownHostException("api.run.pivotal.io"));
CFTarget target = targetCache.getOrCreate().get(0);
assertError(() -> target.getServices(), 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 testUnknownHostBuildpacks.
@Test
public void testUnknownHostBuildpacks() throws Exception {
ClientRequests client = cloudfoundry.client;
when(client.getBuildpacks()).thenThrow(new UnknownHostException("api.run.pivotal.io"));
CFTarget target = targetCache.getOrCreate().get(0);
assertError(() -> target.getBuildpacks(), ConnectionException.class, expectedMessages.noNetworkConnection());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class ManifestYamlActualCfClientTest method testGetBuildpacks.
@Ignore
@Test
public void testGetBuildpacks() throws Exception {
List<CFTarget> targets = cfTargetCache.getOrCreate();
assertTrue(targets.size() == 1);
CFTarget target = targets.get(0);
List<CFBuildpack> buildpacks = target.getBuildpacks();
assertTrue(!buildpacks.isEmpty());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget in project sts4 by spring-projects.
the class AbstractCFHintsProvider method getHints.
/**
* @return non-null list of hints. Return empty if no hints available
*/
protected Collection<YValueHint> getHints(List<CFTarget> targets) throws Exception {
if (targets == null || targets.isEmpty()) {
// this "don't know" value will suppress bogus warnings in the reconciler.
return null;
}
List<YValueHint> hints = new ArrayList<>();
boolean validTargetsPresent = false;
for (CFTarget cfTarget : targets) {
try {
// TODO: check if duplicate proposals can be the list of all hints. Duplicates don't seem to cause duplicate proposals. Verify this!
getHints(cfTarget).stream().filter(hint -> !hints.contains(hint)).forEach(hint -> hints.add(hint));
validTargetsPresent = true;
} catch (Exception e) {
// Drop individual target error
}
}
if (validTargetsPresent) {
return hints;
} else {
throw new ConnectionException(targetCache.getCfClientConfig().getClientParamsProvider().getMessages().noNetworkConnection());
}
}
Aggregations