use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException in project sts4 by spring-projects.
the class CFClientTest method testNoTarget.
@Test
public void testNoTarget() throws Exception {
when(cloudfoundry.paramsProvider.getParams()).thenThrow(new NoTargetsException(expectedMessages.noTargetsFound()));
assertError(() -> targetCache.getOrCreate(), NoTargetsException.class, expectedMessages.noTargetsFound());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException in project sts4 by spring-projects.
the class ManifestYamlEditorTest method servicesContentAssistWhenNotLoggedIn_ErrorProposalsDisabled.
@Test
public void servicesContentAssistWhenNotLoggedIn_ErrorProposalsDisabled() throws Exception {
System.setProperty("lsp.yaml.completions.errors.disable", "true");
reset(cloudfoundry.defaultParamsProvider);
when(cloudfoundry.defaultParamsProvider.getParams()).thenThrow(new NoTargetsException("No Cloudfoundry Targets: Please login"));
String textBefore = "applications:\n" + "- name: foo\n" + " services:\n" + " - <*>";
Editor editor = harness.newEditor(textBefore);
// Applying the single completion should do nothing in the editor:
assertEquals(0, editor.assertCompletions().size());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException in project sts4 by spring-projects.
the class ManifestYamlEditorTest method servicesContentAssistShowErrorMessageWhenNotLoggedIn.
@Test
public void servicesContentAssistShowErrorMessageWhenNotLoggedIn() throws Exception {
reset(cloudfoundry.defaultParamsProvider);
when(cloudfoundry.defaultParamsProvider.getParams()).thenThrow(new NoTargetsException("No Cloudfoundry Targets: Please login"));
String textBefore = "applications:\n" + "- name: foo\n" + " services:\n" + " - <*>";
Editor editor = harness.newEditor(textBefore);
// Applying the single completion should do nothing in the editor:
editor.assertCompletions(textBefore);
// The message from the exception should appear in the 'doc string':
editor.assertCompletionDetails("No Cloudfoundry Targets", "Error", "Please login");
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException in project sts4 by spring-projects.
the class ManifestYamlEditorTest method servicesContentAssistShowErrorMessageWhenNotLoggedIn_nonEmptyQueryString.
@Test
public void servicesContentAssistShowErrorMessageWhenNotLoggedIn_nonEmptyQueryString() throws Exception {
reset(cloudfoundry.defaultParamsProvider);
when(cloudfoundry.defaultParamsProvider.getParams()).thenThrow(new NoTargetsException("No Cloudfoundry Targets: Please login"));
String textBefore = "applications:\n" + "- name: foo\n" + " services:\n" + " - something<*>";
Editor editor = harness.newEditor(textBefore);
// Applying the single completion should do nothing in the editor:
editor.assertCompletions(textBefore);
// The message from the exception should appear in the 'doc string':
CompletionItem completion = editor.assertCompletionDetails("No Cloudfoundry Targets", "Error", "Please login");
// query string should match the 'filter text' otherwise vscode will filter the item and it will be gone!
assertEquals("something", completion.getFilterText());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.NoTargetsException in project sts4 by spring-projects.
the class ManifestYamlEditorTest method buildbackContentAssistNoTargets.
@Test
public void buildbackContentAssistNoTargets() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFBuildpack buildPack = Mockito.mock(CFBuildpack.class);
when(buildPack.getName()).thenReturn("java_buildpack");
when(cfClient.getBuildpacks()).thenReturn(ImmutableList.of(buildPack));
String title = "No targets";
String description = "Use CLI to login";
when(cloudfoundry.defaultParamsProvider.getParams()).thenThrow(new NoTargetsException(title + ": " + description));
CompletionItem completion = assertCompletions("buildpack: <*>", "buildpack: <*>").get(0);
assertEquals(title, completion.getLabel());
assertEquals(description, completion.getDocumentation());
}
Aggregations