Search in sources :

Example 6 with LanguageServerHarness

use of org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness in project sts4 by spring-projects.

the class ManifestYamlEditorTest method reconcileRunsOnDocumentOpenAndChange.

@Test
public void reconcileRunsOnDocumentOpenAndChange() throws Exception {
    LanguageServerHarness harness = new LanguageServerHarness(ManifestYamlLanguageServer::new, LanguageId.CF_MANIFEST);
    harness.intialize(null);
    Editor editor = harness.newEditor("somemap: val\n" + "- sequence");
    editor.assertProblems("-|expected <block end>");
    editor.setText("- sequence\n" + "zomemap: val");
    editor.assertProblems("z|expected <block end>");
}
Also used : LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) Editor(org.springframework.ide.vscode.languageserver.testharness.Editor) Test(org.junit.Test)

Example 7 with LanguageServerHarness

use of org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness in project sts4 by spring-projects.

the class ManifestYamlLanguageServerTest method changeCfClientParams.

@Test
public void changeCfClientParams() throws Exception {
    MockCloudfoundry cloudfoundry = new MockCloudfoundry();
    ManifestYamlLanguageServer manifestYamlLanguageServer = new ManifestYamlLanguageServer(cloudfoundry.factory, cloudfoundry.defaultParamsProvider);
    LanguageServerHarness harness = new LanguageServerHarness(() -> manifestYamlLanguageServer, LanguageId.CF_MANIFEST);
    harness.intialize(null);
    assertEquals(1, manifestYamlLanguageServer.getCfClientConfig().getClientParamsProvider().getParams().size());
    assertEquals(Arrays.asList("test.io"), manifestYamlLanguageServer.getCfTargets());
    DidChangeConfigurationParams params = new DidChangeConfigurationParams();
    JsonParser parser = new JsonParser();
    params.setSettings(parser.parse(new InputStreamReader(getClass().getResourceAsStream("/cf-targets1.json"))));
    manifestYamlLanguageServer.getWorkspaceService().didChangeConfiguration(params);
    assertEquals(3, manifestYamlLanguageServer.getCfClientConfig().getClientParamsProvider().getParams().size());
    assertEquals(Arrays.asList("test.io", "api.system.demo-gcp.springapps.io", "api.run.pivotal.io"), manifestYamlLanguageServer.getCfTargets());
}
Also used : InputStreamReader(java.io.InputStreamReader) LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams) JsonParser(com.google.gson.JsonParser) Test(org.junit.Test)

Example 8 with LanguageServerHarness

use of org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness in project sts4 by spring-projects.

the class ManifestYamlLanguageServerTest method createAndInitializeServerWithWorkspace.

@Test
public void createAndInitializeServerWithWorkspace() throws Exception {
    LanguageServerHarness harness = new LanguageServerHarness(ManifestYamlLanguageServer::new);
    File workspaceRoot = getTestResource("/workspace/");
    assertExpectedInitResult(harness.intialize(workspaceRoot));
}
Also used : LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) File(java.io.File) Test(org.junit.Test)

Example 9 with LanguageServerHarness

use of org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness in project sts4 by spring-projects.

the class ConcourseLanguageServerTest method createAndInitializeServerWithoutWorkspace.

@Test
public void createAndInitializeServerWithoutWorkspace() throws Exception {
    File workspaceRoot = null;
    LanguageServerHarness harness = new LanguageServerHarness(() -> new ConcourseLanguageServer(TEST_DEFAULT, Mockito.mock(GithubInfoProvider.class)));
    assertExpectedInitResult(harness.intialize(workspaceRoot));
}
Also used : ConcourseLanguageServer(org.springframework.ide.vscode.concourse.ConcourseLanguageServer) LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) File(java.io.File) Test(org.junit.Test)

Example 10 with LanguageServerHarness

use of org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness in project sts4 by spring-projects.

the class ConcourseLanguageServerTest method createAndInitializeServerWithWorkspace.

@Test
public void createAndInitializeServerWithWorkspace() throws Exception {
    LanguageServerHarness harness = new LanguageServerHarness(() -> new ConcourseLanguageServer(TEST_DEFAULT, Mockito.mock(GithubInfoProvider.class)));
    File workspaceRoot = getTestResource("/workspace/");
    assertExpectedInitResult(harness.intialize(workspaceRoot));
}
Also used : ConcourseLanguageServer(org.springframework.ide.vscode.concourse.ConcourseLanguageServer) LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) File(java.io.File) Test(org.junit.Test)

Aggregations

LanguageServerHarness (org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness)10 Test (org.junit.Test)8 File (java.io.File)6 Before (org.junit.Before)2 MockCloudConfigProvider (org.springframework.ide.vscode.bosh.mocks.MockCloudConfigProvider)2 ConcourseLanguageServer (org.springframework.ide.vscode.concourse.ConcourseLanguageServer)2 JsonParser (com.google.gson.JsonParser)1 InputStreamReader (java.io.InputStreamReader)1 DidChangeConfigurationParams (org.eclipse.lsp4j.DidChangeConfigurationParams)1 LanguageId (org.springframework.ide.vscode.commons.util.text.LanguageId)1 Editor (org.springframework.ide.vscode.languageserver.testharness.Editor)1