Debug unit tests failure
This commit is contained in:
@@ -22,11 +22,9 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
import org.eclipse.lsp4j.CompletionItem;
|
import org.eclipse.lsp4j.CompletionItem;
|
||||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||||
@@ -43,9 +41,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level;
|
|
||||||
import ch.qos.logback.classic.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Martin Lippert
|
* @author Martin Lippert
|
||||||
*/
|
*/
|
||||||
@@ -54,25 +49,17 @@ import ch.qos.logback.classic.Logger;
|
|||||||
@Import(SymbolProviderTestConf.class)
|
@Import(SymbolProviderTestConf.class)
|
||||||
public class XMLBeanRefContentAssistTest {
|
public class XMLBeanRefContentAssistTest {
|
||||||
|
|
||||||
private static final org.slf4j.Logger log = LoggerFactory.getLogger(XMLBeanRefContentAssistTest.class);
|
|
||||||
|
|
||||||
@Autowired private BootLanguageServerHarness harness;
|
@Autowired private BootLanguageServerHarness harness;
|
||||||
@Autowired private JavaProjectFinder projectFinder;
|
@Autowired private JavaProjectFinder projectFinder;
|
||||||
@Autowired private SpringSymbolIndex indexer;
|
@Autowired private SpringSymbolIndex indexer;
|
||||||
|
|
||||||
private IJavaProject project;
|
private IJavaProject project;
|
||||||
private Level originalLevel;
|
|
||||||
private File directory;
|
private File directory;
|
||||||
|
|
||||||
private String tempJavaDocUri;
|
private String tempJavaDocUri;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
|
||||||
originalLevel = logger.getLevel();
|
|
||||||
logger.setLevel(Level.INFO);
|
|
||||||
|
|
||||||
log.info("-------------------------------------------------");
|
|
||||||
harness.intialize(null);
|
harness.intialize(null);
|
||||||
|
|
||||||
Map<String, Object> supportXML = new HashMap<>();
|
Map<String, Object> supportXML = new HashMap<>();
|
||||||
@@ -98,13 +85,6 @@ public class XMLBeanRefContentAssistTest {
|
|||||||
initProject.get(5, TimeUnit.SECONDS);
|
initProject.get(5, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
|
||||||
public void tearDown() {
|
|
||||||
log.debug("-------------------------------------------------");
|
|
||||||
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
|
||||||
logger.setLevel(originalLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSimpleBeanRefCompletion() throws Exception {
|
void testSimpleBeanRefCompletion() throws Exception {
|
||||||
Editor editor = harness.newEditor(LanguageId.XML, """
|
Editor editor = harness.newEditor(LanguageId.XML, """
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.springframework.ide.vscode.boot.xml.test;
|
package org.springframework.ide.vscode.boot.xml.test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -33,10 +35,12 @@ import org.springframework.context.annotation.Import;
|
|||||||
import org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp;
|
import org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp;
|
||||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||||
import org.springframework.ide.vscode.boot.bootiful.XmlBeansTestConf;
|
import org.springframework.ide.vscode.boot.bootiful.XmlBeansTestConf;
|
||||||
|
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||||
import org.springframework.ide.vscode.boot.java.utils.test.MockProjectObserver;
|
import org.springframework.ide.vscode.boot.java.utils.test.MockProjectObserver;
|
||||||
import org.springframework.ide.vscode.boot.test.DefinitionLinkAsserts;
|
import org.springframework.ide.vscode.boot.test.DefinitionLinkAsserts;
|
||||||
import org.springframework.ide.vscode.commons.languageserver.util.Settings;
|
import org.springframework.ide.vscode.commons.languageserver.util.Settings;
|
||||||
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
|
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
|
||||||
|
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||||
import org.springframework.ide.vscode.commons.util.UriUtil;
|
import org.springframework.ide.vscode.commons.util.UriUtil;
|
||||||
import org.springframework.ide.vscode.commons.util.text.LanguageId;
|
import org.springframework.ide.vscode.commons.util.text.LanguageId;
|
||||||
import org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf;
|
import org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf;
|
||||||
@@ -70,6 +74,7 @@ public class XMLBeansHyperlinkTest {
|
|||||||
@Autowired private SpringSymbolIndex indexer;
|
@Autowired private SpringSymbolIndex indexer;
|
||||||
@Autowired private DefinitionLinkAsserts definitionLinkAsserts;
|
@Autowired private DefinitionLinkAsserts definitionLinkAsserts;
|
||||||
@Autowired private MockProjectObserver projectObserver;
|
@Autowired private MockProjectObserver projectObserver;
|
||||||
|
@Autowired private SpringMetamodelIndex springIndex;
|
||||||
|
|
||||||
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
|
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
|
||||||
private MavenJavaProject project;
|
private MavenJavaProject project;
|
||||||
@@ -173,6 +178,12 @@ public class XMLBeansHyperlinkTest {
|
|||||||
@Test
|
@Test
|
||||||
// @Disabled
|
// @Disabled
|
||||||
void testBeanRefHyperlink() throws Exception {
|
void testBeanRefHyperlink() throws Exception {
|
||||||
|
Bean[] beans = springIndex.getBeansWithName(project.getElementName(), "simpleObj");
|
||||||
|
|
||||||
|
assertEquals(1, beans.length);
|
||||||
|
assertEquals("simpleObj", beans[0].getName());
|
||||||
|
assertEquals("u.t.r.SimpleObj", beans[0].getType());
|
||||||
|
|
||||||
log.debug("------------------ testBeanRefHyperlink ----------------------");
|
log.debug("------------------ testBeanRefHyperlink ----------------------");
|
||||||
Path xmlFilePath = Paths.get(project.getLocationUri()).resolve("beans.xml");
|
Path xmlFilePath = Paths.get(project.getLocationUri()).resolve("beans.xml");
|
||||||
Editor editor = harness.newEditor(LanguageId.XML,
|
Editor editor = harness.newEditor(LanguageId.XML,
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.CompletionItem;
|
import org.eclipse.lsp4j.CompletionItem;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration;
|
import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@@ -45,9 +43,6 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import ch.qos.logback.classic.Level;
|
|
||||||
import ch.qos.logback.classic.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Martin Lippert
|
* @author Martin Lippert
|
||||||
*/
|
*/
|
||||||
@@ -58,10 +53,7 @@ import ch.qos.logback.classic.Logger;
|
|||||||
})
|
})
|
||||||
@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
|
@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
|
||||||
public class XMLContentAssistTest {
|
public class XMLContentAssistTest {
|
||||||
|
|
||||||
|
|
||||||
private static final org.slf4j.Logger log = LoggerFactory.getLogger(XMLContentAssistTest.class);
|
|
||||||
|
|
||||||
@Autowired private BootLanguageServerHarness harness;
|
@Autowired private BootLanguageServerHarness harness;
|
||||||
@Autowired private SpringSymbolIndex indexer;
|
@Autowired private SpringSymbolIndex indexer;
|
||||||
@Autowired private MockProjectObserver projectObserver;
|
@Autowired private MockProjectObserver projectObserver;
|
||||||
@@ -69,16 +61,10 @@ public class XMLContentAssistTest {
|
|||||||
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
|
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
|
||||||
private MavenJavaProject project;
|
private MavenJavaProject project;
|
||||||
|
|
||||||
private Level originalLevel;
|
|
||||||
private int ALL_NAMESPACE_COMPLETIONS = NamespaceCompletionProvider.getNamespaces().length;
|
private int ALL_NAMESPACE_COMPLETIONS = NamespaceCompletionProvider.getNamespaces().length;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
public void setup() throws Exception {
|
public void setup() throws Exception {
|
||||||
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
|
||||||
originalLevel = logger.getLevel();
|
|
||||||
logger.setLevel(Level.INFO);
|
|
||||||
|
|
||||||
log.info("-------------------------------------------------");
|
|
||||||
harness.intialize(null);
|
harness.intialize(null);
|
||||||
|
|
||||||
Map<String, Object> supportXML = new HashMap<>();
|
Map<String, Object> supportXML = new HashMap<>();
|
||||||
@@ -103,13 +89,6 @@ public class XMLContentAssistTest {
|
|||||||
initProject.get(1500, TimeUnit.SECONDS);
|
initProject.get(1500, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
|
||||||
public void tearDown() {
|
|
||||||
log.debug("-------------------------------------------------");
|
|
||||||
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
|
||||||
logger.setLevel(originalLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testEmptyXMLFileCompletions() throws Exception {
|
void testEmptyXMLFileCompletions() throws Exception {
|
||||||
Editor editor = new Editor(harness, "<*>", LanguageId.XML);
|
Editor editor = new Editor(harness, "<*>", LanguageId.XML);
|
||||||
|
|||||||
Reference in New Issue
Block a user