-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test use XMLLangugeService instead of a connection
+ Enable tests in CI Signed-off-by: Mickael Istria <mistria@redhat.com>
- Loading branch information
1 parent
284d629
commit 58b9cb9
Showing
11 changed files
with
206 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
lemminx-maven/src/test/java/org/eclipse/lemminx/maven/test/ClientServerConnection.java
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
lemminx-maven/src/test/java/org/eclipse/lemminx/maven/test/LocalPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019-2020 Red Hat Inc. and others. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.lemminx.maven.test; | ||
|
||
import static org.eclipse.lemminx.maven.test.MavenLemminxTestsUtils.createDOMDocument; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.TimeoutException; | ||
|
||
import org.eclipse.lemminx.services.XMLLanguageService; | ||
import org.eclipse.lemminx.settings.SharedSettings; | ||
import org.eclipse.lemminx.settings.XMLHoverSettings; | ||
import org.eclipse.lsp4j.CompletionItem; | ||
import org.eclipse.lsp4j.Position; | ||
import org.eclipse.lsp4j.TextEdit; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
public class LocalPluginTest { | ||
|
||
@Rule public NoMavenCentralIndexTestRule rule = new NoMavenCentralIndexTestRule(); | ||
|
||
private XMLLanguageService languageService; | ||
|
||
@Before | ||
public void setUp() throws IOException { | ||
languageService = new XMLLanguageService(); | ||
} | ||
|
||
@After | ||
public void tearDown() throws InterruptedException, ExecutionException { | ||
languageService.dispose(); | ||
languageService = null; | ||
} | ||
|
||
// Completion related tests | ||
|
||
@Test(timeout=15000) | ||
public void testCompleteGoal() throws IOException, InterruptedException, ExecutionException, URISyntaxException { | ||
assertTrue(languageService.doComplete(createDOMDocument("/pom-complete-plugin-goal.xml", languageService), | ||
new Position(18, 19), new SharedSettings()) | ||
.getItems().stream().map(CompletionItem::getTextEdit).map(TextEdit::getNewText).anyMatch("test"::equals)); | ||
} | ||
|
||
@Test(timeout=15000) | ||
public void testCompleteConfigurationParameters() throws IOException, InterruptedException, ExecutionException, URISyntaxException { | ||
assertTrue(languageService.doComplete(createDOMDocument("/pom-complete-plugin-goal.xml", languageService), | ||
new Position(23, 7), new SharedSettings()) | ||
.getItems().stream().map(CompletionItem::getLabel).anyMatch("failIfNoTests"::equals)); | ||
} | ||
|
||
@Test(timeout=15000) | ||
public void testCompleteConfigurationParametersInTag() throws IOException, InterruptedException, ExecutionException, URISyntaxException { | ||
assertTrue(languageService.doComplete(createDOMDocument("/pom-plugin-config-tag.xml", languageService), | ||
new Position(20, 9), new SharedSettings()) | ||
.getItems().stream().map(CompletionItem::getLabel).anyMatch("failIfNoTests"::equals)); | ||
} | ||
|
||
// Hover related tests | ||
|
||
@Test(timeout=15000) | ||
public void testPluginConfigurationHover() throws IOException, InterruptedException, ExecutionException, URISyntaxException { | ||
assertTrue(languageService.doHover(createDOMDocument("/pom-plugin-configuration-hover.xml", languageService), | ||
new Position(15, 5), new XMLHoverSettings()).getContents().getRight().getValue().contains("The -source argument for the Java compiler.")); | ||
} | ||
|
||
@Test(timeout=15000) | ||
public void testPluginGoalHover() throws IOException, InterruptedException, ExecutionException, URISyntaxException { | ||
assertTrue(languageService.doHover(createDOMDocument("/pom-plugin-goal-hover.xml", languageService), | ||
new Position(18, 22), new XMLHoverSettings()).getContents().getRight().getValue().contains("Run tests using Surefire.")); | ||
} | ||
|
||
@Test(timeout=15000) | ||
public void testPluginArtifactHover() throws IOException, InterruptedException, ExecutionException, URISyntaxException, TimeoutException { | ||
assertTrue(languageService.doHover(createDOMDocument("/pom-plugin-artifact-hover.xml", languageService), | ||
new Position(14, 18), new XMLHoverSettings()).getContents().getRight().getValue().contains("Maven Surefire MOJO in maven-surefire-plugin")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.