use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain in project sts4 by spring-projects.
the class ManifestYamlEditorTest method domainReconcile.
@Test
public void domainReconcile() throws Exception {
List<CFDomain> domains = ImmutableList.of(mockDomain("one.com"), mockDomain("two.com"));
when(cloudfoundry.client.getDomains()).thenReturn(domains);
Editor editor;
Diagnostic p;
editor = harness.newEditor("domain: bad.com");
p = editor.assertProblems("bad.com|unknown 'Domain'. Valid values are: [one.com, two.com]").get(0);
assertEquals(DiagnosticSeverity.Warning, p.getSeverity());
editor = harness.newEditor("domains:\n" + "- one.com\n" + "- bad.com\n" + "- two.com");
editor.assertProblems("bad.com|unknown 'Domain'. Valid values are: [one.com, two.com]");
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain in project sts4 by spring-projects.
the class ManifestYamlEditorTest method mockDomain.
private CFDomain mockDomain(String name) {
CFDomain domain = mock(CFDomain.class);
when(domain.getName()).thenReturn(name);
return domain;
}
use of org.springframework.ide.vscode.commons.cloudfoundry.client.CFDomain 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.CFDomain 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