Skip to content

Commit f1ba2b3

Browse files
committed
Debug unit tests failure
1 parent ff8ef14 commit f1ba2b3

File tree

3 files changed

+12
-42
lines changed

3 files changed

+12
-42
lines changed

headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/xml/test/XMLBeanRefContentAssistTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222

2323
import org.eclipse.lsp4j.CompletionItem;
2424
import org.eclipse.lsp4j.TextDocumentIdentifier;
25-
import org.junit.jupiter.api.AfterEach;
2625
import org.junit.jupiter.api.BeforeEach;
2726
import org.junit.jupiter.api.Test;
2827
import org.junit.jupiter.api.extension.ExtendWith;
29-
import org.slf4j.LoggerFactory;
3028
import org.springframework.beans.factory.annotation.Autowired;
3129
import org.springframework.context.annotation.Import;
3230
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
@@ -43,9 +41,6 @@
4341

4442
import com.google.gson.Gson;
4543

46-
import ch.qos.logback.classic.Level;
47-
import ch.qos.logback.classic.Logger;
48-
4944
/**
5045
* @author Martin Lippert
5146
*/
@@ -54,25 +49,17 @@
5449
@Import(SymbolProviderTestConf.class)
5550
public class XMLBeanRefContentAssistTest {
5651

57-
private static final org.slf4j.Logger log = LoggerFactory.getLogger(XMLBeanRefContentAssistTest.class);
58-
5952
@Autowired private BootLanguageServerHarness harness;
6053
@Autowired private JavaProjectFinder projectFinder;
6154
@Autowired private SpringSymbolIndex indexer;
6255

6356
private IJavaProject project;
64-
private Level originalLevel;
6557
private File directory;
6658

6759
private String tempJavaDocUri;
6860

6961
@BeforeEach
7062
public void setup() throws Exception {
71-
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
72-
originalLevel = logger.getLevel();
73-
logger.setLevel(Level.INFO);
74-
75-
log.info("-------------------------------------------------");
7663
harness.intialize(null);
7764

7865
Map<String, Object> supportXML = new HashMap<>();
@@ -98,13 +85,6 @@ public void setup() throws Exception {
9885
initProject.get(5, TimeUnit.SECONDS);
9986
}
10087

101-
@AfterEach
102-
public void tearDown() {
103-
log.debug("-------------------------------------------------");
104-
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
105-
logger.setLevel(originalLevel);
106-
}
107-
10888
@Test
10989
void testSimpleBeanRefCompletion() throws Exception {
11090
Editor editor = harness.newEditor(LanguageId.XML, """

headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/xml/test/XMLBeansHyperlinkTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*******************************************************************************/
1111
package org.springframework.ide.vscode.boot.xml.test;
1212

13+
import static org.junit.jupiter.api.Assertions.assertEquals;
14+
1315
import java.nio.file.Path;
1416
import java.nio.file.Paths;
1517
import java.util.Collections;
@@ -33,10 +35,12 @@
3335
import org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp;
3436
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
3537
import org.springframework.ide.vscode.boot.bootiful.XmlBeansTestConf;
38+
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
3639
import org.springframework.ide.vscode.boot.java.utils.test.MockProjectObserver;
3740
import org.springframework.ide.vscode.boot.test.DefinitionLinkAsserts;
3841
import org.springframework.ide.vscode.commons.languageserver.util.Settings;
3942
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
43+
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
4044
import org.springframework.ide.vscode.commons.util.UriUtil;
4145
import org.springframework.ide.vscode.commons.util.text.LanguageId;
4246
import org.springframework.ide.vscode.languageserver.starter.LanguageServerAutoConf;
@@ -70,6 +74,7 @@ public class XMLBeansHyperlinkTest {
7074
@Autowired private SpringSymbolIndex indexer;
7175
@Autowired private DefinitionLinkAsserts definitionLinkAsserts;
7276
@Autowired private MockProjectObserver projectObserver;
77+
@Autowired private SpringMetamodelIndex springIndex;
7378

7479
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
7580
private MavenJavaProject project;
@@ -173,6 +178,12 @@ void testBeanPropertyNameFromSuperClassHyperlink() throws Exception {
173178
@Test
174179
// @Disabled
175180
void testBeanRefHyperlink() throws Exception {
181+
Bean[] beans = springIndex.getBeansWithName(project.getElementName(), "simpleObj");
182+
183+
assertEquals(1, beans.length);
184+
assertEquals("simpleObj", beans[0].getName());
185+
assertEquals("u.t.r.SimpleObj", beans[0].getType());
186+
176187
log.debug("------------------ testBeanRefHyperlink ----------------------");
177188
Path xmlFilePath = Paths.get(project.getLocationUri()).resolve("beans.xml");
178189
Editor editor = harness.newEditor(LanguageId.XML,

headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/xml/test/XMLContentAssistTest.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
import java.util.concurrent.TimeUnit;
2121

2222
import org.eclipse.lsp4j.CompletionItem;
23-
import org.junit.jupiter.api.AfterEach;
2423
import org.junit.jupiter.api.BeforeEach;
2524
import org.junit.jupiter.api.Test;
26-
import org.slf4j.LoggerFactory;
2725
import org.springframework.beans.factory.annotation.Autowired;
2826
import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration;
2927
import org.springframework.boot.test.context.SpringBootTest;
@@ -45,9 +43,6 @@
4543

4644
import com.google.gson.Gson;
4745

48-
import ch.qos.logback.classic.Level;
49-
import ch.qos.logback.classic.Logger;
50-
5146
/**
5247
* @author Martin Lippert
5348
*/
@@ -58,27 +53,18 @@
5853
})
5954
@DirtiesContext(classMode=ClassMode.AFTER_EACH_TEST_METHOD)
6055
public class XMLContentAssistTest {
61-
62-
63-
private static final org.slf4j.Logger log = LoggerFactory.getLogger(XMLContentAssistTest.class);
64-
56+
6557
@Autowired private BootLanguageServerHarness harness;
6658
@Autowired private SpringSymbolIndex indexer;
6759
@Autowired private MockProjectObserver projectObserver;
6860

6961
private ProjectsHarness projects = ProjectsHarness.INSTANCE;
7062
private MavenJavaProject project;
7163

72-
private Level originalLevel;
7364
private int ALL_NAMESPACE_COMPLETIONS = NamespaceCompletionProvider.getNamespaces().length;
7465

7566
@BeforeEach
7667
public void setup() throws Exception {
77-
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
78-
originalLevel = logger.getLevel();
79-
logger.setLevel(Level.INFO);
80-
81-
log.info("-------------------------------------------------");
8268
harness.intialize(null);
8369

8470
Map<String, Object> supportXML = new HashMap<>();
@@ -103,13 +89,6 @@ public void setup() throws Exception {
10389
initProject.get(1500, TimeUnit.SECONDS);
10490
}
10591

106-
@AfterEach
107-
public void tearDown() {
108-
log.debug("-------------------------------------------------");
109-
final Logger logger = (Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
110-
logger.setLevel(originalLevel);
111-
}
112-
11392
@Test
11493
void testEmptyXMLFileCompletions() throws Exception {
11594
Editor editor = new Editor(harness, "<*>", LanguageId.XML);

0 commit comments

Comments
 (0)