use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ConcourseEditorTest method emptyInputPathWarning.
@Test
public void emptyInputPathWarning() throws Exception {
Editor editor = harness.newEditor(LanguageId.CONCOURSE_TASK, "platform: linux\n" + "run:\n" + " path: blah\n" + "inputs:\n" + "- name: foo\n" + " path: \"\"\n" + "outputs:\n" + "- name: bar\n" + " path: \"\"\n");
List<Diagnostic> problems = editor.assertProblems("\"\"|Empty optional String attribute is useless and can be omitted", "\"\"|Empty optional String attribute is useless and can be omitted");
for (Diagnostic problem : problems) {
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
}
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ConcourseEditorTest method githubUriReconciling.
@Test
public void githubUriReconciling() throws Exception {
when(github.getReposForOwner("the-owner")).thenReturn(ImmutableList.of("nice-repo", "cool-project", "good-stuff"));
when(github.getReposForOwner("owner-no-exist")).thenReturn(null);
String editorText = "resources:\n" + "- name: my-repo\n" + " type: git\n" + " source:\n" + " uri: $$github$$the-owner/cool-project.git\n" + "- name: other-repo\n" + " type: git\n" + " source:\n" + " uri: $$github$$the-owner/repo-no-exist.git\n" + "- name: different-repo\n" + " type: git\n" + " source:\n" + " uri: $$github$$owner-no-exist/who-cares.git\n";
for (String githubUriPrefix : GithubRepoContentAssistant.URI_PREFIXES) {
Editor editor = harness.newEditor(editorText.replace("$$github$$", githubUriPrefix));
editor.ignoreProblem(PipelineYmlSchemaProblems.UNUSED_RESOURCE);
List<Diagnostic> problems = editor.assertProblems("repo-no-exist|Repo not found: 'repo-no-exist'", "owner-no-exist|User or Organization not found: 'owner-no-exist'");
for (Diagnostic d : problems) {
assertEquals(DiagnosticSeverity.Warning, d.getSeverity());
}
}
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileHealthHttpEndPointIgnoredWarning.
@Test
public void reconcileHealthHttpEndPointIgnoredWarning() throws Exception {
Editor editor;
Diagnostic problem;
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: process\n" + " health-check-http-endpoint: /health");
editor.assertProblems("health-check-http-endpoint|This has no effect unless `health-check-type` is `http` (but it is currently set to `process`)");
editor = harness.newEditor("health-check-type: http\n" + "applications:\n" + "- name: my-app\n" + " health-check-http-endpoint: /health");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-http-endpoint: /health");
problem = editor.assertProblems("health-check-http-endpoint|This has no effect unless `health-check-type` is `http` (but it is currently set to `port`)").get(0);
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health");
editor.assertProblems();
editor = harness.newEditor("health-check-type: http\n" + "applications:\n" + "- name: my-app\n" + " health-check-type: process\n" + " health-check-http-endpoint: /health");
editor.assertProblems("health-check-http-endpoint|This has no effect unless `health-check-type` is `http` (but it is currently set to `process`)");
editor = harness.newEditor("health-check-http-endpoint: /health");
editor.assertProblems("health-check-http-endpoint|This has no effect unless `health-check-type` is `http` (but it is currently set to `port`)");
editor = harness.newEditor("health-check-type: process\n" + "health-check-http-endpoint: /health");
editor.assertProblems("health-check-http-endpoint|This has no effect unless `health-check-type` is `http` (but it is currently set to `process`)");
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileHealthHttpEndpointValidation.
@Test
public void reconcileHealthHttpEndpointValidation() throws Exception {
Editor editor;
Diagnostic problem;
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health/additionalpath");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health/applog.txt");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health?check=true");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /?check=true");
editor.assertProblems();
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint:");
problem = editor.assertProblems("|Path requires a value staring with '/'").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: health");
problem = editor.assertProblems("health|Path must start with a '/'").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: ?check=true");
problem = editor.assertProblems("?check=true|Path must start with a '/'").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: health/additionalpath");
problem = editor.assertProblems("health/additionalpath|Path must start with a '/'").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: http://health/additionalpath");
problem = editor.assertProblems("http://health/additionalpath|Path contains scheme").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: my-app\n" + " health-check-type: http\n" + " health-check-http-endpoint: /health/ additionalpath");
problem = editor.assertProblems("/health/ additionalpath|Illegal character in path").get(0);
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
}
use of org.eclipse.lsp4j.Diagnostic in project sts4 by spring-projects.
the class ManifestYamlEditorTest method reconcileRoute_Advanced.
@Test
public void reconcileRoute_Advanced() throws Exception {
ImmutableList<CFDomain> domains = ImmutableList.of(mockDomain("somedomain.com"));
when(cloudfoundry.client.getDomains()).thenReturn(domains);
Editor editor = harness.newEditor("applications:\n" + "- name: foo\n" + " routes:\n" + " - route: springsource.org:8765/path\n");
editor.assertProblems("springsource.org:8765/path|Unable to determine type of route");
Diagnostic problem = editor.assertProblem("springsource.org:8765/path");
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " routes:\n" + " - route: host.springsource.org:66000\n");
editor.assertProblems("66000|Invalid port");
problem = editor.assertProblem("66000");
assertEquals(DiagnosticSeverity.Error, problem.getSeverity());
editor = harness.newEditor("applications:\n" + "- name: foo\n" + " routes:\n" + " - route: host.springsource.org\n");
editor.assertProblems("springsource.org|Unknown 'Domain'. Valid domains are: [somedomain.com]");
problem = editor.assertProblem("springsource.org");
assertEquals(DiagnosticSeverity.Warning, problem.getSeverity());
}
Aggregations