From 1471c671a38c8c05f725e6c3d91a37b6c86b16ca Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Tue, 17 Oct 2023 13:36:55 +0200 Subject: [PATCH] HSEARCH-3654 Update Nested tests to work on JDK11 --- .../search/predicate/AndPredicateBaseIT.java | 40 +++-- .../search/predicate/BoolPredicateBaseIT.java | 21 ++- .../predicate/ExistsPredicateBaseIT.java | 113 +++++++----- .../ExistsPredicateObjectsBaseIT.java | 28 +-- .../predicate/MatchAllPredicateBaseIT.java | 38 ++-- .../predicate/MatchIdPredicateBaseIT.java | 37 ++-- .../predicate/MatchPredicateBaseIT.java | 159 ++++++++++------ .../search/predicate/NotPredicateBaseIT.java | 13 +- .../search/predicate/OrPredicateBaseIT.java | 41 +++-- .../predicate/PhrasePredicateBaseIT.java | 137 +++++++++----- .../predicate/RangePredicateBaseIT.java | 159 ++++++++++------ .../predicate/RegexpPredicateBaseIT.java | 115 ++++++++---- .../SimpleQueryStringPredicateBaseIT.java | 137 +++++++++----- ...atialWithinBoundingBoxPredicateBaseIT.java | 143 +++++++++------ .../SpatialWithinCirclePredicateBaseIT.java | 169 +++++++++++------- .../SpatialWithinPolygonPredicateBaseIT.java | 143 +++++++++------ .../predicate/TermsPredicateBaseIT.java | 151 ++++++++++------ .../predicate/WildcardPredicateBaseIT.java | 115 ++++++++---- .../projection/CompositeProjectionBaseIT.java | 15 +- .../projection/DistanceProjectionBaseIT.java | 38 ++-- .../projection/FieldProjectionBaseIT.java | 38 ++-- .../projection/ObjectProjectionBaseIT.java | 15 +- 22 files changed, 1185 insertions(+), 680 deletions(-) diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AndPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AndPredicateBaseIT.java index a3279acc5d7..4135c581e27 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AndPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/AndPredicateBaseIT.java @@ -32,23 +32,27 @@ class AndPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - ScoreIT.index, - AddScoreIT.index + ScoreConfigured.index, + AddScoreConfigured.index ) .setup(); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); - final BulkIndexer addScoreIndexer = AddScoreIT.index.bulkIndexer(); - AddScoreIT.dataSet.contribute( addScoreIndexer ); + final BulkIndexer addScoreIndexer = AddScoreConfigured.index.bulkIndexer(); + AddScoreConfigured.dataSet.contribute( addScoreIndexer ); scoreIndexer.join(); addScoreIndexer.join(); } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); @@ -60,21 +64,21 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.and( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ); + return f.and( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.and( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.and( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .boost( boost ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.and( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.and( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore(); } @@ -82,7 +86,7 @@ protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.and( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.and( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore() .boost( boost ); } @@ -101,7 +105,11 @@ public void contribute(BulkIndexer scoreIndexer) { } @Nested - class AddScoreIT extends AbstractPredicateScoreIT { + class AddScoreIT extends AddScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AddScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "addscore" ); @@ -114,14 +122,14 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.and() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ); + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.and( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.and( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .boost( boost ); } @@ -129,7 +137,7 @@ protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int ma protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.and() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore(); } @@ -138,7 +146,7 @@ protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateF int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.and() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore() .boost( boost ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/BoolPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/BoolPredicateBaseIT.java index de52ce35f70..abfb9d63162 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/BoolPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/BoolPredicateBaseIT.java @@ -22,7 +22,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class BoolPredicateBaseIT { //CHECKSTYLE:ON @@ -33,18 +32,22 @@ class BoolPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - ScoreIT.index + ScoreConfigured.index ) .setup(); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); scoreIndexer.join(); } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); @@ -56,21 +59,21 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.bool().should( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ); + return f.bool().should( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.bool().should( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.bool().should( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .boost( boost ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.bool().should( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.bool().should( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore(); } @@ -78,7 +81,7 @@ protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.bool().should( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.bool().should( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore().boost( boost ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateBaseIT.java index 08a71afbc8e..a3a5a262db6 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateBaseIT.java @@ -27,7 +27,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class ExistsPredicateBaseIT { //CHECKSTYLE:ON @@ -40,44 +39,47 @@ class ExistsPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex, - ScaleCheckingIT.index, ScaleCheckingIT.compatibleIndex, ScaleCheckingIT.incompatibleIndex + SingleFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex, + ScaleCheckingConfigured.index, ScaleCheckingConfigured.compatibleIndex, + ScaleCheckingConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); - - final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingIT.index.bulkIndexer(); - final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingIT.compatibleIndex.bulkIndexer(); - ScaleCheckingIT.dataSet.contribute( ScaleCheckingIT.index, scaleCheckingMainIndexer, - ScaleCheckingIT.compatibleIndex, scaleCheckingCompatibleIndexer ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingNoConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + + final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingConfigured.index.bulkIndexer(); + final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingConfigured.compatibleIndex.bulkIndexer(); + ScaleCheckingConfigured.dataSet.contribute( ScaleCheckingConfigured.index, scaleCheckingMainIndexer, + ScaleCheckingConfigured.compatibleIndex, scaleCheckingCompatibleIndexer ); singleFieldIndexer.join( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, scoreIndexer, @@ -92,7 +94,11 @@ private static ExistsPredicateTestValues testValues(FieldTypeDescriptor extends AbstractPredicateSingleFieldIT> { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -119,7 +125,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "score" ); @@ -208,7 +218,12 @@ public void contribute(BulkIndexer scoreIndexer) { } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT> { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured + extends AbstractPredicateFieldInObjectFieldIT> { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -242,11 +257,15 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + protected InvalidFieldConfigured() { super( index ); } @@ -272,7 +291,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) @@ -313,7 +336,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -384,7 +411,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { + class ScaleCheckingIT extends ScaleCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScaleCheckingConfigured extends AbstractPredicateScaleCheckingIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -395,7 +426,7 @@ class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { SimpleMappedIndex.of( IncompatibleIndexBinding::new ) .name( "scaleChecking_incompatible" ); - public ScaleCheckingIT() { + public ScaleCheckingConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsBaseIT.java index 58e2ac06d21..bf859f64a81 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/ExistsPredicateObjectsBaseIT.java @@ -41,7 +41,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class ExistsPredicateObjectsBaseIT { //CHECKSTYLE:ON @@ -54,23 +53,28 @@ class ExistsPredicateObjectsBaseIT { static void setup() { setupHelper.start() .withIndexes( - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index ) .setup(); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( scoreIndexer ) ); inObjectFieldMainIndexer.join( inObjectFieldMissingFieldIndexer, scoreIndexer ); } @Nested - class InObjectFieldIT extends AbstractPredicateInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateInObjectFieldIT { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, Collections.singletonList( innerFieldType ) ) ) @@ -168,7 +172,11 @@ public void contribute(BulkIndexer mainIndexer, BulkIndexer missingFieldIndexer) } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "score" ); private static final List dataSets = new ArrayList<>(); diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchAllPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchAllPredicateBaseIT.java index 428a8f95ddc..f19bb6a5e78 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchAllPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchAllPredicateBaseIT.java @@ -27,7 +27,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class MatchAllPredicateBaseIT { //CHECKSTYLE:ON @@ -38,23 +37,27 @@ class MatchAllPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index ) .setup(); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSet.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSet.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); inObjectFieldMainIndexer.join( inObjectFieldMissingFieldIndexer, scoreIndexer ); } @Nested - class InObjectFieldIT extends AbstractPredicateInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateInObjectFieldIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex mainIndex = @@ -72,7 +75,8 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, ObjectFieldBinding objectFieldBinding, int matchingDocOrdinal, AbstractPredicateDataSet dataSet) { - return f.matchAll().except( f.id().matchingAny( InObjectFieldIT.dataSet.docIdsExcept( matchingDocOrdinal ) ) ); + return f.matchAll() + .except( f.id().matchingAny( InObjectFieldConfigured.dataSet.docIdsExcept( matchingDocOrdinal ) ) ); } private static class DataSet extends AbstractPredicateDataSet { @@ -100,7 +104,11 @@ public List docIdsExcept(int docOrdinal) { } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); @@ -112,21 +120,21 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.matchAll().except( f.id().matchingAny( ScoreIT.dataSet.docIdsExcept( matchingDocOrdinal ) ) ); + return f.matchAll().except( f.id().matchingAny( ScoreConfigured.dataSet.docIdsExcept( matchingDocOrdinal ) ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.matchAll().except( f.id().matchingAny( ScoreIT.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) + return f.matchAll().except( f.id().matchingAny( ScoreConfigured.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) .boost( boost ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.matchAll().except( f.id().matchingAny( ScoreIT.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) + return f.matchAll().except( f.id().matchingAny( ScoreConfigured.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) .constantScore(); } @@ -134,7 +142,7 @@ protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.matchAll().except( f.id().matchingAny( ScoreIT.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) + return f.matchAll().except( f.id().matchingAny( ScoreConfigured.dataSet.docIdsExcept( matchingDocOrdinal ) ) ) .constantScore().boost( boost ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateBaseIT.java index 6aefda35f25..8ece1bee999 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchIdPredicateBaseIT.java @@ -25,7 +25,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class MatchIdPredicateBaseIT { //CHECKSTYLE:ON @@ -36,23 +35,27 @@ class MatchIdPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index ) .setup(); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSet.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSet.contribute( inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); inObjectFieldMainIndexer.join( inObjectFieldMissingFieldIndexer, scoreIndexer ); } @Nested - class InObjectFieldIT extends AbstractPredicateInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateInObjectFieldIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex mainIndex = @@ -70,7 +73,7 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, ObjectFieldBinding objectFieldBinding, int matchingDocOrdinal, AbstractPredicateDataSet dataSet) { - return f.id().matching( InObjectFieldIT.dataSet.docId( matchingDocOrdinal ) ); + return f.id().matching( InObjectFieldConfigured.dataSet.docId( matchingDocOrdinal ) ); } private static class DataSet extends AbstractPredicateDataSet { @@ -90,7 +93,11 @@ public void contribute(BulkIndexer mainIndexer, BulkIndexer missingFieldIndexer) } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); @@ -102,27 +109,27 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ); + return f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ).boost( boost ); + return f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ).boost( boost ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ).constantScore(); + return f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ).constantScore(); } @Override protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ).constantScore().boost( boost ); + return f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ).constantScore().boost( boost ); } private static class DataSet extends AbstractPredicateDataSet { diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateBaseIT.java index 2ecf0337436..536cc91e4c1 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/MatchPredicateBaseIT.java @@ -27,7 +27,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class MatchPredicateBaseIT { //CHECKSTYLE:ON @@ -51,56 +50,59 @@ class MatchPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - AnalysisIT.index, AnalysisIT.compatibleIndex, AnalysisIT.incompatibleIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingAndConversionIT.index, TypeCheckingAndConversionIT.compatibleIndex, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, TypeCheckingAndConversionIT.missingFieldIndex, - TypeCheckingAndConversionIT.incompatibleIndex, - ScaleCheckingIT.index, ScaleCheckingIT.compatibleIndex, ScaleCheckingIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + AnalysisConfigured.index, AnalysisConfigured.compatibleIndex, AnalysisConfigured.incompatibleIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingAndConversionConfigured.index, TypeCheckingAndConversionConfigured.compatibleIndex, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingAndConversionConfigured.missingFieldIndex, + TypeCheckingAndConversionConfigured.incompatibleIndex, + ScaleCheckingConfigured.index, ScaleCheckingConfigured.compatibleIndex, + ScaleCheckingConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer analysisMainIndexIndexer = AnalysisIT.index.bulkIndexer(); - final BulkIndexer analysisCompatibleIndexIndexer = AnalysisIT.compatibleIndex.bulkIndexer(); - final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisIT.incompatibleIndex.bulkIndexer(); - AnalysisIT.dataSet.contribute( AnalysisIT.index, analysisMainIndexIndexer, - AnalysisIT.compatibleIndex, analysisCompatibleIndexIndexer, - AnalysisIT.incompatibleIndex, analysisIncompatibleIndexIndexer ); + final BulkIndexer analysisMainIndexIndexer = AnalysisConfigured.index.bulkIndexer(); + final BulkIndexer analysisCompatibleIndexIndexer = AnalysisConfigured.compatibleIndex.bulkIndexer(); + final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisConfigured.incompatibleIndex.bulkIndexer(); + AnalysisConfigured.dataSet.contribute( AnalysisConfigured.index, analysisMainIndexIndexer, + AnalysisConfigured.compatibleIndex, analysisCompatibleIndexIndexer, + AnalysisConfigured.incompatibleIndex, analysisIncompatibleIndexIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingAndConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingAndConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingAndConversionIT.index, typeCheckingMainIndexer, - TypeCheckingAndConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingAndConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); - - final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingIT.index.bulkIndexer(); - final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingIT.compatibleIndex.bulkIndexer(); - ScaleCheckingIT.dataSet.contribute( ScaleCheckingIT.index, scaleCheckingMainIndexer, - ScaleCheckingIT.compatibleIndex, scaleCheckingCompatibleIndexer ); + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingAndConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingAndConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingAndConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingAndConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + + final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingConfigured.index.bulkIndexer(); + final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingConfigured.compatibleIndex.bulkIndexer(); + ScaleCheckingConfigured.dataSet.contribute( ScaleCheckingConfigured.index, scaleCheckingMainIndexer, + ScaleCheckingConfigured.compatibleIndex, scaleCheckingCompatibleIndexer ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -117,7 +119,11 @@ private static MatchPredicateTestValues testValues(FieldTypeDescriptor } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT> { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -144,7 +150,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT> { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -185,7 +195,12 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT> { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured + extends AbstractPredicateFieldInObjectFieldIT> { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -216,7 +231,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { + class AnalysisIT extends AnalysisConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AnalysisConfigured extends AbstractPredicateConfigurableAnalysisIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -226,7 +245,7 @@ class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { private static final SimpleMappedIndex incompatibleIndex = SimpleMappedIndex.of( IncompatibleIndexBinding::new ).name( "analysis_incompatible" ); - public AnalysisIT() { + public AnalysisConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } @@ -249,7 +268,11 @@ protected PredicateFinalStep predicateWithSkipAnalysis(SearchPredicateFactory f, } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT> { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -326,11 +349,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -346,7 +373,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -374,7 +405,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -406,7 +441,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -429,7 +468,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingAndConversionIT + class TypeCheckingAndConversionIT extends TypeCheckingAndConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingAndConversionConfigured extends AbstractPredicateTypeCheckingAndConversionIT, Object> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -501,7 +544,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { + class ScaleCheckingIT extends ScaleCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScaleCheckingConfigured extends AbstractPredicateScaleCheckingIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -512,7 +559,7 @@ class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { SimpleMappedIndex.of( IncompatibleIndexBinding::new ) .name( "scaleChecking_incompatible" ); - public ScaleCheckingIT() { + public ScaleCheckingConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/NotPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/NotPredicateBaseIT.java index 6806c32f33d..17a40e58402 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/NotPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/NotPredicateBaseIT.java @@ -24,7 +24,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class NotPredicateBaseIT { //CHECKSTYLE:ON @@ -35,18 +34,22 @@ class NotPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - ScoreIT.index + ScoreConfigured.index ) .setup(); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); scoreIndexer.join(); } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/OrPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/OrPredicateBaseIT.java index 0c45e51ce2b..8880e1fb6d8 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/OrPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/OrPredicateBaseIT.java @@ -22,7 +22,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class OrPredicateBaseIT { //CHECKSTYLE:ON @@ -33,23 +32,27 @@ class OrPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - ScoreIT.index, - AddScoreIT.index + ScoreConfigured.index, + AddScoreConfigured.index ) .setup(); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( scoreIndexer ); - final BulkIndexer addScoreIndexer = AddScoreIT.index.bulkIndexer(); - AddScoreIT.dataSet.contribute( addScoreIndexer ); + final BulkIndexer addScoreIndexer = AddScoreConfigured.index.bulkIndexer(); + AddScoreConfigured.dataSet.contribute( addScoreIndexer ); scoreIndexer.join(); addScoreIndexer.join(); } @Nested - class ScoreIT extends AbstractPredicateScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "score" ); @@ -61,21 +64,21 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.or( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ); + return f.or( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ); } @Override protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.or( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.or( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .boost( boost ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.or( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.or( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore(); } @@ -83,7 +86,7 @@ protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateFactory f, int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { - return f.or( f.id().matching( ScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + return f.or( f.id().matching( ScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore() .boost( boost ); } @@ -102,7 +105,11 @@ public void contribute(BulkIndexer scoreIndexer) { } @Nested - class AddScoreIT extends AbstractPredicateScoreIT { + class AddScoreIT extends AddScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AddScoreConfigured extends AbstractPredicateScoreIT { private static final DataSet dataSet = new DataSet(); private static final StubMappedIndex index = StubMappedIndex.withoutFields().name( "addscore" ); @@ -115,7 +122,7 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.or() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ); + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ); } @Override @@ -123,7 +130,7 @@ protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int ma float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.or() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .boost( boost ); } @@ -131,7 +138,7 @@ protected PredicateFinalStep predicateWithBoost(SearchPredicateFactory f, int ma protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, int matchingDocOrdinal, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.or() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore(); } @@ -140,7 +147,7 @@ protected PredicateFinalStep predicateWithConstantScoreAndBoost(SearchPredicateF int matchingDocOrdinal, float boost, AbstractPredicateDataSet dataSet, StubMappedIndex index) { return f.or() - .add( f.id().matching( AddScoreIT.dataSet.docId( matchingDocOrdinal ) ) ) + .add( f.id().matching( AddScoreConfigured.dataSet.docId( matchingDocOrdinal ) ) ) .constantScore() .boost( boost ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/PhrasePredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/PhrasePredicateBaseIT.java index 35e5ec9ac45..5f06c7c04c6 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/PhrasePredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/PhrasePredicateBaseIT.java @@ -28,7 +28,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class PhrasePredicateBaseIT { //CHECKSTYLE:ON @@ -54,50 +53,52 @@ class PhrasePredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - AnalysisIT.index, AnalysisIT.compatibleIndex, AnalysisIT.incompatibleIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + AnalysisConfigured.index, AnalysisConfigured.compatibleIndex, AnalysisConfigured.incompatibleIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer analysisMainIndexIndexer = AnalysisIT.index.bulkIndexer(); - final BulkIndexer analysisCompatibleIndexIndexer = AnalysisIT.compatibleIndex.bulkIndexer(); - final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisIT.incompatibleIndex.bulkIndexer(); - AnalysisIT.dataSet.contribute( AnalysisIT.index, analysisMainIndexIndexer, - AnalysisIT.compatibleIndex, analysisCompatibleIndexIndexer, - AnalysisIT.incompatibleIndex, analysisIncompatibleIndexIndexer ); + final BulkIndexer analysisMainIndexIndexer = AnalysisConfigured.index.bulkIndexer(); + final BulkIndexer analysisCompatibleIndexIndexer = AnalysisConfigured.compatibleIndex.bulkIndexer(); + final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisConfigured.incompatibleIndex.bulkIndexer(); + AnalysisConfigured.dataSet.contribute( AnalysisConfigured.index, analysisMainIndexIndexer, + AnalysisConfigured.compatibleIndex, analysisCompatibleIndexIndexer, + AnalysisConfigured.incompatibleIndex, analysisIncompatibleIndexIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingNoConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -113,7 +114,11 @@ private static PhrasePredicateTestValues testValues(FieldTypeDescriptor } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -140,7 +145,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -181,7 +190,11 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -212,7 +225,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { + class AnalysisIT extends AnalysisConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AnalysisConfigured extends AbstractPredicateConfigurableAnalysisIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -222,7 +239,7 @@ class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { private static final SimpleMappedIndex incompatibleIndex = SimpleMappedIndex.of( IncompatibleIndexBinding::new ).name( "analysis_incompatible" ); - public AnalysisIT() { + public AnalysisConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } @@ -257,7 +274,11 @@ protected PredicateFinalStep predicateWithSkipAnalysis(SearchPredicateFactory f, } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -328,11 +349,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -348,7 +373,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -376,7 +405,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -408,7 +441,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -449,7 +486,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RangePredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RangePredicateBaseIT.java index 80e900278ae..b7056de9c4d 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RangePredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RangePredicateBaseIT.java @@ -33,7 +33,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class RangePredicateBaseIT { //CHECKSTYLE:ON @@ -57,56 +56,59 @@ class RangePredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - AnalysisIT.index, AnalysisIT.compatibleIndex, AnalysisIT.incompatibleIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingAndConversionIT.index, TypeCheckingAndConversionIT.compatibleIndex, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, TypeCheckingAndConversionIT.missingFieldIndex, - TypeCheckingAndConversionIT.incompatibleIndex, - ScaleCheckingIT.index, ScaleCheckingIT.compatibleIndex, ScaleCheckingIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + AnalysisConfigured.index, AnalysisConfigured.compatibleIndex, AnalysisConfigured.incompatibleIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingAndConversionConfigured.index, TypeCheckingAndConversionConfigured.compatibleIndex, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingAndConversionConfigured.missingFieldIndex, + TypeCheckingAndConversionConfigured.incompatibleIndex, + ScaleCheckingConfigured.index, ScaleCheckingConfigured.compatibleIndex, + ScaleCheckingConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer analysisMainIndexIndexer = AnalysisIT.index.bulkIndexer(); - final BulkIndexer analysisCompatibleIndexIndexer = AnalysisIT.compatibleIndex.bulkIndexer(); - final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisIT.incompatibleIndex.bulkIndexer(); - AnalysisIT.dataSet.contribute( AnalysisIT.index, analysisMainIndexIndexer, - AnalysisIT.compatibleIndex, analysisCompatibleIndexIndexer, - AnalysisIT.incompatibleIndex, analysisIncompatibleIndexIndexer ); + final BulkIndexer analysisMainIndexIndexer = AnalysisConfigured.index.bulkIndexer(); + final BulkIndexer analysisCompatibleIndexIndexer = AnalysisConfigured.compatibleIndex.bulkIndexer(); + final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisConfigured.incompatibleIndex.bulkIndexer(); + AnalysisConfigured.dataSet.contribute( AnalysisConfigured.index, analysisMainIndexIndexer, + AnalysisConfigured.compatibleIndex, analysisCompatibleIndexIndexer, + AnalysisConfigured.incompatibleIndex, analysisIncompatibleIndexIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingAndConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingAndConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingAndConversionIT.index, typeCheckingMainIndexer, - TypeCheckingAndConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingAndConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); - - final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingIT.index.bulkIndexer(); - final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingIT.compatibleIndex.bulkIndexer(); - ScaleCheckingIT.dataSet.contribute( ScaleCheckingIT.index, scaleCheckingMainIndexer, - ScaleCheckingIT.compatibleIndex, scaleCheckingCompatibleIndexer ); + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingAndConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingAndConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingAndConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingAndConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + + final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingConfigured.index.bulkIndexer(); + final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingConfigured.compatibleIndex.bulkIndexer(); + ScaleCheckingConfigured.dataSet.contribute( ScaleCheckingConfigured.index, scaleCheckingMainIndexer, + ScaleCheckingConfigured.compatibleIndex, scaleCheckingCompatibleIndexer ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -123,7 +125,11 @@ private static RangePredicateTestValues testValues(FieldTypeDescriptor } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT> { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -150,7 +156,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT> { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -191,7 +201,12 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT> { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured + extends AbstractPredicateFieldInObjectFieldIT> { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -222,7 +237,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class AnalysisIT extends AbstractPredicateSimpleAnalysisIT { + class AnalysisIT extends AnalysisConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AnalysisConfigured extends AbstractPredicateSimpleAnalysisIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -232,7 +251,7 @@ class AnalysisIT extends AbstractPredicateSimpleAnalysisIT { private static final SimpleMappedIndex incompatibleIndex = SimpleMappedIndex.of( IncompatibleIndexBinding::new ).name( "analysis_incompatible" ); - public AnalysisIT() { + public AnalysisConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } @@ -243,7 +262,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT> { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -313,11 +336,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -333,7 +360,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -361,7 +392,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -393,7 +428,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -431,7 +470,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingAndConversionIT + class TypeCheckingAndConversionIT extends TypeCheckingAndConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingAndConversionConfigured extends AbstractPredicateTypeCheckingAndConversionIT, Range> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -503,7 +546,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { + class ScaleCheckingIT extends ScaleCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScaleCheckingConfigured extends AbstractPredicateScaleCheckingIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -514,7 +561,7 @@ class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { SimpleMappedIndex.of( IncompatibleIndexBinding::new ) .name( "scaleChecking_incompatible" ); - public ScaleCheckingIT() { + public ScaleCheckingConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RegexpPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RegexpPredicateBaseIT.java index 5498993107a..43cb81ce512 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RegexpPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/RegexpPredicateBaseIT.java @@ -23,7 +23,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class RegexpPredicateBaseIT { //CHECKSTYLE:ON @@ -49,42 +48,44 @@ class RegexpPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingNoConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -99,7 +100,11 @@ private static RegexpPredicateTestValues testValues(FieldTypeDescriptor } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -126,7 +131,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -167,7 +176,11 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -198,7 +211,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -269,11 +286,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -289,7 +310,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -317,7 +342,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -349,7 +378,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -372,7 +405,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SimpleQueryStringPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SimpleQueryStringPredicateBaseIT.java index 8fb22b12cd4..32f0c084efa 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SimpleQueryStringPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SimpleQueryStringPredicateBaseIT.java @@ -23,7 +23,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class SimpleQueryStringPredicateBaseIT { //CHECKSTYLE:ON @@ -49,50 +48,52 @@ class SimpleQueryStringPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - AnalysisIT.index, AnalysisIT.compatibleIndex, AnalysisIT.incompatibleIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + AnalysisConfigured.index, AnalysisConfigured.compatibleIndex, AnalysisConfigured.incompatibleIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer analysisMainIndexIndexer = AnalysisIT.index.bulkIndexer(); - final BulkIndexer analysisCompatibleIndexIndexer = AnalysisIT.compatibleIndex.bulkIndexer(); - final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisIT.incompatibleIndex.bulkIndexer(); - AnalysisIT.dataSet.contribute( AnalysisIT.index, analysisMainIndexIndexer, - AnalysisIT.compatibleIndex, analysisCompatibleIndexIndexer, - AnalysisIT.incompatibleIndex, analysisIncompatibleIndexIndexer ); + final BulkIndexer analysisMainIndexIndexer = AnalysisConfigured.index.bulkIndexer(); + final BulkIndexer analysisCompatibleIndexIndexer = AnalysisConfigured.compatibleIndex.bulkIndexer(); + final BulkIndexer analysisIncompatibleIndexIndexer = AnalysisConfigured.incompatibleIndex.bulkIndexer(); + AnalysisConfigured.dataSet.contribute( AnalysisConfigured.index, analysisMainIndexIndexer, + AnalysisConfigured.compatibleIndex, analysisCompatibleIndexIndexer, + AnalysisConfigured.incompatibleIndex, analysisIncompatibleIndexIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingNoConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -108,7 +109,11 @@ private static SimpleQueryStringPredicateTestValues testValues(FieldTypeDescript } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -135,7 +140,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -176,7 +185,11 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -208,7 +221,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { + class AnalysisIT extends AnalysisConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class AnalysisConfigured extends AbstractPredicateConfigurableAnalysisIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -218,7 +235,7 @@ class AnalysisIT extends AbstractPredicateConfigurableAnalysisIT { private static final SimpleMappedIndex incompatibleIndex = SimpleMappedIndex.of( IncompatibleIndexBinding::new ).name( "analysis_incompatible" ); - public AnalysisIT() { + public AnalysisConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } @@ -241,7 +258,11 @@ protected PredicateFinalStep predicateWithSkipAnalysis(SearchPredicateFactory f, } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -333,11 +354,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + protected InvalidFieldConfigured() { super( index ); } @@ -353,7 +378,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -381,7 +410,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -413,7 +446,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -436,7 +473,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinBoundingBoxPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinBoundingBoxPredicateBaseIT.java index 3ea63bd066e..dc40fc100f4 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinBoundingBoxPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinBoundingBoxPredicateBaseIT.java @@ -26,7 +26,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class SpatialWithinBoundingBoxPredicateBaseIT { //CHECKSTYLE:ON @@ -50,41 +49,43 @@ class SpatialWithinBoundingBoxPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSet.contribute( SingleFieldIT.index, singleFieldIndexer ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSet.contribute( SingleFieldConfigured.index, singleFieldIndexer ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSet.contribute( MultiFieldIT.index, multiFieldIndexer ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSet.contribute( MultiFieldConfigured.index, multiFieldIndexer ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSet.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSet.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( ScoreIT.index, scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( ScoreConfigured.index, scoreIndexer ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSet.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSet.contribute( TypeCheckingNoConversionConfigured.index, + typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -99,7 +100,12 @@ private static SpatialWithinBoundingBoxPredicateTestValues testValues() { } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured + extends AbstractPredicateSingleFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -115,12 +121,17 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .boundingBox( SingleFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( SingleFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured + extends AbstractPredicateMultiFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -137,14 +148,14 @@ protected PredicateFinalStep predicateOnFieldAndField(SearchPredicateFactory f, String otherFieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).field( otherFieldPath ) - .boundingBox( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateOnFields(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .boundingBox( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override @@ -152,12 +163,16 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).fields( fieldPaths ) - .boundingBox( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class InObjectFieldIT + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -180,12 +195,16 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .boundingBox( InObjectFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( InObjectFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -201,21 +220,21 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); } @Override protected PredicateFinalStep predicateWithPredicateLevelBoost(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); } @Override @@ -223,14 +242,14 @@ protected PredicateFinalStep predicateWithConstantScoreAndPredicateLevelBoost(Se String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); } @Override protected PredicateFinalStep predicateWithFieldLevelBoost(SearchPredicateFactory f, String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override @@ -238,7 +257,7 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndConstantScore(Search String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); } @Override @@ -246,16 +265,20 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( String fieldPath, float fieldBoost, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .boundingBox( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); + .boundingBox( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); } } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -273,7 +296,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -303,7 +330,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -330,7 +361,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -346,7 +381,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -376,14 +415,14 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .boundingBox( TypeCheckingNoConversionIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( TypeCheckingNoConversionConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, String field0Path, String field1Path, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( field0Path ).field( field1Path ) - .boundingBox( TypeCheckingNoConversionIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .boundingBox( TypeCheckingNoConversionConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinCirclePredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinCirclePredicateBaseIT.java index b5878229799..32c1d1b2d90 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinCirclePredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinCirclePredicateBaseIT.java @@ -30,7 +30,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class SpatialWithinCirclePredicateBaseIT { //CHECKSTYLE:ON @@ -54,41 +53,43 @@ class SpatialWithinCirclePredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSet.contribute( SingleFieldIT.index, singleFieldIndexer ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSet.contribute( SingleFieldConfigured.index, singleFieldIndexer ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSet.contribute( MultiFieldIT.index, multiFieldIndexer ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSet.contribute( MultiFieldConfigured.index, multiFieldIndexer ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSet.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSet.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( ScoreIT.index, scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( ScoreConfigured.index, scoreIndexer ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSet.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSet.contribute( TypeCheckingNoConversionConfigured.index, + typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -103,7 +104,11 @@ private static SpatialWithinCirclePredicateTestValues testValues() { } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -118,13 +123,17 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .circle( SingleFieldIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - SingleFieldIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( SingleFieldConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + SingleFieldConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -139,29 +148,33 @@ public static List params() { protected PredicateFinalStep predicateOnFieldAndField(SearchPredicateFactory f, String fieldPath, String otherFieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).field( otherFieldPath ) - .circle( MultiFieldIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - MultiFieldIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( MultiFieldConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + MultiFieldConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateOnFields(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .circle( MultiFieldIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - MultiFieldIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( MultiFieldConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + MultiFieldConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, String fieldPath, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).fields( fieldPaths ) - .circle( MultiFieldIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - MultiFieldIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( MultiFieldConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + MultiFieldConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } } @Nested - class InObjectFieldIT + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -182,13 +195,17 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .circle( InObjectFieldIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - InObjectFieldIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( InObjectFieldConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + InObjectFieldConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -203,16 +220,16 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ) + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ) .constantScore(); } @@ -220,8 +237,8 @@ protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f protected PredicateFinalStep predicateWithPredicateLevelBoost(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ) + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ) .boost( predicateBoost ); } @@ -230,8 +247,8 @@ protected PredicateFinalStep predicateWithConstantScoreAndPredicateLevelBoost(Se String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ) + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ) .constantScore().boost( predicateBoost ); } @@ -239,8 +256,8 @@ protected PredicateFinalStep predicateWithConstantScoreAndPredicateLevelBoost(Se protected PredicateFinalStep predicateWithFieldLevelBoost(SearchPredicateFactory f, String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override @@ -248,8 +265,8 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndConstantScore(Search String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ) + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ) .constantScore(); } @@ -258,18 +275,22 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( String fieldPath, float fieldBoost, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .circle( ScoreIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - ScoreIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ) + .circle( ScoreConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + ScoreConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ) .boost( predicateBoost ); } } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -287,7 +308,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -317,7 +342,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -344,7 +373,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -371,7 +404,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -402,16 +439,16 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .circle( TypeCheckingNoConversionIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - TypeCheckingNoConversionIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( TypeCheckingNoConversionConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + TypeCheckingNoConversionConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, String field0Path, String field1Path, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( field0Path ).field( field1Path ) - .circle( TypeCheckingNoConversionIT.dataSet.values.matchingCenter( matchingDocOrdinal ), - TypeCheckingNoConversionIT.dataSet.values.matchingRadius( matchingDocOrdinal ) ); + .circle( TypeCheckingNoConversionConfigured.dataSet.values.matchingCenter( matchingDocOrdinal ), + TypeCheckingNoConversionConfigured.dataSet.values.matchingRadius( matchingDocOrdinal ) ); } @Override diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinPolygonPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinPolygonPredicateBaseIT.java index 301ae7b18a6..cd2784be943 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinPolygonPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/SpatialWithinPolygonPredicateBaseIT.java @@ -27,7 +27,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class SpatialWithinPolygonPredicateBaseIT { //CHECKSTYLE:ON @@ -51,41 +50,43 @@ class SpatialWithinPolygonPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSet.contribute( SingleFieldIT.index, singleFieldIndexer ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSet.contribute( SingleFieldConfigured.index, singleFieldIndexer ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSet.contribute( MultiFieldIT.index, multiFieldIndexer ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSet.contribute( MultiFieldConfigured.index, multiFieldIndexer ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSet.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSet.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSet.contribute( ScoreIT.index, scoreIndexer ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSet.contribute( ScoreConfigured.index, scoreIndexer ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSet.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSet.contribute( TypeCheckingNoConversionConfigured.index, + typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ); singleFieldIndexer.join( multiFieldIndexer, inObjectFieldMainIndexer, inObjectFieldMissingFieldIndexer, @@ -105,7 +106,12 @@ private static GeoPolygon unsusedPolygon() { } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured + extends AbstractPredicateSingleFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -120,12 +126,16 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .polygon( SingleFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( SingleFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -140,14 +150,14 @@ public static List params() { protected PredicateFinalStep predicateOnFieldAndField(SearchPredicateFactory f, String fieldPath, String otherFieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).field( otherFieldPath ) - .polygon( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateOnFields(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .polygon( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override @@ -155,12 +165,16 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).fields( fieldPaths ) - .polygon( MultiFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( MultiFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class InObjectFieldIT + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -181,12 +195,16 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .polygon( InObjectFieldIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( InObjectFieldConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final DataSet dataSet = new DataSet<>( testValues() ); private static final SimpleMappedIndex index = @@ -200,21 +218,22 @@ public static List params() { @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { - return f.spatial().within().field( fieldPath ).polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + return f.spatial().within().field( fieldPath ) + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicateWithConstantScore(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).constantScore(); } @Override protected PredicateFinalStep predicateWithPredicateLevelBoost(SearchPredicateFactory f, String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); } @Override @@ -222,7 +241,7 @@ protected PredicateFinalStep predicateWithConstantScoreAndPredicateLevelBoost(Se String[] fieldPaths, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().fields( fieldPaths ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ) + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ) .constantScore().boost( predicateBoost ); } @@ -230,7 +249,7 @@ protected PredicateFinalStep predicateWithConstantScoreAndPredicateLevelBoost(Se protected PredicateFinalStep predicateWithFieldLevelBoost(SearchPredicateFactory f, String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override @@ -238,7 +257,7 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndConstantScore(Search String fieldPath, float fieldBoost, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ) + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ) .constantScore(); } @@ -247,16 +266,20 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( String fieldPath, float fieldBoost, int matchingDocOrdinal, float predicateBoost, DataSet dataSet) { return f.spatial().within().field( fieldPath ).boost( fieldBoost ) - .polygon( ScoreIT.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); + .polygon( ScoreConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ).boost( predicateBoost ); } } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + public InvalidFieldConfigured() { super( index ); } @@ -274,7 +297,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -304,7 +331,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -331,7 +362,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -347,7 +382,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final DataSet dataSet = new DataSet<>( testValues() ); @@ -378,14 +417,14 @@ public static List params() { protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPath, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( fieldPath ) - .polygon( TypeCheckingNoConversionIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( TypeCheckingNoConversionConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override protected PredicateFinalStep predicate(SearchPredicateFactory f, String field0Path, String field1Path, int matchingDocOrdinal, DataSet dataSet) { return f.spatial().within().field( field0Path ).field( field1Path ) - .polygon( TypeCheckingNoConversionIT.dataSet.values.matchingArg( matchingDocOrdinal ) ); + .polygon( TypeCheckingNoConversionConfigured.dataSet.values.matchingArg( matchingDocOrdinal ) ); } @Override diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/TermsPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/TermsPredicateBaseIT.java index 249cd36e6bd..dfad1684631 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/TermsPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/TermsPredicateBaseIT.java @@ -28,7 +28,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class TermsPredicateBaseIT { //CHECKSTYLE:ON @@ -53,55 +52,58 @@ class TermsPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - MultipleArgumentIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingAndConversionIT.index, TypeCheckingAndConversionIT.compatibleIndex, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, - TypeCheckingAndConversionIT.missingFieldIndex, - TypeCheckingAndConversionIT.incompatibleIndex, - ScaleCheckingIT.index, ScaleCheckingIT.compatibleIndex, ScaleCheckingIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + MultipleArgumentConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingAndConversionConfigured.index, TypeCheckingAndConversionConfigured.compatibleIndex, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingAndConversionConfigured.missingFieldIndex, + TypeCheckingAndConversionConfigured.incompatibleIndex, + ScaleCheckingConfigured.index, ScaleCheckingConfigured.compatibleIndex, + ScaleCheckingConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer multipleArgumentIndexer = MultipleArgumentIT.index.bulkIndexer(); - MultipleArgumentIT.dataSets.forEach( d -> d.contribute( MultipleArgumentIT.index, multipleArgumentIndexer ) ); + final BulkIndexer multipleArgumentIndexer = MultipleArgumentConfigured.index.bulkIndexer(); + MultipleArgumentConfigured.dataSets + .forEach( d -> d.contribute( MultipleArgumentConfigured.index, multipleArgumentIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer - ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer + ) ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionIT.compatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingRawFieldCompatibleIndexer = TypeCheckingAndConversionIT.rawFieldCompatibleIndex + final BulkIndexer typeCheckingMainIndexer = TypeCheckingAndConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingAndConversionConfigured.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingRawFieldCompatibleIndexer = TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex .bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingAndConversionIT.dataSets.forEach( - d -> d.contribute( TypeCheckingAndConversionIT.index, typeCheckingMainIndexer, - TypeCheckingAndConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingAndConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingAndConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingAndConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingAndConversionConfigured.dataSets.forEach( + d -> d.contribute( TypeCheckingAndConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingAndConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingAndConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingAndConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); - final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingIT.index.bulkIndexer(); - final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingIT.compatibleIndex.bulkIndexer(); - ScaleCheckingIT.dataSet.contribute( ScaleCheckingIT.index, scaleCheckingMainIndexer, - ScaleCheckingIT.compatibleIndex, scaleCheckingCompatibleIndexer + final BulkIndexer scaleCheckingMainIndexer = ScaleCheckingConfigured.index.bulkIndexer(); + final BulkIndexer scaleCheckingCompatibleIndexer = ScaleCheckingConfigured.compatibleIndex.bulkIndexer(); + ScaleCheckingConfigured.dataSet.contribute( ScaleCheckingConfigured.index, scaleCheckingMainIndexer, + ScaleCheckingConfigured.compatibleIndex, scaleCheckingCompatibleIndexer ); singleFieldIndexer.join( @@ -118,7 +120,11 @@ private static TermsPredicateTestValues testValues(FieldTypeDescriptor } @Nested - class SingleFieldIT extends AbstractPredicateSingleFieldIT> { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -146,7 +152,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultipleArgumentIT extends AbstractPredicateSingleFieldIT> { + class MultipleArgumentIT extends MultipleArgumentConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultipleArgumentConfigured extends AbstractPredicateSingleFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multipleArgumentField" ); @@ -181,7 +191,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT> { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -223,7 +237,12 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT> { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured + extends AbstractPredicateFieldInObjectFieldIT> { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -255,7 +274,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT> { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -327,11 +350,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + protected InvalidFieldConfigured() { super( index ); } @@ -347,7 +374,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -376,7 +407,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -409,7 +444,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -433,7 +472,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingAndConversionIT + class TypeCheckingAndConversionIT extends TypeCheckingAndConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingAndConversionConfigured extends AbstractPredicateTypeCheckingAndConversionIT, Object> { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) @@ -507,7 +550,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { + class ScaleCheckingIT extends ScaleCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScaleCheckingConfigured extends AbstractPredicateScaleCheckingIT { private static final DataSet dataSet = new DataSet(); private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) @@ -518,7 +565,7 @@ class ScaleCheckingIT extends AbstractPredicateScaleCheckingIT { SimpleMappedIndex.of( IncompatibleIndexBinding::new ) .name( "scaleChecking_incompatible" ); - public ScaleCheckingIT() { + public ScaleCheckingConfigured() { super( index, compatibleIndex, incompatibleIndex, dataSet ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/WildcardPredicateBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/WildcardPredicateBaseIT.java index 19ce365d2d0..4b0329269e6 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/WildcardPredicateBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/predicate/WildcardPredicateBaseIT.java @@ -23,7 +23,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class WildcardPredicateBaseIT { //CHECKSTYLE:ON @@ -49,42 +48,44 @@ class WildcardPredicateBaseIT { static void setup() { setupHelper.start() .withIndexes( - SingleFieldIT.index, MultiFieldIT.index, - InObjectFieldIT.mainIndex, InObjectFieldIT.missingFieldIndex, - ScoreIT.index, - InvalidFieldIT.index, UnsupportedTypeIT.index, - SearchableIT.searchableYesIndex, SearchableIT.searchableNoIndex, - ArgumentCheckingIT.index, - TypeCheckingNoConversionIT.index, TypeCheckingNoConversionIT.compatibleIndex, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, TypeCheckingNoConversionIT.missingFieldIndex, - TypeCheckingNoConversionIT.incompatibleIndex + SingleFieldConfigured.index, MultiFieldConfigured.index, + InObjectFieldConfigured.mainIndex, InObjectFieldConfigured.missingFieldIndex, + ScoreConfigured.index, + InvalidFieldConfigured.index, UnsupportedTypeConfigured.index, + SearchableConfigured.searchableYesIndex, SearchableConfigured.searchableNoIndex, + ArgumentCheckingConfigured.index, + TypeCheckingNoConversionConfigured.index, TypeCheckingNoConversionConfigured.compatibleIndex, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, + TypeCheckingNoConversionConfigured.missingFieldIndex, + TypeCheckingNoConversionConfigured.incompatibleIndex ) .setup(); - final BulkIndexer singleFieldIndexer = SingleFieldIT.index.bulkIndexer(); - SingleFieldIT.dataSets.forEach( d -> d.contribute( SingleFieldIT.index, singleFieldIndexer ) ); + final BulkIndexer singleFieldIndexer = SingleFieldConfigured.index.bulkIndexer(); + SingleFieldConfigured.dataSets.forEach( d -> d.contribute( SingleFieldConfigured.index, singleFieldIndexer ) ); - final BulkIndexer multiFieldIndexer = MultiFieldIT.index.bulkIndexer(); - MultiFieldIT.dataSets.forEach( d -> d.contribute( MultiFieldIT.index, multiFieldIndexer ) ); + final BulkIndexer multiFieldIndexer = MultiFieldConfigured.index.bulkIndexer(); + MultiFieldConfigured.dataSets.forEach( d -> d.contribute( MultiFieldConfigured.index, multiFieldIndexer ) ); - final BulkIndexer inObjectFieldMainIndexer = InObjectFieldIT.mainIndex.bulkIndexer(); - final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldIT.missingFieldIndex.bulkIndexer(); - InObjectFieldIT.dataSets.forEach( d -> d.contribute( InObjectFieldIT.mainIndex, inObjectFieldMainIndexer, - InObjectFieldIT.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); + final BulkIndexer inObjectFieldMainIndexer = InObjectFieldConfigured.mainIndex.bulkIndexer(); + final BulkIndexer inObjectFieldMissingFieldIndexer = InObjectFieldConfigured.missingFieldIndex.bulkIndexer(); + InObjectFieldConfigured.dataSets + .forEach( d -> d.contribute( InObjectFieldConfigured.mainIndex, inObjectFieldMainIndexer, + InObjectFieldConfigured.missingFieldIndex, inObjectFieldMissingFieldIndexer ) ); - final BulkIndexer scoreIndexer = ScoreIT.index.bulkIndexer(); - ScoreIT.dataSets.forEach( d -> d.contribute( ScoreIT.index, scoreIndexer ) ); + final BulkIndexer scoreIndexer = ScoreConfigured.index.bulkIndexer(); + ScoreConfigured.dataSets.forEach( d -> d.contribute( ScoreConfigured.index, scoreIndexer ) ); - final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionIT.index.bulkIndexer(); - final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionIT.compatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMainIndexer = TypeCheckingNoConversionConfigured.index.bulkIndexer(); + final BulkIndexer typeCheckingCompatibleIndexer = TypeCheckingNoConversionConfigured.compatibleIndex.bulkIndexer(); final BulkIndexer typeCheckingRawFieldCompatibleIndexer = - TypeCheckingNoConversionIT.rawFieldCompatibleIndex.bulkIndexer(); - final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionIT.missingFieldIndex.bulkIndexer(); - TypeCheckingNoConversionIT.dataSets - .forEach( d -> d.contribute( TypeCheckingNoConversionIT.index, typeCheckingMainIndexer, - TypeCheckingNoConversionIT.compatibleIndex, typeCheckingCompatibleIndexer, - TypeCheckingNoConversionIT.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, - TypeCheckingNoConversionIT.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex.bulkIndexer(); + final BulkIndexer typeCheckingMissingFieldIndexer = TypeCheckingNoConversionConfigured.missingFieldIndex.bulkIndexer(); + TypeCheckingNoConversionConfigured.dataSets + .forEach( d -> d.contribute( TypeCheckingNoConversionConfigured.index, typeCheckingMainIndexer, + TypeCheckingNoConversionConfigured.compatibleIndex, typeCheckingCompatibleIndexer, + TypeCheckingNoConversionConfigured.rawFieldCompatibleIndex, typeCheckingRawFieldCompatibleIndexer, + TypeCheckingNoConversionConfigured.missingFieldIndex, typeCheckingMissingFieldIndexer ) ); singleFieldIndexer.join( @@ -100,7 +101,11 @@ private static WildcardPredicateTestValues testValues(FieldTypeDescriptor { + class SingleFieldIT extends SingleFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SingleFieldConfigured extends AbstractPredicateSingleFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "singleField" ); @@ -126,7 +131,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class MultiFieldIT extends AbstractPredicateMultiFieldIT { + class MultiFieldIT extends MultiFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class MultiFieldConfigured extends AbstractPredicateMultiFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "multiField" ); @@ -167,7 +176,11 @@ protected PredicateFinalStep predicateOnFieldAndFields(SearchPredicateFactory f, } @Nested - class InObjectFieldIT extends AbstractPredicateFieldInObjectFieldIT { + class InObjectFieldIT extends InObjectFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectFieldConfigured extends AbstractPredicateFieldInObjectFieldIT { private static final SimpleMappedIndex mainIndex = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "nesting" ); @@ -198,7 +211,11 @@ protected PredicateFinalStep predicate(SearchPredicateFactory f, String fieldPat } @Nested - class ScoreIT extends AbstractPredicateFieldScoreIT { + class ScoreIT extends ScoreConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ScoreConfigured extends AbstractPredicateFieldScoreIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "score" ); @@ -269,11 +286,15 @@ protected PredicateFinalStep predicateWithFieldLevelBoostAndPredicateLevelBoost( } @Nested - class InvalidFieldIT extends AbstractPredicateInvalidFieldIT { + class InvalidFieldIT extends InvalidFieldConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InvalidFieldConfigured extends AbstractPredicateInvalidFieldIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "invalidField" ); - public InvalidFieldIT() { + protected InvalidFieldConfigured() { super( index ); } @@ -289,7 +310,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class UnsupportedTypeIT extends AbstractPredicateUnsupportedTypeIT { + class UnsupportedTypeIT extends UnsupportedTypeConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class UnsupportedTypeConfigured extends AbstractPredicateUnsupportedTypeIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, unsupportedFieldTypes ) ) .name( "unsupportedType" ); @@ -317,7 +342,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class SearchableIT extends AbstractPredicateSearchableIT { + class SearchableIT extends SearchableConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class SearchableConfigured extends AbstractPredicateSearchableIT { private static final SimpleMappedIndex searchableYesIndex = SimpleMappedIndex.of( root -> new SearchableYesIndexBinding( root, supportedFieldTypes ) ) .name( "searchableYes" ); @@ -349,7 +378,11 @@ protected String predicateNameInErrorMessage() { } @Nested - class ArgumentCheckingIT extends AbstractPredicateArgumentCheckingIT { + class ArgumentCheckingIT extends ArgumentCheckingConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class ArgumentCheckingConfigured extends AbstractPredicateArgumentCheckingIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) .name( "argumentChecking" ); @@ -372,7 +405,11 @@ protected void tryPredicateWithNullMatchingParam(SearchPredicateFactory f, Strin } @Nested - class TypeCheckingNoConversionIT + class TypeCheckingNoConversionIT extends TypeCheckingNoConversionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class TypeCheckingNoConversionConfigured extends AbstractPredicateTypeCheckingNoConversionIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( root -> new IndexBinding( root, supportedFieldTypes ) ) diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/CompositeProjectionBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/CompositeProjectionBaseIT.java index 695dbc4fba1..e16508bcf63 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/CompositeProjectionBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/CompositeProjectionBaseIT.java @@ -24,7 +24,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class CompositeProjectionBaseIT { //CHECKSTYLE:ON @@ -33,10 +32,10 @@ class CompositeProjectionBaseIT { @BeforeAll static void setup() { - setupHelper.start().withIndex( FromAsIT.index ).setup(); + setupHelper.start().withIndex( FromAsConfigured.index ).setup(); - BulkIndexer fromAsIndexer = FromAsIT.index.bulkIndexer(); - FromAsIT.dataSet.contribute( FromAsIT.index, fromAsIndexer ); + BulkIndexer fromAsIndexer = FromAsConfigured.index.bulkIndexer(); + FromAsConfigured.dataSet.contribute( FromAsConfigured.index, fromAsIndexer ); fromAsIndexer.join(); } @@ -49,14 +48,18 @@ static void setup() { * which is tested in {@link CompositeProjectionSingleStepIT}. */ @Nested - class FromAsIT extends AbstractCompositeProjectionFromAsIT { + class FromAsIT extends FromAsConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class FromAsConfigured extends AbstractCompositeProjectionFromAsIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "fromAs" ); private static final DataSet dataSet = new DataSet(); - public FromAsIT() { + public FromAsConfigured() { super( index, dataSet ); } diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/DistanceProjectionBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/DistanceProjectionBaseIT.java index bed0c5054ce..d6115e56f8f 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/DistanceProjectionBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/DistanceProjectionBaseIT.java @@ -31,7 +31,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class DistanceProjectionBaseIT { //CHECKSTYLE:ON @@ -45,24 +44,27 @@ private static DistanceProjectionTestValues testValues() { @BeforeAll static void setup() { setupHelper.start() - .withIndexes( InObjectProjectionIT.mainIndex, InObjectProjectionIT.missingLevel1Index, - InObjectProjectionIT.missingLevel1SingleValuedFieldIndex, - InObjectProjectionIT.missingLevel2Index, InObjectProjectionIT.missingLevel2SingleValuedFieldIndex ) + .withIndexes( InObjectProjectionConfigured.mainIndex, InObjectProjectionConfigured.missingLevel1Index, + InObjectProjectionConfigured.missingLevel1SingleValuedFieldIndex, + InObjectProjectionConfigured.missingLevel2Index, + InObjectProjectionConfigured.missingLevel2SingleValuedFieldIndex ) .setup(); - BulkIndexer compositeForEachMainIndexer = InObjectProjectionIT.mainIndex.bulkIndexer(); - BulkIndexer compositeForEachMissingLevel1Indexer = InObjectProjectionIT.missingLevel1Index.bulkIndexer(); + BulkIndexer compositeForEachMainIndexer = InObjectProjectionConfigured.mainIndex.bulkIndexer(); + BulkIndexer compositeForEachMissingLevel1Indexer = InObjectProjectionConfigured.missingLevel1Index.bulkIndexer(); BulkIndexer compositeForEachMissingLevel1SingleValuedFieldIndexer = - InObjectProjectionIT.missingLevel1SingleValuedFieldIndex.bulkIndexer(); - BulkIndexer compositeForEachMissingLevel2Indexer = InObjectProjectionIT.missingLevel2Index.bulkIndexer(); + InObjectProjectionConfigured.missingLevel1SingleValuedFieldIndex.bulkIndexer(); + BulkIndexer compositeForEachMissingLevel2Indexer = InObjectProjectionConfigured.missingLevel2Index.bulkIndexer(); BulkIndexer compositeForEachMissingLevel2SingleValuedFieldIndexer = - InObjectProjectionIT.missingLevel2SingleValuedFieldIndex.bulkIndexer(); - InObjectProjectionIT.dataSets.forEach( d -> d.contribute( InObjectProjectionIT.mainIndex, compositeForEachMainIndexer, - InObjectProjectionIT.missingLevel1Index, compositeForEachMissingLevel1Indexer, - InObjectProjectionIT.missingLevel1SingleValuedFieldIndex, compositeForEachMissingLevel1SingleValuedFieldIndexer, - InObjectProjectionIT.missingLevel2Index, compositeForEachMissingLevel2Indexer, - InObjectProjectionIT.missingLevel2SingleValuedFieldIndex, - compositeForEachMissingLevel2SingleValuedFieldIndexer ) ); + InObjectProjectionConfigured.missingLevel2SingleValuedFieldIndex.bulkIndexer(); + InObjectProjectionConfigured.dataSets + .forEach( d -> d.contribute( InObjectProjectionConfigured.mainIndex, compositeForEachMainIndexer, + InObjectProjectionConfigured.missingLevel1Index, compositeForEachMissingLevel1Indexer, + InObjectProjectionConfigured.missingLevel1SingleValuedFieldIndex, + compositeForEachMissingLevel1SingleValuedFieldIndexer, + InObjectProjectionConfigured.missingLevel2Index, compositeForEachMissingLevel2Indexer, + InObjectProjectionConfigured.missingLevel2SingleValuedFieldIndex, + compositeForEachMissingLevel2SingleValuedFieldIndexer ) ); compositeForEachMainIndexer.join( compositeForEachMissingLevel1Indexer, compositeForEachMissingLevel1SingleValuedFieldIndexer, compositeForEachMissingLevel2Indexer, @@ -70,7 +72,11 @@ static void setup() { } @Nested - class InObjectProjectionIT + class InObjectProjectionIT extends InObjectProjectionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectProjectionConfigured extends AbstractProjectionInObjectProjectionIT { private static final List> supportedFieldTypes = Arrays.asList( GeoPointFieldTypeDescriptor.INSTANCE ); diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/FieldProjectionBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/FieldProjectionBaseIT.java index b68065e3469..1d1ac53e22b 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/FieldProjectionBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/FieldProjectionBaseIT.java @@ -29,7 +29,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class FieldProjectionBaseIT { //CHECKSTYLE:ON @@ -43,24 +42,27 @@ private static FieldProjectionTestValues testValues(FieldTypeDescriptor d.contribute( InObjectProjectionIT.mainIndex, compositeForEachMainIndexer, - InObjectProjectionIT.missingLevel1Index, compositeForEachMissingLevel1Indexer, - InObjectProjectionIT.missingLevel1SingleValuedFieldIndex, compositeForEachMissingLevel1SingleValuedFieldIndexer, - InObjectProjectionIT.missingLevel2Index, compositeForEachMissingLevel2Indexer, - InObjectProjectionIT.missingLevel2SingleValuedFieldIndex, - compositeForEachMissingLevel2SingleValuedFieldIndexer ) ); + InObjectProjectionConfigured.missingLevel2SingleValuedFieldIndex.bulkIndexer(); + InObjectProjectionConfigured.dataSets + .forEach( d -> d.contribute( InObjectProjectionConfigured.mainIndex, compositeForEachMainIndexer, + InObjectProjectionConfigured.missingLevel1Index, compositeForEachMissingLevel1Indexer, + InObjectProjectionConfigured.missingLevel1SingleValuedFieldIndex, + compositeForEachMissingLevel1SingleValuedFieldIndexer, + InObjectProjectionConfigured.missingLevel2Index, compositeForEachMissingLevel2Indexer, + InObjectProjectionConfigured.missingLevel2SingleValuedFieldIndex, + compositeForEachMissingLevel2SingleValuedFieldIndexer ) ); compositeForEachMainIndexer.join( compositeForEachMissingLevel1Indexer, compositeForEachMissingLevel1SingleValuedFieldIndexer, compositeForEachMissingLevel2Indexer, @@ -68,7 +70,11 @@ static void setup() { } @Nested - class InObjectProjectionIT + class InObjectProjectionIT extends InObjectProjectionConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class InObjectProjectionConfigured extends AbstractProjectionInObjectProjectionIT> { private static final List> supportedFieldTypes = FieldTypeDescriptor.getAll(); private static final SimpleMappedIndex mainIndex = diff --git a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/ObjectProjectionBaseIT.java b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/ObjectProjectionBaseIT.java index 4e8a978a454..2df06f6e292 100644 --- a/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/ObjectProjectionBaseIT.java +++ b/integrationtest/backend/tck/src/main/java/org/hibernate/search/integrationtest/backend/tck/search/projection/ObjectProjectionBaseIT.java @@ -28,7 +28,6 @@ //CHECKSTYLE:OFF HideUtilityClassConstructor ignore the rule since it is a class with nested test classes. // cannot make a private constructor. - class ObjectProjectionBaseIT { //CHECKSTYLE:ON @@ -37,10 +36,10 @@ class ObjectProjectionBaseIT { @BeforeAll static void setup() { - setupHelper.start().withIndex( FromAsIT.index ).setup(); + setupHelper.start().withIndex( FromAsConfigured.index ).setup(); - BulkIndexer fromAsIndexer = FromAsIT.index.bulkIndexer(); - FromAsIT.dataSet.contribute( FromAsIT.index, fromAsIndexer ); + BulkIndexer fromAsIndexer = FromAsConfigured.index.bulkIndexer(); + FromAsConfigured.dataSet.contribute( FromAsConfigured.index, fromAsIndexer ); fromAsIndexer.join(); } @@ -53,14 +52,18 @@ private static ObjectStructure requiredObjectStructure(boolean multivalued) { } @Nested - class FromAsIT extends AbstractCompositeProjectionFromAsIT { + class FromAsIT extends FromAsConfigured { + // JDK 11 does not allow static fields in non-static inner class and JUnit does not allow running @Nested tests in static inner classes... + } + + abstract static class FromAsConfigured extends AbstractCompositeProjectionFromAsIT { private static final SimpleMappedIndex index = SimpleMappedIndex.of( IndexBinding::new ) .name( "fromAs" ); private static final DataSet dataSet = new DataSet(); - public FromAsIT() { + public FromAsConfigured() { super( index, dataSet ); }