diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-02-04 14:40:06 +0100 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2020-02-04 14:40:06 +0100 |
commit | dd19c1df3d99d62036e912f3fd54cef723ed6b35 (patch) | |
tree | be88d7336eec6d7ecd2121e45cbd0d8a180741df /config/src/test | |
parent | ede2beb92172c99c93c932ff9fde3b4e8f47bd77 (diff) |
Minor cleanup, no functional changes
Diffstat (limited to 'config/src/test')
35 files changed, 33 insertions, 265 deletions
diff --git a/config/src/test/java/com/yahoo/config/subscription/CfgConfigPayloadBuilderTest.java b/config/src/test/java/com/yahoo/config/subscription/CfgConfigPayloadBuilderTest.java index d4280c6300f..c8693227920 100644 --- a/config/src/test/java/com/yahoo/config/subscription/CfgConfigPayloadBuilderTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/CfgConfigPayloadBuilderTest.java @@ -18,7 +18,6 @@ import static org.junit.Assert.assertEquals; /** * @author hmusum * @author Vegard Sjonfjell - * @since 5.1 */ public class CfgConfigPayloadBuilderTest { @@ -135,7 +134,7 @@ public class CfgConfigPayloadBuilderTest { " 'boolVal': 'true'", " },", " {", - " 'stringVal': 'blue a=\\\'escaped\\\'',", + " 'stringVal': 'blue a=\\'escaped\\'',", " 'boolVal': 'false'", " }", " ],", @@ -182,7 +181,7 @@ public class CfgConfigPayloadBuilderTest { assertDeserializedConfigEqualsJson("a b=\"escaped\"", inputJson( "{", - " 'a': 'b=\\\'escaped\\\''", + " 'a': 'b=\\'escaped\\''", "}" ) ); @@ -305,7 +304,7 @@ public class CfgConfigPayloadBuilderTest { } private static void assertDeserializedConfigEqualsJson(String serializedConfig, String expectedJson) { - assertDeserializedConfigEqualsJson(Arrays.asList(serializedConfig), expectedJson); + assertDeserializedConfigEqualsJson(List.of(serializedConfig), expectedJson); } private static void assertDeserializedConfigEqualsJson(List<String> inputConfig, String expectedJson) { diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInstancePayloadTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInstancePayloadTest.java index 2d0a40bcdc4..49fd25b6476 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInstancePayloadTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInstancePayloadTest.java @@ -22,7 +22,6 @@ import static org.junit.Assert.fail; /** * @author gjoranv - * @since 5.1.6 */ public class ConfigInstancePayloadTest { diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializationTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializationTest.java index 8d9b2d96b04..95ffb31fe7d 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializationTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializationTest.java @@ -3,7 +3,6 @@ package com.yahoo.config.subscription; import com.yahoo.config.ConfigInstance; import com.yahoo.foo.FunctionTestConfig; -import com.yahoo.config.codegen.DefLine; import com.yahoo.vespa.config.ConfigPayload; import org.junit.Test; @@ -18,14 +17,6 @@ import static org.junit.Assert.assertThat; */ public class ConfigInstanceSerializationTest { - private DefLine.Type stringType = new DefLine.Type("string"); - private DefLine.Type intType = new DefLine.Type("int"); - private DefLine.Type longType = new DefLine.Type("long"); - private DefLine.Type boolType = new DefLine.Type("bool"); - private DefLine.Type doubleType = new DefLine.Type("double"); - private DefLine.Type fileType = new DefLine.Type("file"); - private DefLine.Type refType = new DefLine.Type("reference"); - @Test public void require_symmetrical_serialization_and_deserialization_with_builder() { FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); @@ -40,218 +31,4 @@ public class ConfigInstanceSerializationTest { assertThat(ConfigInstance.serialize(config), is(ConfigInstance.serialize(config2))); } -/** Looks like everything in the commented block tests unused api's.. remove? - - @Test - public void testSerializeAgainstConfigDefinitionAllowNothing() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - InnerCNode def = new InnerCNode("function-test"); - List<String> payload = Validator.serialize(config, def); - Assert.assertEquals(payload.size(), 0); - } - - @Test - public void testSerializeAgainstConfigDefinitionAllLeaves() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - InnerCNode def = new InnerCNode("function-test"); - def.children().put("bool_val", LeafCNode.newInstance(boolType, def, "bool_val")); - def.children().put("bool_with_def", LeafCNode.newInstance(boolType, def, "bool_with_def")); - def.children().put("int_val", LeafCNode.newInstance(intType, def, "int_val")); - def.children().put("int_with_def", LeafCNode.newInstance(intType, def, "int_with_def")); - def.children().put("long_val", LeafCNode.newInstance(longType, def, "long_val")); - def.children().put("long_with_def", LeafCNode.newInstance(longType, def, "long_with_def")); - def.children().put("double_val", LeafCNode.newInstance(doubleType, def, "double_val")); - def.children().put("double_with_def", LeafCNode.newInstance(doubleType, def, "double_with_def")); - def.children().put("string_val", LeafCNode.newInstance(stringType, def, "string_val")); - def.children().put("stringwithdef", LeafCNode.newInstance(stringType, def, "stringwithdef")); - def.children().put("enum_val", LeafCNode.newInstance(enumType(new String[]{"FOO", "BAR", "FOOBAR"}), def, "enum_val")); - def.children().put("enumwithdef", LeafCNode.newInstance(enumType(new String[]{"FOO2", "BAR2", "FOOBAR2"}), def, "enumwithdef", "BAR2")); - def.children().put("refval", LeafCNode.newInstance(refType, def, "refval")); - def.children().put("refwithdef", LeafCNode.newInstance(refType, def, "refwithdef")); - def.children().put("fileVal", LeafCNode.newInstance(fileType, def, "fileVal")); - - List<String> payload = Validator.serialize(config, def); - String plString = payload.toString(); - Assert.assertTrue(plString.matches(".*bool_val false.*")); - Assert.assertTrue(plString.matches(".*bool_with_def true.*")); - Assert.assertTrue(plString.matches(".*int_val 5.*")); - Assert.assertTrue(plString.matches(".*int_with_def -14.*")); - Assert.assertTrue(plString.matches(".*long_val 12345678901.*")); - Assert.assertTrue(plString.matches(".*long_with_def -9876543210.*")); - Assert.assertTrue(plString.matches(".*double_val 41\\.23.*")); - Assert.assertTrue(plString.matches(".*double_with_def -12.*")); - Assert.assertTrue(plString.matches(".*string_val \"foo\".*")); - Assert.assertTrue(plString.matches(".*stringwithdef \"bar and foo\".*")); - Assert.assertTrue(plString.matches(".*enum_val FOOBAR.*")); - Assert.assertTrue(plString.matches(".*enumwithdef BAR2.*")); - Assert.assertTrue(plString.matches(".*refval \\:parent\\:.*")); - Assert.assertTrue(plString.matches(".*refwithdef \\:parent\\:.*")); - Assert.assertTrue(plString.matches(".*fileVal \"etc\".*")); - } - - @Test - public void testSerializeAgainstConfigDefinitionSomeLeaves() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - InnerCNode def = new InnerCNode("function-test"); - def.children().put("stringwithdef", LeafCNode.newInstance(stringType, def, "stringwithdef")); - def.children().put("long_with_def", LeafCNode.newInstance(longType, def, "long_with_def")); - // But not double_with_def etc, and no structs/arrays - List<String> payload = Validator.serialize(config, def); - String plString = payload.toString(); - Assert.assertTrue(plString.matches(".*long_with_def \\-9876543210.*")); - Assert.assertTrue(plString.matches(".*stringwithdef \"bar and foo\".*")); - Assert.assertFalse(plString.matches(".*double_with_def.*")); - Assert.assertFalse(plString.matches(".*fileVal \"etc\".*")); - Assert.assertFalse(plString.matches(".*basicStruct.*")); - } - - @Test - public void testSerializationAgainstConfigDefinitionAddedValsInDef() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - InnerCNode def = new InnerCNode("function-test"); - def.children().put("stringwithdef", LeafCNode.newInstance(stringType, def, "stringwithdef")); - def.children().put("someotherstring", LeafCNode.newInstance(stringType, def, "someotherstring", "some other")); - def.children().put("long_with_def", LeafCNode.newInstance(longType, def, "long_with_def")); - def.children().put("some_other_long", LeafCNode.newInstance(longType, def, "some_other_long", "88")); - def.children().put("some_other_enum", LeafCNode.newInstance(enumType(new String[]{"hey", "ho", "lets", "go"}), def, "some_other_enum", "lets")); - def.children().put("int_val_nofdef", LeafCNode.newInstance(intType, def, "int_val_nodef", null)); - - // But not double_with_def etc, and no structs/arrays - List<String> payload = Validator.serialize(config, def); - String plString = payload.toString(); - Assert.assertTrue(plString.matches(".*long_with_def \\-9876543210.*")); - Assert.assertTrue(plString.matches(".*stringwithdef \"bar and foo\".*")); - Assert.assertTrue(plString.matches(".*.someotherstring \"some other\".*")); - Assert.assertTrue(plString.matches(".*some_other_long 88.*")); - Assert.assertTrue(plString.matches(".*some_other_enum lets.*")); - Assert.assertFalse(plString.matches(".*double_with_def.*")); - Assert.assertFalse(plString.matches(".*fileVal \"etc\".*")); - Assert.assertFalse(plString.matches(".*basicStruct.*")); - Assert.assertFalse(plString.matches(".*int_val_nodef.*")); - } - - @Test - public void testSerializeAgainstConfigDefinitionMismatchAllWays() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - - // Create all sorts of mismatches in the def schema used to serialize - InnerCNode def = new InnerCNode("function-test"); - def.children().put("long_with_def", LeafCNode.newInstance(longType, def, "long_with_def")); - def.children().put("stringwithdef", LeafCNode.newInstance(intType, def, "stringwithdef")); - def.children().put("basicStruct", LeafCNode.newInstance(intType, def, "basicStruct")); - InnerCNode doubleValWrong = new InnerCNode("double_val"); - doubleValWrong.children().put("foo", LeafCNode.newInstance(intType, def, "foo")); - def.children().put("double_val", doubleValWrong); - InnerCNode myArray = new InnerCNode("myarray"); - myArray.children().put("intval", LeafCNode.newInstance(stringType, myArray, "foo")); - InnerCNode myStruct = new InnerCNode("myStruct"); - myStruct.children().put("a", LeafCNode.newInstance(stringType, myStruct, "foo")); - myArray.children().put("myStruct", myStruct); - def.children().put("myarray", myArray); - - List<String> payload = Validator.serialize(config, def); - String plString = payload.toString(); - Assert.assertTrue(plString.matches(".*long_with_def.*")); - Assert.assertFalse(plString.matches(".*stringwithdef.*")); - Assert.assertFalse(plString.matches(".*basicStruct.*")); - Assert.assertFalse(plString.matches(".*double_val.*")); - Assert.assertFalse(plString.matches(".*intval.*")); - Assert.assertFalse(plString.matches(".*\\.a.*")); - } - - @Test - public void testSerializeAgainstConfigDefinitionComplex() { - FunctionTestConfig config = ConfigInstancePayloadTest.createVariableAccessConfigWithBuilder(); - - // Build a pretty complex def programatically - InnerCNode def = new InnerCNode("function-test"); - def.children().put("stringwithdef", LeafCNode.newInstance(stringType, def, "stringwithdef")); - def.children().put("someUnknownStringNoDefault", LeafCNode.newInstance(stringType, def, "someUnknownStringNoDefault")); - InnerCNode basicStruct = new InnerCNode("basicStruct"); - basicStruct.children().put("foo", LeafCNode.newInstance(stringType, def, "foo")); // but not bar - InnerCNode rootStruct = new InnerCNode("rootStruct"); - InnerCNode inner1 = new InnerCNode("inner1"); - InnerCNode someUnknwonStruct = new InnerCNode("someUnknownStruct"); - InnerCNode someUnknownInner = new InnerCNode("someUnknownInner"); - InnerCNode innerArr = new InnerCNode("innerArr"); - rootStruct.children().put("inner1", inner1); - rootStruct.children().put("someUnknownStruct", someUnknwonStruct); - rootStruct.children().put("someUnknownInner", someUnknownInner); - rootStruct.children().put("innerArr", innerArr); - InnerCNode myarray = new InnerCNode("myarray"); - InnerCNode unknownInner = new InnerCNode("unknownInner"); - def.children().put("basicStruct", basicStruct); - def.children().put("rootStruct", rootStruct); - def.children().put("myarray", myarray); - def.children().put("unknownInner", unknownInner); - inner1.children().put("index", LeafCNode.newInstance(intType, inner1, "index")); - inner1.children().put("someUnknownInt", LeafCNode.newInstance(intType, inner1, "someUnknownInt", "-98")); - inner1.children().put("someUnknownIntNoDefault", LeafCNode.newInstance(intType, inner1, "someUnknownIntNoDefault")); - inner1.children().put("someUnknownEnum", LeafCNode.newInstance(enumType(new String[]{"goo", "go", "gorilla"}), inner1, "someUnknownEnum", "go")); - inner1.children().put("someUnknownEnumNoDefault", LeafCNode.newInstance(enumType(new String[]{"foo", "bar", "baz"}), inner1, "someUnknownEnumNoDefault")); - someUnknwonStruct.children().put("anint", LeafCNode.newInstance(intType, someUnknwonStruct, "anint", "3"));// But no instances of this in config - someUnknownInner.children().put("along", LeafCNode.newInstance(longType, someUnknownInner, "along", "234"));// No instance in config - innerArr.children().put("boolVal", LeafCNode.newInstance(boolType, innerArr, "boolVal")); - innerArr.children().put("someUnknownDouble", LeafCNode.newInstance(doubleType, innerArr, "someUnknownDouble", "-675.789")); - innerArr.children().put("someUnknownDoubleNoDefault", LeafCNode.newInstance(doubleType, innerArr, "someUnknownDoubleNoDefault")); - myarray.children().put("fileVal", LeafCNode.newInstance(fileType, myarray, "fileVal")); - myarray.children().put("stringval", new InnerCNode("stringval[]")); - // TODO make sure default for file is not allowed - //myarray.children().put("someUnknownFile", LeafCNode.newInstance(fileType, myarray, "someUnknownFile", "opt/")); - unknownInner.children().put("aDouble", LeafCNode.newInstance(doubleType, unknownInner, "aDouble", "1234")); - def.children().put("longarr", new InnerCNode("longarr[]")); - def.children().put("boolarr", new InnerCNode("boolarr[]")); - def.children().put("doublearr", new InnerCNode("doublearr[]")); - def.children().put("stringarr", new InnerCNode("stringarr[]")); - def.children().put("fileArr", new InnerCNode("fileArr[]")); - def.children().put("refarr", new InnerCNode("refarr[]")); - def.children().put("enumarr", new InnerCNode("enumarr[]")); - List<String> payload = Validator.serialize(config, def); - String plString = payload.toString(); - Assert.assertFalse(plString.matches(".*long_with_def \\-9876543210.*")); - Assert.assertFalse(plString.matches(".*someUnknownStringNoDefault.*")); - Assert.assertTrue(plString.matches(".*stringwithdef \"bar and foo\".*")); - Assert.assertFalse(plString.matches(".*double_with_def.*")); - Assert.assertFalse(plString.matches(".*fileVal etc.*")); - Assert.assertTrue(plString.matches(".*basicStruct\\.foo \"basicFoo\".*")); - Assert.assertFalse(plString.matches(".*basicStruct\\.bar.*")); - Assert.assertFalse(plString.matches(".*rootStruct\\.inner0.*")); - Assert.assertFalse(plString.matches(".*unknownInner.*")); - Assert.assertFalse(plString.matches(".*rootStruct\\.someUnknownStruct.*")); - Assert.assertFalse(plString.matches(".*rootStruct\\.someUnknownInner.*")); - Assert.assertFalse(plString.matches(".*rootStruct\\.inner1\\.name.*")); - Assert.assertTrue(plString.matches(".*rootStruct\\.inner1\\.index 12.*")); - Assert.assertTrue(plString.matches(".*rootStruct\\.inner1\\.someUnknownInt -98.*")); - Assert.assertTrue(plString.matches(".*rootStruct\\.inner1\\.someUnknownEnum go.*")); - Assert.assertTrue(plString.matches(".*rootStruct\\.innerArr\\[0\\]\\.boolVal true.*")); - Assert.assertFalse(plString.matches(".*someUnknownEnumNoDefault.*")); - Assert.assertFalse(plString.matches(".*someUnknownDoubleNoDefault.*")); - Assert.assertFalse(plString.matches(".*someUnknownIntNoDefault.*")); - Assert.assertTrue(plString.matches(".*rootStruct\\.innerArr\\[0\\]\\.someUnknownDouble -675.789.*")); - Assert.assertFalse(plString.matches(".*rootStruct\\.innerArr\\[0\\]\\.stringVal*")); - Assert.assertFalse(plString.matches(".*myarray\\[0\\].intval.*")); - Assert.assertTrue(plString.matches(".*myarray\\[0\\].fileVal \"file0\".*")); - //assertTrue(plString.matches(".*myarray\\[0\\].someUnknownFile \"opt/\".*")); - Assert.assertTrue(plString.matches(".*myarray\\[0\\].stringval\\[0\\] \"baah\".*")); - Assert.assertTrue(plString.matches(".*myarray\\[0\\].stringval\\[1\\] \"yikes\".*")); - Assert.assertTrue(plString.matches(".*myarray\\[1\\].fileVal \"file1\".*")); - Assert.assertFalse(plString.matches(".*myarray\\[1\\].enumVal.*")); - Assert.assertFalse(plString.matches(".*myarray\\[1\\].refVal.*")); - Assert.assertTrue(plString.matches(".*boolarr\\[0\\] false.*")); - Assert.assertTrue(plString.matches(".*longarr\\[0\\] 9223372036854775807.*")); - Assert.assertTrue(plString.matches(".*longarr\\[1\\] -9223372036854775808.*")); - Assert.assertTrue(plString.matches(".*doublearr\\[0\\] 2344\\.0.*")); - Assert.assertTrue(plString.matches(".*doublearr\\[1\\] 123\\.0.*")); - Assert.assertTrue(plString.matches(".*stringarr\\[0\\] \"bar\".*")); - Assert.assertTrue(plString.matches(".*enumarr\\[0\\] VALUES.*")); - Assert.assertTrue(plString.matches(".*refarr\\[0\\] \\:parent\\:.*")); - Assert.assertTrue(plString.matches(".*refarr\\[1\\] \\:parent.*")); - Assert.assertTrue(plString.matches(".*refarr\\[2\\] parent\\:.*")); - Assert.assertTrue(plString.matches(".*fileArr\\[0\\] \"bin\".*")); - } - - private DefLine.Type enumType(String[] strings) { - return new DefLine.Type("enum").setEnumArray(strings); - } -**/ } diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializerTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializerTest.java index ee8682efe3c..7c08d0175a1 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializerTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceSerializerTest.java @@ -21,9 +21,9 @@ import static org.junit.Assert.fail; /** * @author Ulf Lilleengen * @author Vegard Sjonfjell - * @since 5.1 */ public class ConfigInstanceSerializerTest { + @Test public void test_that_leaf_types_are_serialized_to_json_types() { SimpletypesConfig.Builder builder = new SimpletypesConfig.Builder(); @@ -225,4 +225,5 @@ public class ConfigInstanceSerializerTest { assertJsonEquals(baos.toString(), expectedJson); } + } diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceTest.java index 1da53e4c3b9..4da0c3f51e0 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceTest.java @@ -12,7 +12,7 @@ import static org.junit.Assert.fail; /** * Tests different aspects of the ConfigInstance class and its underlying Nodes. * - * @author <a href="gv@yahoo-inc.com">G. Voldengen</a> + * @author gjoranv */ public class ConfigInstanceTest { private ConfigSourceSet sourceSet = new ConfigSourceSet("config-instance-test"); diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceUtilTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceUtilTest.java index 078be819d33..3bdaee09eaf 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceUtilTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInstanceUtilTest.java @@ -22,7 +22,6 @@ import static com.yahoo.foo.FunctionTestConfig.*; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigInstanceUtilTest { diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigInterruptedExceptionTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigInterruptedExceptionTest.java index 35f4f14b4f4..a80da63afc9 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigInterruptedExceptionTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigInterruptedExceptionTest.java @@ -8,9 +8,9 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigInterruptedExceptionTest { + @Test public void require_that_throwable_is_preserved() { ConfigInterruptedException e = new ConfigInterruptedException(new RuntimeException("foo")); diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java index a120f19c17b..48a51bbc02c 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigSetTest.java @@ -10,9 +10,9 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigSetTest { + @Test public void testToString() { ConfigSet set = new ConfigSet(); diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigSourceSetTest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigSourceSetTest.java index 38d4a6a4571..0879c330f45 100755 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigSourceSetTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigSourceSetTest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.*; * @author <a href="gv@yahoo-inc.com">G. Voldengen</a> */ public class ConfigSourceSetTest { + @Test public void testEquals() { assertEquals(new ConfigSourceSet(), new ConfigSourceSet()); diff --git a/config/src/test/java/com/yahoo/config/subscription/ConfigURITest.java b/config/src/test/java/com/yahoo/config/subscription/ConfigURITest.java index 43e3cf658f3..555434837c8 100644 --- a/config/src/test/java/com/yahoo/config/subscription/ConfigURITest.java +++ b/config/src/test/java/com/yahoo/config/subscription/ConfigURITest.java @@ -12,9 +12,9 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigURITest { + @Test public void testDefaultUri() { ConfigURI uri = ConfigURI.createFromId("foo"); diff --git a/config/src/test/java/com/yahoo/config/subscription/DefaultConfigTest.java b/config/src/test/java/com/yahoo/config/subscription/DefaultConfigTest.java index 85346264837..1bcf09a4028 100644 --- a/config/src/test/java/com/yahoo/config/subscription/DefaultConfigTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/DefaultConfigTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; * @author hmusum */ public class DefaultConfigTest { + static final String CONFIG_ID = "raw:" + "nondefaultstring ####-------missing--------\n" + "defaultstring \"thedefault\"\n" + diff --git a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java index cb25de89bfb..08d215670db 100644 --- a/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/GenericConfigSubscriberTest.java @@ -21,7 +21,6 @@ import static org.junit.Assert.*; * Test cases for the "generic" (class-less) subscription mechanism. * * @author Ulf Lilleengen - * @since 5.1 */ public class GenericConfigSubscriberTest { @@ -52,7 +51,6 @@ public class GenericConfigSubscriberTest { GenericConfigSubscriber sub = new GenericConfigSubscriber(requesters); assertEquals(sub.requesters().get(source1).getConnectionPool().getCurrent().getAddress(), "tcp/foo:78"); assertEquals(sub.requesters().get(source2).getConnectionPool().getCurrent().getAddress(), "tcp/bar:79"); - } @Test(expected=UnsupportedOperationException.class) diff --git a/config/src/test/java/com/yahoo/config/subscription/NamespaceTest.java b/config/src/test/java/com/yahoo/config/subscription/NamespaceTest.java index 5e60c273ee4..430de894629 100644 --- a/config/src/test/java/com/yahoo/config/subscription/NamespaceTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/NamespaceTest.java @@ -11,6 +11,7 @@ import static org.junit.Assert.assertThat; * @author gjoranv */ public class NamespaceTest { + @Test public void verifyConfigClassWithExplicitNamespace() { NamespaceConfig config = new ConfigGetter<>(NamespaceConfig.class).getConfig("raw: a 0\n"); diff --git a/config/src/test/java/com/yahoo/config/subscription/UnicodeTest.java b/config/src/test/java/com/yahoo/config/subscription/UnicodeTest.java index 6512b5ea29e..f1bd164c874 100644 --- a/config/src/test/java/com/yahoo/config/subscription/UnicodeTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/UnicodeTest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertEquals; * @author Harald Musum */ public class UnicodeTest { + /** * Reads a config from a file which is exactly like one returned from * the config server given only default values for this config. diff --git a/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java b/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java index 2f550fc8e1e..71e7a9f08d7 100644 --- a/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1.7 */ public class FileConfigSubscriptionTest { private File TEST_TYPES_FILE; diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigBuilderMergeTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigBuilderMergeTest.java index c77985c91d8..137d2894164 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigBuilderMergeTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigBuilderMergeTest.java @@ -18,7 +18,6 @@ import static org.junit.Assert.assertThat; * SEO keywords: test override() on builders. overrideTest, testOverride * * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigBuilderMergeTest { diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigCacheKeyTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigCacheKeyTest.java index bb65fdaa153..fce61cc802c 100755 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigCacheKeyTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigCacheKeyTest.java @@ -12,6 +12,7 @@ import static org.junit.Assert.*; * @author hmusum */ public class ConfigCacheKeyTest { + @Test public void testConfigCacheKey() { final String defMd5 = "md5"; diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigDefinitionBuilderTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigDefinitionBuilderTest.java index dba73223097..810b9f58829 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigDefinitionBuilderTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigDefinitionBuilderTest.java @@ -12,7 +12,6 @@ import java.io.IOException; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; - /** * Unit tests for ConfigDefinitionBuilder. * diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigFileFormatterTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigFileFormatterTest.java index 3cc030d944b..5198759d3e2 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigFileFormatterTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigFileFormatterTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigFileFormatterTest { diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadBuilderTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadBuilderTest.java index eb0c47e3b0a..c13d3ec9b9b 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadBuilderTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadBuilderTest.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ConfigPayloadBuilderTest { diff --git a/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadTest.java b/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadTest.java index f1b0adc03e7..b3db6e2ab43 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ConfigPayloadTest.java @@ -24,8 +24,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; /** - * @author Ulf Lilleengen 3 - * @since 5.1 + * @author Ulf Lilleengen */ public class ConfigPayloadTest { diff --git a/config/src/test/java/com/yahoo/vespa/config/DefaultValueApplierTest.java b/config/src/test/java/com/yahoo/vespa/config/DefaultValueApplierTest.java index e67489b4030..6ab3059f1c0 100644 --- a/config/src/test/java/com/yahoo/vespa/config/DefaultValueApplierTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/DefaultValueApplierTest.java @@ -16,9 +16,9 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.1 */ public class DefaultValueApplierTest { + public Slime apply(Slime slime, String ... extraFields) { StringBuilder defBuilder = new StringBuilder(); defBuilder.append("namespace=test").append("\n"); diff --git a/config/src/test/java/com/yahoo/vespa/config/ErrorCodeTest.java b/config/src/test/java/com/yahoo/vespa/config/ErrorCodeTest.java index 8e6cc1fc6a0..64210eaa4b8 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ErrorCodeTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ErrorCodeTest.java @@ -8,9 +8,9 @@ import static org.junit.Assert.assertThat; /** * @author hmusum - * @since 5.1.9 */ public class ErrorCodeTest { + @Test public void basic() { assertThat(ErrorCode.getName(ErrorCode.INTERNAL_ERROR), is("INTERNAL_ERROR")); diff --git a/config/src/test/java/com/yahoo/vespa/config/ErrorTypeTest.java b/config/src/test/java/com/yahoo/vespa/config/ErrorTypeTest.java index 450d7e8d6d8..a0b2c1185a7 100644 --- a/config/src/test/java/com/yahoo/vespa/config/ErrorTypeTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/ErrorTypeTest.java @@ -8,7 +8,6 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.1 */ public class ErrorTypeTest { @@ -32,4 +31,5 @@ public class ErrorTypeTest { assertThat(ErrorType.getErrorType(ErrorCode.ILLEGAL_SUB_FLAG), is(ErrorType.FATAL)); assertThat(ErrorType.getErrorType(0xdeadc0de), is(ErrorType.FATAL)); } + } diff --git a/config/src/test/java/com/yahoo/vespa/config/GenericConfigBuilderTest.java b/config/src/test/java/com/yahoo/vespa/config/GenericConfigBuilderTest.java index ee7845086c2..2c60ff95fee 100644 --- a/config/src/test/java/com/yahoo/vespa/config/GenericConfigBuilderTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/GenericConfigBuilderTest.java @@ -13,9 +13,9 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.1 */ public class GenericConfigBuilderTest { + @Test public void require_that_builder_can_be_overridden() throws IOException { ConfigPayloadBuilder ba = new ConfigPayloadBuilder(); diff --git a/config/src/test/java/com/yahoo/vespa/config/LZ4CompressionTest.java b/config/src/test/java/com/yahoo/vespa/config/LZ4CompressionTest.java index a3125c73bea..805efc90ade 100644 --- a/config/src/test/java/com/yahoo/vespa/config/LZ4CompressionTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/LZ4CompressionTest.java @@ -15,7 +15,6 @@ import java.nio.file.Files; * To run this test, place a payload in src/test/ca.json. The file is not checked in because it is huge. * * @author Ulf Lilleengen - * @since 5.12 */ public class LZ4CompressionTest { private static LZ4Factory factory = LZ4Factory.safeInstance(); diff --git a/config/src/test/java/com/yahoo/vespa/config/LZ4PayloadCompressorTest.java b/config/src/test/java/com/yahoo/vespa/config/LZ4PayloadCompressorTest.java index 06bbaad4271..635d6a96a7c 100644 --- a/config/src/test/java/com/yahoo/vespa/config/LZ4PayloadCompressorTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/LZ4PayloadCompressorTest.java @@ -9,9 +9,9 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.19 */ public class LZ4PayloadCompressorTest { + @Test public void testCompression() { assertCompression("hei hallo der"); diff --git a/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java b/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java index a564fea8b2e..3f6c54ea46e 100644 --- a/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/RawConfigTest.java @@ -113,11 +113,11 @@ public class RawConfigTest { assertThat(config.getDefMd5(), is(defMd5)); config = new RawConfig(key, null, payload, configMd5, generation, false, null, Optional.empty()); assertNull(config.getDefMd5()); - config = new RawConfig(key, null, payload, configMd5, generation, false, Arrays.asList(""), Optional.empty()); + config = new RawConfig(key, null, payload, configMd5, generation, false,List.of(""), Optional.empty()); assertThat(config.getDefMd5(), is(defMd5ForEmptyDefContent)); config = new RawConfig(key, "", payload, configMd5, generation, false, null, Optional.empty()); assertThat(config.getDefMd5(), is("")); - config = new RawConfig(key, "", payload, configMd5, generation, false, Arrays.asList(""), Optional.empty()); + config = new RawConfig(key, "", payload, configMd5, generation, false, List.of(""), Optional.empty()); assertThat(config.getDefMd5(), is(defMd5ForEmptyDefContent)); } diff --git a/config/src/test/java/com/yahoo/vespa/config/SlimeUtilsTest.java b/config/src/test/java/com/yahoo/vespa/config/SlimeUtilsTest.java index ff7b640630e..5def6d899a0 100644 --- a/config/src/test/java/com/yahoo/vespa/config/SlimeUtilsTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/SlimeUtilsTest.java @@ -14,9 +14,9 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.8 */ public class SlimeUtilsTest { + @Test public void test_copying_slime_types_into_cursor() { Slime slime = new Slime(); @@ -79,4 +79,5 @@ public class SlimeUtilsTest { assertThat(slime.get().field("foo").asString(), is("foobie")); assertTrue(slime.get().field("bar").valid()); } + } diff --git a/config/src/test/java/com/yahoo/vespa/config/TimingValuesTest.java b/config/src/test/java/com/yahoo/vespa/config/TimingValuesTest.java index 3b97c360c4b..0be5e98ff0a 100644 --- a/config/src/test/java/com/yahoo/vespa/config/TimingValuesTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/TimingValuesTest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertThat; * @author hmusum */ public class TimingValuesTest { + @Test public void basic() { TimingValues tv = new TimingValues(); diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestBase.java b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestBase.java index 75ba1392fd1..db594cb8c5b 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestBase.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestBase.java @@ -24,7 +24,6 @@ import com.yahoo.vespa.config.util.ConfigUtils; import org.junit.Before; import org.junit.Test; -import java.io.IOException; import java.util.Collections; import java.util.Optional; @@ -36,7 +35,6 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.3 */ public abstract class JRTConfigRequestBase { @@ -54,19 +52,19 @@ public abstract class JRTConfigRequestBase { protected JRTServerConfigRequest serverReq; @Before - public void setupRequest() throws IOException { + public void setupRequest() { clientReq = createReq(); serverReq = createReq(clientReq.getRequest()); assertTrue(serverReq.validateParameters()); } - private JRTClientConfigRequest createReq() throws IOException { + private JRTClientConfigRequest createReq() { trace = Trace.createNew(3, new ManualClock()); trace.trace(1, "hei"); return createReq(defName, defNamespace, defMd5, hostname, configId, configMd5, currentGeneration, timeout, trace); } - private JRTClientConfigRequest createReq(Payload payload) throws IOException { + private JRTClientConfigRequest createReq(Payload payload) { trace = Trace.createNew(3, new ManualClock()); trace.trace(1, "hei"); return createReq(defName, defNamespace, defMd5, hostname, configId, ConfigUtils.getMd5(payload.getData()), currentGeneration, timeout, trace); @@ -195,7 +193,7 @@ public abstract class JRTConfigRequestBase { } @Test - public void payload_is_empty() throws IOException { + public void payload_is_empty() { Payload payload = Payload.from(ConfigPayload.empty()); clientReq = createReq(payload); serverReq = createReq(clientReq.getRequest()); @@ -258,7 +256,7 @@ public abstract class JRTConfigRequestBase { protected abstract String getProtocolVersion(); @Test - public void created_from_raw() throws IOException { + public void created_from_raw() { RawConfig rawConfig = new RawConfig(new ConfigKey<>(defName, configId, defNamespace), defMd5); long serverTimeout = 100000L; JRTClientConfigRequest request = createFromRaw(rawConfig, serverTimeout, Trace.createNew(9)); @@ -269,9 +267,8 @@ public abstract class JRTConfigRequestBase { assertThat(serverRequest.getDefContent().asList(), is(rawConfig.getDefContent())); } - @Test - public void parameters_are_validated() throws IOException { + public void parameters_are_validated() { assertTrue(serverReq.validateParameters()); assertValidationFail(createReq("35#$#!$@#", defNamespace, defMd5, hostname, configId, configMd5, currentGeneration, timeout, trace)); assertValidationFail(createReq(defName, "abcd.o#$*(!&$", defMd5, hostname, configId, configMd5, currentGeneration, timeout, trace)); diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java index d50a92efc1a..e176ce6e8cd 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/JRTConfigRequestV3Test.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.19 */ public class JRTConfigRequestV3Test extends JRTConfigRequestBase { diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/PayloadTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/PayloadTest.java index e5fc5190ad1..c52245ecb35 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/PayloadTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/PayloadTest.java @@ -15,7 +15,6 @@ import static org.junit.Assert.assertThat; /** * @author Ulf Lilleengen - * @since 5.21 */ public class PayloadTest { diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/SlimeTraceSerializerTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/SlimeTraceSerializerTest.java index f2d9edc7c35..22baab85c1c 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/SlimeTraceSerializerTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/SlimeTraceSerializerTest.java @@ -21,9 +21,9 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.5 */ public class SlimeTraceSerializerTest { + @Test public void test_serializer() throws IOException { TraceNode root = new TraceNode(null, 1); diff --git a/config/src/test/java/com/yahoo/vespa/config/protocol/TraceTest.java b/config/src/test/java/com/yahoo/vespa/config/protocol/TraceTest.java index 596983eebb8..4b191d85121 100644 --- a/config/src/test/java/com/yahoo/vespa/config/protocol/TraceTest.java +++ b/config/src/test/java/com/yahoo/vespa/config/protocol/TraceTest.java @@ -9,7 +9,6 @@ import static org.junit.Assert.assertTrue; /** * @author Ulf Lilleengen - * @since 5.3 */ public class TraceTest { @@ -58,4 +57,5 @@ public class TraceTest { assertTrue(trace2Str.contains("barbaz")); assertTrue(trace2Str.contains("quux")); } + } |