use of org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileRouteValidDomain.
@Test
public void reconcileRouteValidDomain() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFDomain domain = Mockito.mock(CFDomain.class);
when(domain.getName()).thenReturn("springsource.org");
when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " routes:\n" + " - route: host.springsource.org\n");
editor.assertProblems();
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests 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.ClientRequests 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.ClientRequests in project sts4 by spring-projects.
the class ManifestYamlEditorTest method noReconcileErrorsWhenClientThrows.
@Test
public void noReconcileErrorsWhenClientThrows() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
when(cfClient.getBuildpacks()).thenThrow(new IOException("Can't get buildpacks"));
when(cfClient.getServices()).thenThrow(new IOException("Can't get services"));
when(cfClient.getStacks()).thenThrow(new IOException("Can't get stacks"));
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " buildpack: bad-buildpack\n" + " stack: bad-stack\n" + " services:\n" + " - bad-service\n" + // a token error to make sure reconciler is actually running!
" bogus: bad");
editor.assertProblems("bogus|Unknown property");
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests in project sts4 by spring-projects.
the class ManifestYamlEditorTest method domainsContentAssist.
@Test
public void domainsContentAssist() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
CFDomain domain = Mockito.mock(CFDomain.class);
when(domain.getName()).thenReturn("cfapps.io");
when(cfClient.getDomains()).thenReturn(ImmutableList.of(domain));
CompletionItem completion = assertCompletions("domains:\n" + "- <*>", // ===>
"domains:\n" + "- cfapps.io<*>").get(0);
assertEquals("an-org : a-space [test.io]", completion.getDocumentation());
}
Aggregations