Modulith support
This commit is contained in:
@@ -36,6 +36,7 @@ public class SpringMetamodelIndexTest {
|
||||
|
||||
private InjectionPoint[] emptyInjectionPoints = new InjectionPoint[0];
|
||||
private String[] emptySupertypes = new String[0];
|
||||
private String[] emptyAnnotations = new String[0];
|
||||
|
||||
private Location locationForDoc1 = new Location("docURI1", new Range(new Position(1, 1), new Position(1, 10)));
|
||||
private Location locationForDoc2 = new Location("docURI2", new Range(new Position(2, 1), new Position(2, 10)));
|
||||
@@ -50,9 +51,9 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testSimpleProjectWithBeansPerProject() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2, bean3});
|
||||
|
||||
@@ -65,7 +66,7 @@ public class SpringMetamodelIndexTest {
|
||||
assertTrue(beansList.contains(bean2));
|
||||
assertTrue(beansList.contains(bean3));
|
||||
|
||||
Bean anotherBean = new Bean("anotherBean", "beanType", null, emptyInjectionPoints, emptySupertypes);
|
||||
Bean anotherBean = new Bean("anotherBean", "beanType", null, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
assertFalse(beansList.contains(anotherBean));
|
||||
}
|
||||
@@ -73,9 +74,9 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testSimpleProjectWithBeansPerDocument() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanWithDifferentName", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanWithDifferentName", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2, bean3});
|
||||
|
||||
@@ -100,9 +101,9 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testSimpleProjectWithBeansPerName() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanWithDifferentName", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanWithDifferentName", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2, bean3});
|
||||
|
||||
@@ -121,15 +122,15 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testUpdateBeansForSpecificDoc() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", locationForDoc1.getUri(), new Bean[] {bean1, bean2});
|
||||
index.updateBeans("someProject", locationForDoc2.getUri(), new Bean[] {bean3});
|
||||
|
||||
Bean updatedBean1 = new Bean("updated1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean updatedBean2 = new Bean("updated2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean updatedBean1 = new Bean("updated1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean updatedBean2 = new Bean("updated2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", locationForDoc1.getUri(), new Bean[] {updatedBean1, updatedBean2});
|
||||
|
||||
@@ -145,19 +146,19 @@ public class SpringMetamodelIndexTest {
|
||||
assertFalse(beansList.contains(bean1));
|
||||
assertFalse(beansList.contains(bean2));
|
||||
|
||||
Bean anotherBean = new Bean("anotherBean", "beanType", null, emptyInjectionPoints, emptySupertypes);
|
||||
Bean anotherBean = new Bean("anotherBean", "beanType", null, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
assertFalse(beansList.contains(anotherBean));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testUpdateAllBeansForSpecificProject() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2});
|
||||
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean3});
|
||||
|
||||
@@ -174,9 +175,9 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testRemoveAllBeansForSpecificProject() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject1", new Bean[] {bean1, bean2});
|
||||
index.updateBeans("someProject2", new Bean[] {bean3});
|
||||
@@ -198,9 +199,9 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testRemoveAllBeansForSpecificDocument() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean3 = new Bean("beanName3", "beanType", locationForDoc2, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2, bean3});
|
||||
index.removeBeans("someProject", locationForDoc1.getUri());
|
||||
@@ -220,7 +221,7 @@ public class SpringMetamodelIndexTest {
|
||||
InjectionPoint point1 = new InjectionPoint("point1", "point1-type", locationForDoc2);
|
||||
InjectionPoint point2 = new InjectionPoint("point2", "point2-type", locationForDoc1);
|
||||
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, new InjectionPoint[] {point1, point2}, new String[] {"supertype1", "supertype2"});
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, new InjectionPoint[] {point1, point2}, new String[] {"supertype1", "supertype2"}, emptyAnnotations);
|
||||
String serialized = bean1.toString();
|
||||
|
||||
Gson gson = SymbolCacheOnDisc.createGson();
|
||||
@@ -248,7 +249,7 @@ public class SpringMetamodelIndexTest {
|
||||
|
||||
@Test
|
||||
void testEmptyInjectionPointsOptimizationWithSerializeDeserializeBeans() {
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
String serialized = bean1.toString();
|
||||
|
||||
Gson gson = SymbolCacheOnDisc.createGson();
|
||||
@@ -263,15 +264,15 @@ public class SpringMetamodelIndexTest {
|
||||
|
||||
@Test
|
||||
void testEmptyInjectionPointsOptimization() {
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
assertSame(DefaultValues.EMPTY_INJECTION_POINTS, bean1.getInjectionPoints());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindNoMatchingBeansWithEmptySupertypes() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes);
|
||||
Bean bean1 = new Bean("beanName1", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType", locationForDoc1, emptyInjectionPoints, emptySupertypes, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2});
|
||||
|
||||
@@ -285,8 +286,8 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testFindMatchingBeansWithOneProject() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"});
|
||||
Bean bean2 = new Bean("beanName2", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4", "supertype5"});
|
||||
Bean bean1 = new Bean("beanName1", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"}, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4", "supertype5"}, emptyAnnotations);
|
||||
|
||||
index.updateBeans("someProject", new Bean[] {bean1, bean2});
|
||||
|
||||
@@ -312,11 +313,11 @@ public class SpringMetamodelIndexTest {
|
||||
@Test
|
||||
void testFindMatchingBeansWithMultipleProjects() {
|
||||
SpringMetamodelIndex index = new SpringMetamodelIndex();
|
||||
Bean bean1 = new Bean("beanName1", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"});
|
||||
Bean bean2 = new Bean("beanName2", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4, supertype5"});
|
||||
Bean bean1 = new Bean("beanName1", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"}, emptyAnnotations);
|
||||
Bean bean2 = new Bean("beanName2", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4, supertype5"}, emptyAnnotations);
|
||||
|
||||
Bean bean3 = new Bean("beanName3", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"});
|
||||
Bean bean4 = new Bean("beanName4", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4, supertype5"});
|
||||
Bean bean3 = new Bean("beanName3", "beanType1", locationForDoc1, emptyInjectionPoints, new String[] {"supertype1", "supertype2"}, emptyAnnotations);
|
||||
Bean bean4 = new Bean("beanName4", "beanType2", locationForDoc1, emptyInjectionPoints, new String[] {"supertype3", "supertype4, supertype5"}, emptyAnnotations);
|
||||
|
||||
index.updateBeans("projectA", new Bean[] {bean1, bean2});
|
||||
index.updateBeans("projectB", new Bean[] {bean3, bean4});
|
||||
|
||||
Reference in New Issue
Block a user