use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CfTargetsInfoProvder in project sts4 by spring-projects.
the class ManifestYamlActualCfClientTest method setup.
@Before
public void setup() throws Exception {
cfJson = new CfJson();
CfTargetsInfo info = getTargetsInfoFromEnv();
CfTargetsInfoProvder provider = new CfTargetsInfoProvder(info);
CfClientConfig cfClientConfig = CfClientConfig.createDefault(provider);
CloudFoundryClientFactory clientFactory = DefaultCloudFoundryClientFactoryV2.INSTANCE;
cfTargetCache = new CFTargetCache(cfClientConfig, clientFactory, new ClientTimeouts());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CfTargetsInfoProvder in project sts4 by spring-projects.
the class ManifestYamlLanguageServer method applyCfLoginParameterSettings.
@SuppressWarnings("unchecked")
private void applyCfLoginParameterSettings(CfTargetsInfo info) {
List<Target> cfTargets = info.getCfTargets();
if (cfTargets != null) {
CfTargetsInfoProvder cfClientParamsProvider = new CfTargetsInfoProvder(info);
cfClientConfig.setClientParamsProvider(new ClientParamsProvider() {
@Override
public Collection<CFClientParams> getParams() throws NoTargetsException, ExecutionException {
List<ClientParamsProvider> providers = ImmutableList.of(defaultClientParamsProvider, cfClientParamsProvider);
List<CFClientParams> params = new ArrayList<>();
for (ClientParamsProvider provider : providers) {
try {
params.addAll(provider.getParams());
} catch (Exception e) {
// ignore
}
}
if (params.isEmpty()) {
throw new NoTargetsException(getMessages().noTargetsFound());
}
return params;
}
@Override
public CFParamsProviderMessages getMessages() {
return cfTargets.isEmpty() ? defaultClientParamsProvider.getMessages() : cfClientParamsProvider.getMessages();
}
});
}
}
Aggregations