use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance in project sts4 by spring-projects.
the class ManifestYamlEditorTest method dashedContentAssistForServices.
@Test
public void dashedContentAssistForServices() throws Exception {
Editor editor;
CFServiceInstance service = mock(CFServiceInstance.class);
when(cloudfoundry.client.getServices()).thenReturn(ImmutableList.of(service));
when(service.getName()).thenReturn("my-service");
when(service.getPlan()).thenReturn("cheap-plan");
editor = harness.newEditor("services:\n" + "- blah\n" + "ser<*>");
editor.assertCompletionWithLabel((s) -> s.startsWith("- "), "services:\n" + "- blah\n" + "- my-service<*>");
editor = harness.newEditor("services:\n" + "- blah\n" + "<*>");
editor.assertCompletionWithLabel((s) -> s.startsWith("- "), "services:\n" + "- blah\n" + "- my-service<*>");
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services:<*>\n");
editor.assertCompletions("applications:\n" + "- name: foo\n" + " services: \n" + " - my-service<*>\n");
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services: <*>\n");
editor.assertCompletionLabels("- my-service - cheap-plan");
editor.assertCompletions("applications:\n" + "- name: foo\n" + " services: \n" + " - my-service<*>\n");
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services: ser<*>\n");
editor.assertCompletions("applications:\n" + "- name: foo\n" + " services: \n" + " - my-service<*>\n");
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services: \n" + " - blah\n" + " <*>\n");
editor.assertCompletionWithLabel((s) -> s.startsWith("- "), "applications:\n" + "- name: foo\n" + " services: \n" + " - blah\n" + " - my-service<*>\n");
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance in project sts4 by spring-projects.
the class ManifestYamlEditorTest method serviceContentAssist.
@Test
public void serviceContentAssist() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFServiceInstance service = Mockito.mock(CFServiceInstance.class);
when(service.getName()).thenReturn("mysql");
when(service.getPlan()).thenReturn("medium");
when(cfClient.getServices()).thenReturn(ImmutableList.of(service));
CompletionItem completion = assertCompletions("services:\n" + " - <*>", // ==>
"services:\n" + " - mysql<*>").get(0);
assertEquals("mysql - medium", completion.getLabel());
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileCFService.
@Test
public void reconcileCFService() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFServiceInstance service = Mockito.mock(CFServiceInstance.class);
when(service.getName()).thenReturn("myservice");
when(cfClient.getServices()).thenReturn(ImmutableList.of(service));
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services:\n" + " - myservice\n");
// Should have no problems
editor.assertProblems();
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileShowsWarningOnUnknownService.
@Test
public void reconcileShowsWarningOnUnknownService() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFServiceInstance service = Mockito.mock(CFServiceInstance.class);
when(service.getName()).thenReturn("myservice");
when(cfClient.getServices()).thenReturn(ImmutableList.of(service));
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " services:\n" + " - bad-service\n");
editor.assertProblems("bad-service|There is no service instance called");
Diagnostic problem = editor.assertProblem("bad-service");
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFServiceInstance in project sts4 by spring-projects.
the class ManifestYamlEditorTest method noRelaxedValueCompletionsInListItemContexts.
@Test
public void noRelaxedValueCompletionsInListItemContexts() throws Exception {
// See: https://www.pivotaltracker.com/story/show/144393355
CFServiceInstance service = mock(CFServiceInstance.class);
when(cloudfoundry.client.getServices()).thenReturn(ImmutableList.of(service));
when(service.getName()).thenReturn("my-service");
when(service.getPlan()).thenReturn("cheap-plan");
Editor editor = harness.newEditor("services:\n" + "- some-service\n" + "<*>");
editor.assertCompletions((c) -> c.getLabel().contains("my-service"), "services:\n" + "- some-service\n" + "- my-service<*>");
}
Aggregations