diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java index 03641e95f84..9c2c830c36f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/search/test/QueryProfilesTestCase.java @@ -17,15 +17,13 @@ import com.yahoo.search.query.profile.types.QueryProfileTypeRegistry; import com.yahoo.schema.derived.TestableDeployLogger; import com.yahoo.vespa.model.container.search.QueryProfiles; import com.yahoo.vespa.model.test.utils.DeployLoggerStub; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.logging.Level; import static helpers.CompareConfigTestHelper.assertSerializedConfigFileEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Tests generation of config from query profiles (XML reading is tested elsewhere) @@ -37,7 +35,7 @@ public class QueryProfilesTestCase { private final static String root = "src/test/java/com/yahoo/vespa/model/container/search/test/"; @Test - public void testVariantReference() { + void testVariantReference() { QueryProfileRegistry registry = new QueryProfileRegistry(); QueryProfile parent = new QueryProfile("parent"); @@ -46,31 +44,31 @@ public class QueryProfilesTestCase { QueryProfile referenced = new QueryProfile("referenced"); referenced.addInherited(parent); - referenced.setDimensions(new String[] { "d2", "d3" }); + referenced.setDimensions(new String[]{"d2", "d3"}); registry.register(referenced); QueryProfile base = new QueryProfile("base"); - base.setDimensions(new String[] { "d1", "d2", "d3" }); - base.set("a", referenced, new String[] { null, null, "d3-val" }, registry); - base.set("a.b", 1, new String[] { null, null, "d3-val" }, registry); + base.setDimensions(new String[]{"d1", "d2", "d3"}); + base.set("a", referenced, new String[]{ null, null, "d3-val"}, registry); + base.set("a.b", 1, new String[]{ null, null, "d3-val"}, registry); QueryProfileVariant aVariants = base.getVariants().getVariants().get(0); - QueryProfile a = (QueryProfile)aVariants.values().get("a"); + QueryProfile a = (QueryProfile) aVariants.values().get("a"); assertEquals("[d1, d2, d3]", a.getDimensions().toString()); registry.register(base); QueryProfiles profiles = new QueryProfiles(registry, new TestableDeployLogger()); QueryProfileRegistry registryFromConfig = QueryProfileConfigurer.createFromConfig(profiles.getConfig()); var directValue = registry.findQueryProfile("base") - .get("a.b", - new String[] { "default", null, "d3-val"}); + .get("a.b", + new String[]{"default", null, "d3-val"}); var throughConfigValue = registryFromConfig.findQueryProfile("base") - .get("a.b", - new String[] { "default", null, "d3-val"}); + .get("a.b", + new String[]{"default", null, "d3-val"}); assertEquals(directValue.toString(), throughConfigValue.toString()); } @Test - public void testVariants() { + void testVariants() { QueryProfileRegistry registry = new QueryProfileXMLReader().read(root + "variants"); QueryProfiles profiles = new QueryProfiles(registry, new TestableDeployLogger()); QueryProfileRegistry registryFromConfig = QueryProfileConfigurer.createFromConfig(profiles.getConfig()); @@ -84,13 +82,13 @@ public class QueryProfilesTestCase { } @Test - public void testEmpty() throws IOException { + void testEmpty() throws IOException { QueryProfileRegistry reg = new QueryProfileRegistry(); assertConfig("empty.cfg", reg); } @Test - public void testQueryProfiles() throws IOException { + void testQueryProfiles() throws IOException { final boolean mandatory = true; final boolean overridable = true; QueryProfileRegistry registry = new QueryProfileRegistry(); @@ -118,13 +116,13 @@ public class QueryProfilesTestCase { typeRegistry.register(marketType); QueryProfile defaultProfile = new QueryProfile("default"); - defaultProfile.set("ranking","production23", registry); + defaultProfile.set("ranking", "production23", registry); defaultProfile.set("representation.defaultIndex", "title", registry); defaultProfile.setOverridable("representation.defaultIndex", false, DimensionValues.empty); registry.register(defaultProfile); QueryProfile test = new QueryProfile("test"); - test.set("tracelevel",2, registry); + test.set("tracelevel", 2, registry); registry.register(test); QueryProfile genericUser = new QueryProfile("genericUser"); @@ -147,8 +145,8 @@ public class QueryProfilesTestCase { QueryProfile marketUser = new QueryProfile("marketUser"); marketUser.setType(userType); marketUser.addInherited(genericUser); - marketUser.set("ads","none", registry); - marketUser.set("age",25, registry); + marketUser.set("ads", "none", registry); + marketUser.set("age", 25, registry); registry.register(marketUser); QueryProfile market = new QueryProfile("root/market"); @@ -173,7 +171,7 @@ public class QueryProfilesTestCase { } @Test - public void testValidation() { + void testValidation() { QueryProfileRegistry registry = new QueryProfileRegistry(); QueryProfileTypeRegistry typeRegistry = registry.getTypeRegistry(); @@ -184,13 +182,13 @@ public class QueryProfilesTestCase { new QueryProfiles(registry, logger); assertEquals(1, logger.entries.size()); assertEquals("This application define query profile types, but has no query profiles referencing them " + - "so they have no effect. " + - "See https://docs.vespa.ai/en/query-profiles.html", - logger.entries.get(0).message); + "so they have no effect. " + + "See https://docs.vespa.ai/en/query-profiles.html", + logger.entries.get(0).message); } @Test - public void testValidationWithTensorFields() { + void testValidationWithTensorFields() { QueryProfileRegistry registry = new QueryProfileRegistry(); QueryProfileTypeRegistry typeRegistry = registry.getTypeRegistry(); @@ -203,10 +201,10 @@ public class QueryProfilesTestCase { new QueryProfiles(registry, logger); assertEquals(1, logger.entries.size()); assertEquals("This application define query profile types, but has no query profiles referencing them " + - "so they have no effect. " + - "In particular, the tensors (vector, matrix) will be interpreted as strings, not tensors if sent in requests. " + - "See https://docs.vespa.ai/en/query-profiles.html", - logger.entries.get(0).message); + "so they have no effect. " + + "In particular, the tensors (vector, matrix) will be interpreted as strings, not tensors if sent in requests. " + + "See https://docs.vespa.ai/en/query-profiles.html", + logger.entries.get(0).message); } protected void assertConfig(String correctFileName, QueryProfileRegistry check) throws IOException { |