use of org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests 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.ClientRequests 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());
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.ClientRequests in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileShowsWarningOnNoService.
@Test
public void reconcileShowsWarningOnNoService() throws Exception {
ClientRequests cfClient = cloudfoundry.client;
when(cfClient.getServices()).thenReturn(ImmutableList.of());
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.ClientRequests in project sts4 by spring-projects.
the class ManifestYamlEditorTest method domainContentAssist.
@Test
public void domainContentAssist() 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("domain: <*>", "domain: cfapps.io<*>").get(0);
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 delayedConstraints.
@Test
public void delayedConstraints() throws Exception {
// This tests the two different types of delayed constraints:
// Slow delayed constraints that require CF connection (services
// and "faster" delayed constraints that check that 'routes' property
// cannot exist with 'domain' and 'host'
ClientRequests cfClient = cloudfoundry.client;
when(cfClient.getServices()).thenReturn(ImmutableList.of());
List<CFDomain> domains = ImmutableList.of(mockDomain("test.cfapps.io"));
when(cloudfoundry.client.getDomains()).thenReturn(domains);
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " host: foosite\n" + " domain: test.cfapps.io\n" + " routes:\n" + " - route: test.cfapps.io/path\n" + " services:\n" + " - bad-service\n");
editor.assertProblems(// These are the "fast" delayed constraints
"host|Property cannot co-exist with property 'routes'", "domain|Property cannot co-exist with property 'routes'", "routes|Property cannot co-exist with properties [domain, host]", // This is the "slow" delayed constraint
"bad-service|There is no service instance called");
}
Aggregations