GH-1041: removed outdated beans addon symbol information, now fully replaced with new spring index
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.beans;
|
||||
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class BeansSymbolAddOnInformation implements SymbolAddOnInformation {
|
||||
|
||||
private final String beanID;
|
||||
private final String beanType;
|
||||
|
||||
public BeansSymbolAddOnInformation(String beanID, String beanType) {
|
||||
this.beanID = beanID;
|
||||
this.beanType = beanType;
|
||||
}
|
||||
|
||||
public String getBeanID() {
|
||||
return beanID;
|
||||
}
|
||||
|
||||
public String getBeanType() {
|
||||
return beanType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
|
||||
import org.springframework.ide.vscode.boot.java.utils.FunctionUtils;
|
||||
@@ -87,7 +86,7 @@ public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
beanLabel(isFunction, nameAndRegion.getT1(), beanType.getName(), "@Bean" + markerString),
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(location)),
|
||||
new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(nameAndRegion.getT1(), beanType.getQualifiedName())}
|
||||
null
|
||||
);
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(method, doc);
|
||||
@@ -121,7 +120,7 @@ public class BeansSymbolProvider extends AbstractSymbolProvider {
|
||||
Either.forLeft(new Location(doc.getUri(), doc.toRange(functionBean.getT3()))));
|
||||
|
||||
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(),
|
||||
new EnhancedSymbolInformation(symbol, new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(functionBean.getT1(), functionBean.getT2().getQualifiedName())})));
|
||||
new EnhancedSymbolInformation(symbol, null)));
|
||||
|
||||
} catch (BadLocationException e) {
|
||||
log.error("", e);
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
|
||||
import org.springframework.ide.vscode.boot.java.utils.DefaultSymbolProvider;
|
||||
@@ -93,8 +92,6 @@ public class ComponentSymbolProvider extends AbstractSymbolProvider {
|
||||
boolean isConfiguration = Annotations.CONFIGURATION.equals(annotationType.getQualifiedName())
|
||||
|| metaAnnotations.stream().anyMatch(t -> Annotations.CONFIGURATION.equals(t.getQualifiedName()));
|
||||
|
||||
SymbolAddOnInformation[] addon = new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(beanName, beanType.getQualifiedName())};
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(type, doc);
|
||||
|
||||
Set<String> supertypes = new HashSet<>();
|
||||
@@ -111,7 +108,7 @@ public class ComponentSymbolProvider extends AbstractSymbolProvider {
|
||||
|
||||
Bean beanDefinition = new Bean(beanName, beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, isConfiguration);
|
||||
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, addon), beanDefinition);
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
|
||||
}
|
||||
|
||||
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
|
||||
@@ -82,8 +81,6 @@ public class FeignClientSymbolProvider extends AbstractSymbolProvider {
|
||||
beanLabel("+", annotationTypeName, metaAnnotationNames, beanName, beanType == null ? "" : beanType.getName()), SymbolKind.Interface,
|
||||
Either.forLeft(location));
|
||||
|
||||
SymbolAddOnInformation[] addon = new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(beanName, beanType == null ? "" : beanType.getQualifiedName())};
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(type, doc);
|
||||
|
||||
Set<String> supertypes = new HashSet<>();
|
||||
@@ -100,7 +97,7 @@ public class FeignClientSymbolProvider extends AbstractSymbolProvider {
|
||||
|
||||
Bean beanDefinition = new Bean(beanName, beanType == null ? "" : beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, false);
|
||||
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, addon), beanDefinition);
|
||||
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
|
||||
}
|
||||
|
||||
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {
|
||||
|
||||
@@ -24,11 +24,9 @@ import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeanUtils;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.beans.CachedBean;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.AbstractSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
|
||||
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
|
||||
@@ -65,8 +63,7 @@ public class DataRepositorySymbolProvider extends AbstractSymbolProvider {
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(location));
|
||||
|
||||
SymbolAddOnInformation[] addon = new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(repositoryBean.getT1(), repositoryBean.getT2().getQualifiedName())};
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, addon);
|
||||
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
|
||||
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(typeDeclaration, doc);
|
||||
|
||||
|
||||
@@ -38,10 +38,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.index.cache.IndexCache;
|
||||
import org.springframework.ide.vscode.boot.index.cache.IndexCacheKey;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeanUtils;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.commons.java.IClasspathUtil;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.java.Classpath;
|
||||
@@ -123,9 +121,7 @@ public class SpringFactoriesIndexer implements SpringIndexer {
|
||||
symbols.add(new EnhancedSymbolInformation(new WorkspaceSymbol(
|
||||
BeansSymbolProvider.beanLabel(false, beanId, fqName, Paths.get(URI.create(docURI)).getFileName().toString()),
|
||||
SymbolKind.Interface,
|
||||
Either.forLeft(new Location(docURI, range))), new SymbolAddOnInformation[] {
|
||||
new BeansSymbolAddOnInformation(beanId, fqName)
|
||||
}));
|
||||
Either.forLeft(new Location(docURI, range))), null));
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SpringIndexerJava implements SpringIndexer {
|
||||
|
||||
// whenever the implementation of the indexer changes in a way that the stored data in the cache is no longer valid,
|
||||
// we need to change the generation - this will result in a re-indexing due to no up-to-date cache data being found
|
||||
private static final String GENERATION = "GEN-10";
|
||||
private static final String GENERATION = "GEN-11";
|
||||
private static final String INDEX_FILES_TASK_ID = "index-java-source-files-task-";
|
||||
|
||||
private static final String SYMBOL_KEY = "symbols";
|
||||
|
||||
@@ -21,10 +21,8 @@ import org.eclipse.lsp4j.SymbolKind;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeanUtils;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.beans.CachedBean;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.util.text.TextDocument;
|
||||
@@ -94,9 +92,7 @@ public class SpringIndexerXMLNamespaceHandlerBeans implements SpringIndexerXMLNa
|
||||
}
|
||||
|
||||
WorkspaceSymbol symbol = new WorkspaceSymbol("@+ '" + beanID + "' " + beanClass, SymbolKind.Interface, Either.forLeft(new Location(docURI, range)));
|
||||
SymbolAddOnInformation[] addon = new SymbolAddOnInformation[] {new BeansSymbolAddOnInformation(beanID, fqBeanClass)};
|
||||
|
||||
EnhancedSymbolInformation fullSymbol = new EnhancedSymbolInformation(symbol, addon);
|
||||
EnhancedSymbolInformation fullSymbol = new EnhancedSymbolInformation(symbol, null);
|
||||
|
||||
CachedSymbol cachedSymbol = new CachedSymbol(docURI, lastModified, fullSymbol);
|
||||
generatedSymbols.add(cachedSymbol);
|
||||
|
||||
@@ -13,7 +13,7 @@ package org.springframework.ide.vscode.boot.java.beans.test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -26,9 +26,9 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.SymbolProviderTestConf;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
@@ -43,9 +43,10 @@ public class SpringIndexerBeansTest {
|
||||
|
||||
@Autowired private BootLanguageServerHarness harness;
|
||||
@Autowired private JavaProjectFinder projectFinder;
|
||||
@Autowired private SpringSymbolIndex indexer;
|
||||
@Autowired private SpringMetamodelIndex springIndex;
|
||||
|
||||
private File directory;
|
||||
@Autowired private SpringSymbolIndex indexer;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
@@ -69,19 +70,15 @@ public class SpringIndexerBeansTest {
|
||||
SpringIndexerHarness.symbol("@Configuration", "@+ 'simpleConfiguration' (@Configuration <: @Component) SimpleConfiguration"),
|
||||
SpringIndexerHarness.symbol("@Bean", "@+ 'simpleBean' (@Bean) BeanClass")
|
||||
);
|
||||
|
||||
List<? extends SymbolAddOnInformation> addon = indexer.getAdditonalInformation(docUri);
|
||||
assertEquals(2, addon.size());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "simpleConfiguration".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "simpleBean".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
Bean[] beans = springIndex.getBeansOfDocument(docUri);
|
||||
assertEquals(2, beans.length);
|
||||
|
||||
Bean simpleConfigBean = Arrays.stream(beans).filter(bean -> bean.getName().equals("simpleConfiguration")).findFirst().get();
|
||||
Bean simpleBean = Arrays.stream(beans).filter(bean -> bean.getName().equals("simpleBean")).findFirst().get();
|
||||
|
||||
assertEquals("org.test.SimpleConfiguration", simpleConfigBean.getType());
|
||||
assertEquals("org.test.BeanClass", simpleBean.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.beans.test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
@@ -26,9 +26,9 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.SymbolProviderTestConf;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
@@ -44,6 +44,7 @@ public class SpringIndexerFunctionBeansTest {
|
||||
@Autowired private BootLanguageServerHarness harness;
|
||||
@Autowired private SpringSymbolIndex indexer;
|
||||
@Autowired private JavaProjectFinder projectFinder;
|
||||
@Autowired private SpringMetamodelIndex springIndex;
|
||||
|
||||
private File directory;
|
||||
|
||||
@@ -70,18 +71,14 @@ public class SpringIndexerFunctionBeansTest {
|
||||
SpringIndexerHarness.symbol("@Bean", "@> 'uppercase' (@Bean) Function<String,String>")
|
||||
);
|
||||
|
||||
List<? extends SymbolAddOnInformation> addon = indexer.getAdditonalInformation(docUri);
|
||||
assertEquals(2, addon.size());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "functionClass".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "uppercase".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
Bean[] beans = springIndex.getBeansOfDocument(docUri);
|
||||
assertEquals(2, beans.length);
|
||||
|
||||
Bean configBean = Arrays.stream(beans).filter(bean -> bean.getName().equals("functionClass")).findFirst().get();
|
||||
Bean functionBean = Arrays.stream(beans).filter(bean -> bean.getName().equals("uppercase")).findFirst().get();
|
||||
|
||||
assertEquals("org.test.FunctionClass", configBean.getType());
|
||||
assertEquals("java.util.function.Function<java.lang.String,java.lang.String>", functionBean.getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -19,6 +19,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -29,9 +30,9 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.SymbolProviderTestConf;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
@@ -47,6 +48,7 @@ public class DataRepositorySymbolProviderTest {
|
||||
@Autowired private BootLanguageServerHarness harness;
|
||||
@Autowired private JavaProjectFinder projectFinder;
|
||||
@Autowired private SpringSymbolIndex indexer;
|
||||
@Autowired private SpringMetamodelIndex springIndex;
|
||||
|
||||
private File directory;
|
||||
|
||||
@@ -71,10 +73,14 @@ public class DataRepositorySymbolProviderTest {
|
||||
assertEquals(1, symbols.size());
|
||||
assertTrue(containsSymbol(symbols, "@+ 'customerRepository' (Customer) Repository<Customer,Long>", docUri, 6, 17, 6, 35));
|
||||
|
||||
List<? extends SymbolAddOnInformation> addon = indexer.getAdditonalInformation(docUri);
|
||||
assertEquals(1, addon.size());
|
||||
|
||||
assertEquals("customerRepository", ((BeansSymbolAddOnInformation) addon.get(0)).getBeanID());
|
||||
Bean[] repoBean = this.springIndex.getBeansWithName("test-spring-data-symbols", "customerRepository");
|
||||
assertEquals(1, repoBean.length);
|
||||
assertEquals("customerRepository", repoBean[0].getName());
|
||||
assertEquals("org.test.CustomerRepository", repoBean[0].getType());
|
||||
|
||||
Bean[] matchingBeans = springIndex.getMatchingBeans("test-spring-data-symbols", "org.springframework.data.repository.CrudRepository");
|
||||
assertEquals(2, matchingBeans.length);
|
||||
ArrayUtils.contains(matchingBeans, repoBean[0]);
|
||||
}
|
||||
|
||||
private boolean containsSymbol(List<? extends WorkspaceSymbol> symbols, String name, String uri, int startLine, int startCHaracter, int endLine, int endCharacter) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2024 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
@@ -31,10 +31,11 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest;
|
||||
import org.springframework.ide.vscode.boot.bootiful.SymbolProviderTestConf;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.requestmapping.WebfluxHandlerInformation;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
@@ -47,14 +48,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
@Import(SymbolProviderTestConf.class)
|
||||
public class WebFluxMappingSymbolProviderTest {
|
||||
|
||||
@Autowired
|
||||
private BootLanguageServerHarness harness;
|
||||
|
||||
@Autowired
|
||||
private SpringSymbolIndex indexer;
|
||||
|
||||
@Autowired
|
||||
JavaProjectFinder projectFinder;
|
||||
@Autowired private BootLanguageServerHarness harness;
|
||||
@Autowired private SpringSymbolIndex indexer;
|
||||
@Autowired private JavaProjectFinder projectFinder;
|
||||
@Autowired private SpringMetamodelIndex springIndex;
|
||||
|
||||
private File directory;
|
||||
|
||||
@@ -79,9 +76,10 @@ public class WebFluxMappingSymbolProviderTest {
|
||||
assertTrue(containsSymbol(symbols, "@/users -- GET - Content-Type: application/json", docUri, 13, 1, 13, 74));
|
||||
assertTrue(containsSymbol(symbols, "@/users/{username} -- GET - Content-Type: application/json", docUri, 18, 1, 18, 85));
|
||||
|
||||
List<? extends SymbolAddOnInformation> addon = indexer.getAdditonalInformation(docUri);
|
||||
assertEquals(1, addon.size());
|
||||
assertEquals("userController", ((BeansSymbolAddOnInformation) addon.get(0)).getBeanID());
|
||||
Bean[] beans = springIndex.getBeansOfDocument(docUri);
|
||||
assertEquals(1, beans.length);
|
||||
assertEquals("userController", beans[0].getName());
|
||||
assertEquals("org.test.UserController", beans[0].getType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -30,8 +30,6 @@ import org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp;
|
||||
import org.springframework.ide.vscode.boot.app.SpringSymbolIndex;
|
||||
import org.springframework.ide.vscode.boot.bootiful.XmlBeansTestConf;
|
||||
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
|
||||
import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SymbolIndexConfig;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
@@ -92,37 +90,9 @@ public class SpringIndexerXMLProjectTest {
|
||||
assertTrue(SpringIndexerTest.containsSymbol(allSymbols, "@+ 'namedParameterJdbcTemplate' NamedParameterJdbcTemplate", docUri, 12, 14, 12, 45));
|
||||
assertTrue(SpringIndexerTest.containsSymbol(allSymbols, "@+ 'persistenceExceptionTranslationPostProcessor' PersistenceExceptionTranslationPostProcessor", docUri, 18, 10, 18, 97));
|
||||
|
||||
List<? extends SymbolAddOnInformation> addon = symbolIndex.getAdditonalInformation(docUri);
|
||||
assertEquals(4, addon.size());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "transactionManager".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "jdbcTemplate".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "namedParameterJdbcTemplate".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
assertEquals(1, addon.stream()
|
||||
.filter(info -> info instanceof BeansSymbolAddOnInformation)
|
||||
.filter(info -> "persistenceExceptionTranslationPostProcessor".equals(((BeansSymbolAddOnInformation) info).getBeanID()))
|
||||
.count());
|
||||
|
||||
|
||||
String beansOnClasspathDocUri = directory.toPath().resolve("src/main/resources/beans.xml").toUri().toString();
|
||||
assertTrue(SpringIndexerTest.containsSymbol(allSymbols, "@+ 'sb' SimpleBean", beansOnClasspathDocUri, 6, 14, 6, 21));
|
||||
|
||||
addon = symbolIndex.getAdditonalInformation(beansOnClasspathDocUri);
|
||||
assertEquals(1, addon.size());
|
||||
assertEquals("sb", ((BeansSymbolAddOnInformation) addon.get(0)).getBeanID());
|
||||
|
||||
Bean[] beans = springIndex.getBeansOfProject("test-annotation-indexing-xml-project");
|
||||
assertEquals(5, beans.length);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user