diff options
Diffstat (limited to 'config-model/src/test/java/com/yahoo/vespa/model/content')
27 files changed, 768 insertions, 789 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java index cf7cd07e440..14e6efe7dff 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ClusterResourceLimitsTest.java @@ -5,15 +5,12 @@ import com.yahoo.config.model.api.ModelContext; import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.text.XML; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import java.util.Optional; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author geirst @@ -61,7 +58,7 @@ public class ClusterResourceLimitsTest { } @Test - public void content_node_limits_are_derived_from_cluster_controller_limits_if_not_set() { + void content_node_limits_are_derived_from_cluster_controller_limits_if_not_set() { assertLimits(0.4, 0.7, 0.76, 0.85, new Fixture().ctrlDisk(0.4).ctrlMemory(0.7)); assertLimits(0.4, 0.8, 0.76, 0.9, @@ -71,7 +68,7 @@ public class ClusterResourceLimitsTest { } @Test - public void content_node_limits_can_be_set_explicit() { + void content_node_limits_can_be_set_explicit() { assertLimits(0.4, 0.7, 0.9, 0.95, new Fixture().ctrlDisk(0.4).ctrlMemory(0.7).nodeDisk(0.9).nodeMemory(0.95)); assertLimits(0.4, 0.8, 0.95, 0.9, @@ -81,7 +78,7 @@ public class ClusterResourceLimitsTest { } @Test - public void cluster_controller_limits_are_equal_to_content_node_limits_minus_one_percent_if_not_set() { + void cluster_controller_limits_are_equal_to_content_node_limits_minus_one_percent_if_not_set() { assertLimits(0.89, 0.94, 0.9, 0.95, new Fixture().nodeDisk(0.9).nodeMemory(0.95)); assertLimits(0.89, 0.8, 0.9, 0.9, @@ -93,7 +90,7 @@ public class ClusterResourceLimitsTest { } @Test - public void limits_are_derived_from_the_other_if_not_set() { + void limits_are_derived_from_the_other_if_not_set() { assertLimits(0.6, 0.94, 0.84, 0.95, new Fixture().ctrlDisk(0.6).nodeMemory(0.95)); assertLimits(0.89, 0.7, 0.9, 0.85, @@ -101,13 +98,13 @@ public class ClusterResourceLimitsTest { } @Test - public void default_resource_limits_when_feed_block_is_enabled_in_distributor() { + void default_resource_limits_when_feed_block_is_enabled_in_distributor() { assertLimits(0.75, 0.8, 0.9, 0.9, new Fixture(true)); } @Test - public void hosted_exception_is_thrown_when_resource_limits_are_specified() { + void hosted_exception_is_thrown_when_resource_limits_are_specified() { try { hostedBuild(); fail(); @@ -117,7 +114,7 @@ public class ClusterResourceLimitsTest { } @Test - public void hosted_limits_from_feature_flag_are_used() { + void hosted_limits_from_feature_flag_are_used() { TestProperties featureFlags = new TestProperties(); featureFlags.setResourceLimitDisk(0.85); featureFlags.setResourceLimitMemory(0.90); @@ -129,7 +126,7 @@ public class ClusterResourceLimitsTest { } @Test - public void exception_is_thrown_when_resource_limits_are_out_of_range() { + void exception_is_thrown_when_resource_limits_are_out_of_range() { TestProperties featureFlags = new TestProperties(); featureFlags.setResourceLimitDisk(1.1); @@ -188,7 +185,7 @@ public class ClusterResourceLimitsTest { if (expLimit == null) { assertFalse(actLimit.isPresent()); } else { - assertEquals(limitType + " limit not as expected", expLimit, actLimit.get(), 0.00001); + assertEquals(expLimit, actLimit.get(), 0.00001, limitType + " limit not as expected"); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentBaseTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentBaseTest.java index 03fcf8df213..ccff07109a7 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentBaseTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentBaseTest.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.model.content; import com.yahoo.messagebus.routing.RouteSpec; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class ContentBaseTest { public static String getHosts() { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java index 8c263e21a21..cfb2fceb60b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java @@ -38,7 +38,7 @@ import com.yahoo.vespa.model.routing.DocumentProtocol; import com.yahoo.vespa.model.routing.Routing; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; @@ -47,13 +47,7 @@ import java.util.Map; import java.util.Optional; import java.util.OptionalInt; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class ContentClusterTest extends ContentBaseTest { @@ -66,41 +60,41 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testHierarchicRedundancy() { + void testHierarchicRedundancy() { ContentCluster cc = parse("" + - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <engine>" + - " <proton>" + - " <searchable-copies>3</searchable-copies>" + - " </proton>" + - " </engine>" + - " <redundancy>15</redundancy>\n" + - " <group name='root' distribution-key='0'>" + - " <distribution partitions='1|1|*'/>" + - " <group name='g-1' distribution-key='0'>" + - " <node hostalias='mockhost' distribution-key='0'/>" + - " <node hostalias='mockhost' distribution-key='1'/>" + - " <node hostalias='mockhost' distribution-key='2'/>" + - " <node hostalias='mockhost' distribution-key='3'/>" + - " <node hostalias='mockhost' distribution-key='4'/>" + - " </group>" + - " <group name='g-2' distribution-key='1'>" + - " <node hostalias='mockhost' distribution-key='5'/>" + - " <node hostalias='mockhost' distribution-key='6'/>" + - " <node hostalias='mockhost' distribution-key='7'/>" + - " <node hostalias='mockhost' distribution-key='8'/>" + - " <node hostalias='mockhost' distribution-key='9'/>" + - " </group>" + - " <group name='g-3' distribution-key='1'>" + - " <node hostalias='mockhost' distribution-key='10'/>" + - " <node hostalias='mockhost' distribution-key='11'/>" + - " <node hostalias='mockhost' distribution-key='12'/>" + - " <node hostalias='mockhost' distribution-key='13'/>" + - " <node hostalias='mockhost' distribution-key='14'/>" + - " </group>" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <engine>" + + " <proton>" + + " <searchable-copies>3</searchable-copies>" + + " </proton>" + + " </engine>" + + " <redundancy>15</redundancy>\n" + + " <group name='root' distribution-key='0'>" + + " <distribution partitions='1|1|*'/>" + + " <group name='g-1' distribution-key='0'>" + + " <node hostalias='mockhost' distribution-key='0'/>" + + " <node hostalias='mockhost' distribution-key='1'/>" + + " <node hostalias='mockhost' distribution-key='2'/>" + + " <node hostalias='mockhost' distribution-key='3'/>" + + " <node hostalias='mockhost' distribution-key='4'/>" + + " </group>" + + " <group name='g-2' distribution-key='1'>" + + " <node hostalias='mockhost' distribution-key='5'/>" + + " <node hostalias='mockhost' distribution-key='6'/>" + + " <node hostalias='mockhost' distribution-key='7'/>" + + " <node hostalias='mockhost' distribution-key='8'/>" + + " <node hostalias='mockhost' distribution-key='9'/>" + + " </group>" + + " <group name='g-3' distribution-key='1'>" + + " <node hostalias='mockhost' distribution-key='10'/>" + + " <node hostalias='mockhost' distribution-key='11'/>" + + " <node hostalias='mockhost' distribution-key='12'/>" + + " <node hostalias='mockhost' distribution-key='13'/>" + + " <node hostalias='mockhost' distribution-key='14'/>" + + " </group>" + + " </group>" + + "</content>" ); DistributionConfig.Builder distributionBuilder = new DistributionConfig.Builder(); cc.getConfig(distributionBuilder); @@ -126,24 +120,24 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testRedundancy() { + void testRedundancy() { ContentCluster cc = parse("" + - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <engine>" + - " <proton>" + - " <searchable-copies>3</searchable-copies>" + - " </proton>" + - " </engine>" + - " <redundancy reply-after='4'>5</redundancy>\n" + - " <group>" + - " <node hostalias='mockhost' distribution-key='0'/>" + - " <node hostalias='mockhost' distribution-key='1'/>" + - " <node hostalias='mockhost' distribution-key='2'/>" + - " <node hostalias='mockhost' distribution-key='3'/>" + - " <node hostalias='mockhost' distribution-key='4'/>" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <engine>" + + " <proton>" + + " <searchable-copies>3</searchable-copies>" + + " </proton>" + + " </engine>" + + " <redundancy reply-after='4'>5</redundancy>\n" + + " <group>" + + " <node hostalias='mockhost' distribution-key='0'/>" + + " <node hostalias='mockhost' distribution-key='1'/>" + + " <node hostalias='mockhost' distribution-key='2'/>" + + " <node hostalias='mockhost' distribution-key='3'/>" + + " <node hostalias='mockhost' distribution-key='4'/>" + + " </group>" + + "</content>" ); DistributionConfig.Builder distributionBuilder = new DistributionConfig.Builder(); cc.getConfig(distributionBuilder); @@ -167,32 +161,32 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testNoId() { + void testNoId() { ContentCluster c = parse( - "<content version=\"1.0\">\n" + - " <redundancy>1</redundancy>\n" + - " <documents/>" + - " <redundancy reply-after=\"4\">5</redundancy>\n" + - " <group>" + - " <node hostalias=\"mockhost\" distribution-key=\"0\"/>\"" + - " </group>" + - "</content>" + "<content version=\"1.0\">\n" + + " <redundancy>1</redundancy>\n" + + " <documents/>" + + " <redundancy reply-after=\"4\">5</redundancy>\n" + + " <group>" + + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>\"" + + " </group>" + + "</content>" ); assertEquals("content", c.getName()); } @Test - public void testRedundancyDefaults() { + void testRedundancyDefaults() { ContentCluster cc = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>" + - " <node hostalias=\"mockhost\" distribution-key=\"0\"/>\"" + - " <node hostalias=\"mockhost\" distribution-key=\"1\"/>\"" + - " <node hostalias=\"mockhost\" distribution-key=\"2\"/>\"" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>" + + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>\"" + + " <node hostalias=\"mockhost\" distribution-key=\"1\"/>\"" + + " <node hostalias=\"mockhost\" distribution-key=\"2\"/>\"" + + " </group>" + + "</content>" ); DistributionConfig.Builder distributionBuilder = new DistributionConfig.Builder(); @@ -209,41 +203,41 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testEndToEnd() { + void testEndToEnd() { String xml = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<services>\n" + - "\n" + - " <admin version=\"2.0\">\n" + - " <adminserver hostalias=\"configserver\" />\n" + - " <logserver hostalias=\"logserver\" />\n" + - " <slobroks>\n" + - " <slobrok hostalias=\"configserver\" />\n" + - " <slobrok hostalias=\"logserver\" />\n" + - " </slobroks>\n" + - " <cluster-controllers>\n" + - " <cluster-controller hostalias=\"configserver\"/>" + - " <cluster-controller hostalias=\"configserver2\"/>" + - " <cluster-controller hostalias=\"configserver3\"/>" + - " </cluster-controllers>\n" + - " </admin>\n" + - " <content version='1.0' id='bar'>" + - " <redundancy>1</redundancy>\n" + - " <documents>" + - " <document type=\"type1\" mode=\"index\"/>\n" + - " <document type=\"type2\" mode=\"index\"/>\n" + - " </documents>\n" + - " <group>" + - " <node hostalias='node0' distribution-key='0' />" + - " </group>" + - " <tuning>" + - " <cluster-controller>\n" + - " <init-progress-time>34567</init-progress-time>" + - " </cluster-controller>" + - " </tuning>" + - " </content>" + - "\n" + - "</services>"; + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + + "<services>\n" + + "\n" + + " <admin version=\"2.0\">\n" + + " <adminserver hostalias=\"configserver\" />\n" + + " <logserver hostalias=\"logserver\" />\n" + + " <slobroks>\n" + + " <slobrok hostalias=\"configserver\" />\n" + + " <slobrok hostalias=\"logserver\" />\n" + + " </slobroks>\n" + + " <cluster-controllers>\n" + + " <cluster-controller hostalias=\"configserver\"/>" + + " <cluster-controller hostalias=\"configserver2\"/>" + + " <cluster-controller hostalias=\"configserver3\"/>" + + " </cluster-controllers>\n" + + " </admin>\n" + + " <content version='1.0' id='bar'>" + + " <redundancy>1</redundancy>\n" + + " <documents>" + + " <document type=\"type1\" mode=\"index\"/>\n" + + " <document type=\"type2\" mode=\"index\"/>\n" + + " </documents>\n" + + " <group>" + + " <node hostalias='node0' distribution-key='0' />" + + " </group>" + + " <tuning>" + + " <cluster-controller>\n" + + " <init-progress-time>34567</init-progress-time>" + + " </cluster-controller>" + + " </tuning>" + + " </content>" + + "\n" + + "</services>"; List<String> sds = ApplicationPackageUtils.generateSchemas("type1", "type2"); VespaModel model = new VespaModelCreatorWithMockPkg(null, xml, sds).create(); @@ -294,7 +288,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testEndToEndOneNode() { + void testEndToEndOneNode() { VespaModel model = createEnd2EndOneNode(new TestProperties()); assertEquals(1, model.getContentClusters().get("storage").getDocumentDefinitions().size()); @@ -303,34 +297,34 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testSearchTuning() { + void testSearchTuning() { String xml = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<services>\n" + - "\n" + - " <admin version=\"2.0\">\n" + - " <adminserver hostalias=\"node0\" />\n" + - " <cluster-controllers>\n" + - " <cluster-controller hostalias=\"node0\"/>" + - " </cluster-controllers>\n" + - " </admin>\n" + - " <content version='1.0' id='bar'>" + - " <redundancy>1</redundancy>\n" + - " <documents>" + - " <document type=\"type1\" mode='index'/>\n" + - " <document type=\"type2\" mode='index'/>\n" + - " </documents>\n" + - " <group>" + - " <node hostalias='node0' distribution-key='0'/>" + - " </group>" + - " <tuning>\n" + - " <cluster-controller>" + - " <init-progress-time>34567</init-progress-time>" + - " </cluster-controller>" + - " </tuning>" + - " </content>" + - "\n" + - "</services>"; + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + + "<services>\n" + + "\n" + + " <admin version=\"2.0\">\n" + + " <adminserver hostalias=\"node0\" />\n" + + " <cluster-controllers>\n" + + " <cluster-controller hostalias=\"node0\"/>" + + " </cluster-controllers>\n" + + " </admin>\n" + + " <content version='1.0' id='bar'>" + + " <redundancy>1</redundancy>\n" + + " <documents>" + + " <document type=\"type1\" mode='index'/>\n" + + " <document type=\"type2\" mode='index'/>\n" + + " </documents>\n" + + " <group>" + + " <node hostalias='node0' distribution-key='0'/>" + + " </group>" + + " <tuning>\n" + + " <cluster-controller>" + + " <init-progress-time>34567</init-progress-time>" + + " </cluster-controller>" + + " </tuning>" + + " </content>" + + "\n" + + "</services>"; List<String> sds = ApplicationPackageUtils.generateSchemas("type1", "type2"); VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create(); @@ -353,66 +347,68 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testRedundancyRequired() { + void testRedundancyRequired() { String xml = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + - "<services>\n" + - "\n" + - " <admin version=\"2.0\">\n" + - " <adminserver hostalias=\"node0\" />\n" + - " </admin>\n" + - " <content version='1.0' id='bar'>" + - " <documents>" + - " <document type=\"type1\" mode='index'/>\n" + - " </documents>\n" + - " <group>\n" + - " <node hostalias='node0' distribution-key='0'/>\n" + - " </group>\n" + - " </content>\n" + - "</services>\n"; + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + + "<services>\n" + + "\n" + + " <admin version=\"2.0\">\n" + + " <adminserver hostalias=\"node0\" />\n" + + " </admin>\n" + + " <content version='1.0' id='bar'>" + + " <documents>" + + " <document type=\"type1\" mode='index'/>\n" + + " </documents>\n" + + " <group>\n" + + " <node hostalias='node0' distribution-key='0'/>\n" + + " </group>\n" + + " </content>\n" + + "</services>\n"; List<String> sds = ApplicationPackageUtils.generateSchemas("type1", "type2"); - try{ + try { new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create(); fail("Deploying without redundancy should fail"); } catch (IllegalArgumentException e) { - assertTrue(e.getMessage(), e.getMessage().contains("missing required element \"redundancy\"")); + assertTrue(e.getMessage().contains("missing required element \"redundancy\""), e.getMessage()); } } @Test - public void testRedundancyFinalLessThanInitial() { + void testRedundancyFinalLessThanInitial() { try { parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <redundancy reply-after=\"4\">2</redundancy>\n" + - " <group>" + - " <node hostalias='node0' distribution-key='0' />" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <redundancy reply-after=\"4\">2</redundancy>\n" + + " <group>" + + " <node hostalias='node0' distribution-key='0' />" + + " </group>" + + "</content>" ); fail("no exception thrown"); - } catch (Exception e) { /* ignore */ } + } catch (Exception e) { /* ignore */ + } } @Test - public void testReadyTooHigh() { + void testReadyTooHigh() { try { parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <engine>" + - " <proton>" + - " <searchable-copies>3</searchable-copies>" + - " </proton>" + - " </engine>" + - " <redundancy>2</redundancy>\n" + - " <group>" + - " <node hostalias='node0' distribution-key='0' />" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <engine>" + + " <proton>" + + " <searchable-copies>3</searchable-copies>" + + " </proton>" + + " </engine>" + + " <redundancy>2</redundancy>\n" + + " <group>" + + " <node hostalias='node0' distribution-key='0' />" + + " </group>" + + "</content>" ); fail("no exception thrown"); - } catch (Exception e) { /* ignore */ } + } catch (Exception e) { /* ignore */ + } } FleetcontrollerConfig getFleetControllerConfig(String xml) { @@ -425,16 +421,16 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testFleetControllerOverride() + void testFleetControllerOverride() { { FleetcontrollerConfig config = getFleetControllerConfig( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); assertEquals(0, config.min_storage_up_ratio(), 0.01); @@ -445,17 +441,17 @@ public class ContentClusterTest extends ContentBaseTest { { FleetcontrollerConfig config = getFleetControllerConfig( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"2\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"3\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"4\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"5\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"2\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"3\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"4\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"5\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); assertNotSame(0, config.min_storage_up_ratio()); @@ -463,65 +459,65 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testImplicitDistributionBits() + void testImplicitDistributionBits() { ContentCluster cluster = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); assertDistributionBitsInConfig(cluster, 8); cluster = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); assertDistributionBitsInConfig(cluster, 8); } @Test - public void testExplicitDistributionBits() + void testExplicitDistributionBits() { ContentCluster cluster = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - " <tuning>\n" + - " <distribution type=\"strict\"/>\n" + - " </tuning>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + " <tuning>\n" + + " <distribution type=\"strict\"/>\n" + + " </tuning>\n" + + "</content>" ); assertDistributionBitsInConfig(cluster, 8); cluster = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - " <tuning>\n" + - " <distribution type=\"loose\"/>\n" + - " </tuning>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + " <tuning>\n" + + " <distribution type=\"loose\"/>\n" + + " </tuning>\n" + + "</content>" ); assertDistributionBitsInConfig(cluster, 8); } @Test - public void testZoneDependentDistributionBits() throws Exception { + void testZoneDependentDistributionBits() throws Exception { String xml = new ContentClusterBuilder().docTypes("test").getXml(); ContentCluster prodWith16Bits = createWithZone(xml, new Zone(Environment.prod, RegionName.from("us-east-3"))); @@ -532,19 +528,19 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testGenerateSearchNodes() + void testGenerateSearchNodes() { ContentCluster cluster = parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <engine>" + - " <proton/>" + - " </engine>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <engine>" + + " <proton/>" + + " </engine>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); { @@ -563,19 +559,19 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testAlternativeNodeSyntax() + void testAlternativeNodeSyntax() { ContentCluster cluster = parse( - "<content version=\"1.0\" id=\"test\">\n" + - " <documents/>" + - " <engine>" + - " <proton/>" + - " </engine>" + - " <nodes>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + - " </nodes>\n" + - "</content>" + "<content version=\"1.0\" id=\"test\">\n" + + " <documents/>" + + " <engine>" + + " <proton/>" + + " </engine>" + + " <nodes>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + + " </nodes>\n" + + "</content>" ); DistributionConfig.Builder bob = new DistributionConfig.Builder(); @@ -597,16 +593,16 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testReadyWhenInitialOne() { + void testReadyWhenInitialOne() { StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder(); parse( - "<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <redundancy>1</redundancy>\n" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + - " </group>" + - "</content>" + "<content version=\"1.0\" id=\"storage\">\n" + + " <documents/>" + + " <redundancy>1</redundancy>\n" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + + " </group>" + + "</content>" ).getConfig(builder); StorDistributionConfig config = new StorDistributionConfig(builder); @@ -651,21 +647,21 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testProviders() { + void testProviders() { testProvider("proton", StorServerConfig.Persistence_provider.Type.RPC); testProvider("dummy", StorServerConfig.Persistence_provider.Type.DUMMY); } @Test - public void testMetrics() { + void testMetrics() { MetricsmanagerConfig.Builder builder = new MetricsmanagerConfig.Builder(); ContentCluster cluster = parse("<content version=\"1.0\" id=\"storage\">\n" + - " <documents/>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + - " </group>\n" + - "</content>" + " <documents/>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + + " </group>\n" + + "</content>" ); cluster.getConfig(builder); @@ -715,24 +711,24 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testConfiguredMetrics() { + void testConfiguredMetrics() { String xml = "" + - "<services>" + - "<content version=\"1.0\" id=\"storage\">\n" + - " <redundancy>1</redundancy>\n" + - " <documents>" + - " <document type=\"type1\" mode='index'/>\n" + - " <document type=\"type2\" mode='index'/>\n" + - " </documents>" + - " <group>\n" + - " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + - " </group>\n" + - "</content>" + - "<admin version=\"2.0\">" + - " <logserver hostalias=\"node0\"/>" + - " <adminserver hostalias=\"node0\"/>" + - "</admin>" + - "</services>"; + "<services>" + + "<content version=\"1.0\" id=\"storage\">\n" + + " <redundancy>1</redundancy>\n" + + " <documents>" + + " <document type=\"type1\" mode='index'/>\n" + + " <document type=\"type2\" mode='index'/>\n" + + " </documents>" + + " <group>\n" + + " <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + + " </group>\n" + + "</content>" + + "<admin version=\"2.0\">" + + " <logserver hostalias=\"node0\"/>" + + " <adminserver hostalias=\"node0\"/>" + + "</admin>" + + "</services>"; List<String> sds = ApplicationPackageUtils.generateSchemas("type1", "type2"); @@ -745,25 +741,25 @@ public class ContentClusterTest extends ContentBaseTest { String expected = "[vds.filestor.allthreads.put\n" + - "vds.filestor.allthreads.get\n" + - "vds.filestor.allthreads.remove\n" + - "vds.filestor.allthreads.update\n" + - "vds.datastored.alldisks.docs\n" + - "vds.datastored.alldisks.bytes\n" + - "vds.filestor.queuesize\n" + - "vds.filestor.averagequeuewait\n" + - "vds.visitor.cv_queuewaittime\n" + - "vds.visitor.allthreads.averagequeuewait\n" + - "vds.visitor.allthreads.averagevisitorlifetime\n" + - "vds.visitor.allthreads.created]"; + "vds.filestor.allthreads.get\n" + + "vds.filestor.allthreads.remove\n" + + "vds.filestor.allthreads.update\n" + + "vds.datastored.alldisks.docs\n" + + "vds.datastored.alldisks.bytes\n" + + "vds.filestor.queuesize\n" + + "vds.filestor.averagequeuewait\n" + + "vds.visitor.cv_queuewaittime\n" + + "vds.visitor.allthreads.averagequeuewait\n" + + "vds.visitor.allthreads.averagevisitorlifetime\n" + + "vds.visitor.allthreads.created]"; String actual = getConsumer("log", config).addedmetrics().toString().replaceAll(", ", "\n"); assertEquals(expected, actual); assertEquals("[logdefault]", getConsumer("log", config).tags().toString()); expected = "[vds.datastored.alldisks.docs\n" + - "vds.datastored.alldisks.bytes\n" + - "vds.datastored.alldisks.buckets\n" + - "vds.datastored.bucket_space.buckets_total]"; + "vds.datastored.alldisks.bytes\n" + + "vds.datastored.alldisks.buckets\n" + + "vds.datastored.bucket_space.buckets_total]"; actual = getConsumer("fleetcontroller", config).addedmetrics().toString().replaceAll(", ", "\n"); assertEquals(expected, actual); } @@ -778,22 +774,22 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void flush_on_shutdown_is_default_on_for_non_hosted() throws Exception { + void flush_on_shutdown_is_default_on_for_non_hosted() throws Exception { assertPrepareRestartCommand(createOneNodeCluster(false)); } @Test - public void flush_on_shutdown_can_be_turned_off_for_non_hosted() throws Exception { + void flush_on_shutdown_can_be_turned_off_for_non_hosted() throws Exception { assertNoPreShutdownCommand(createClusterWithFlushOnShutdownOverride(false, false)); } @Test - public void flush_on_shutdown_is_default_on_for_hosted() throws Exception { + void flush_on_shutdown_is_default_on_for_hosted() throws Exception { assertPrepareRestartCommand(createOneNodeCluster(true)); } @Test - public void flush_on_shutdown_can_be_turned_on_for_hosted() throws Exception { + void flush_on_shutdown_can_be_turned_on_for_hosted() throws Exception { assertPrepareRestartCommand(createClusterWithFlushOnShutdownOverride(true, true)); } @@ -861,16 +857,16 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void reserved_document_name_throws_exception() { + void reserved_document_name_throws_exception() { String xml = "<content version=\"1.0\" id=\"storage\">" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document type=\"true\" mode=\"index\"/>" + - " </documents>" + - " <group>" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + - " </group>" + - "</content>"; + " <redundancy>1</redundancy>" + + " <documents>" + + " <document type=\"true\" mode=\"index\"/>" + + " </documents>" + + " <group>" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + + " </group>" + + "</content>"; List<String> sds = ApplicationPackageUtils.generateSchemas("true"); try { @@ -929,7 +925,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void all_clusters_bucket_spaces_config_contains_mappings_across_all_clusters() { + void all_clusters_bucket_spaces_config_contains_mappings_across_all_clusters() { VespaModel model = createDualContentCluster(); AllClustersBucketSpacesConfig.Builder builder = new AllClustersBucketSpacesConfig.Builder(); model.getConfig(builder, "client"); @@ -940,8 +936,9 @@ public class ContentClusterTest extends ContentBaseTest { assertClusterHasBucketSpaceMappings(config, "foo_c", Arrays.asList("bunnies", "hares"), Collections.emptyList()); assertClusterHasBucketSpaceMappings(config, "bar_c", Collections.emptyList(), Collections.singletonList("rabbits")); } + @Test - public void test_routing_with_multiple_clusters() { + void test_routing_with_multiple_clusters() { VespaModel model = createDualContentCluster(); Routing routing = model.getRouting(); assertNotNull(routing); @@ -1004,7 +1001,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void default_topKprobability_controlled_by_properties() { + void default_topKprobability_controlled_by_properties() { verifyTopKProbabilityPropertiesControl(); } @@ -1019,7 +1016,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void default_distributor_three_phase_update_config_controlled_by_properties() { + void default_distributor_three_phase_update_config_controlled_by_properties() { assertFalse(resolveThreePhaseUpdateConfigWithFeatureFlag(false)); assertTrue(resolveThreePhaseUpdateConfigWithFeatureFlag(true)); } @@ -1039,7 +1036,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void default_max_compact_buffers_config_controlled_by_properties() { + void default_max_compact_buffers_config_controlled_by_properties() { assertEquals(1, resolveMaxCompactBuffers(OptionalInt.empty())); assertEquals(2, resolveMaxCompactBuffers(OptionalInt.of(2))); assertEquals(7, resolveMaxCompactBuffers(OptionalInt.of(7))); @@ -1054,8 +1051,9 @@ public class ContentClusterTest extends ContentBaseTest { ProtonConfig protonConfig = new ProtonConfig(protonBuilder); return protonConfig.flush().memory().maxtlssize(); } + @Test - public void verifyt_max_tls_size() throws Exception { + void verifyt_max_tls_size() throws Exception { var flavor = new Flavor(new FlavorsConfig.Flavor(new FlavorsConfig.Flavor.Builder().name("test").minDiskAvailableGb(100))); assertEquals(21474836480L, resolveMaxTLSSize(Optional.empty())); assertEquals(2147483648L, resolveMaxTLSSize(Optional.of(flavor))); @@ -1087,7 +1085,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void default_distributor_max_inhibited_group_activation_config_controlled_by_properties() throws Exception { + void default_distributor_max_inhibited_group_activation_config_controlled_by_properties() throws Exception { assertEquals(0, resolveMaxInhibitedGroupsConfigWithFeatureFlag(0)); assertEquals(2, resolveMaxInhibitedGroupsConfigWithFeatureFlag(2)); } @@ -1105,13 +1103,13 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void num_distributor_stripes_config_defaults_to_zero() throws Exception { + void num_distributor_stripes_config_defaults_to_zero() throws Exception { // This triggers tuning when starting the distributor process, based on CPU core sampling on the node. assertEquals(0, resolveNumDistributorStripesConfig(Optional.empty())); } @Test - public void num_distributor_stripes_config_tuned_by_flavor() throws Exception { + void num_distributor_stripes_config_tuned_by_flavor() throws Exception { assertEquals(1, resolveTunedNumDistributorStripesConfig(1)); assertEquals(1, resolveTunedNumDistributorStripesConfig(16)); assertEquals(2, resolveTunedNumDistributorStripesConfig(17)); @@ -1120,7 +1118,7 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void unordered_merge_chaining_config_controlled_by_properties() throws Exception { + void unordered_merge_chaining_config_controlled_by_properties() throws Exception { assertFalse(resolveUnorderedMergeChainingConfig(Optional.of(false))); assertTrue(resolveUnorderedMergeChainingConfig(Optional.empty())); } @@ -1137,60 +1135,60 @@ public class ContentClusterTest extends ContentBaseTest { } @Test - public void testDedicatedClusterControllers() { + void testDedicatedClusterControllers() { VespaModel noContentModel = createEnd2EndOneNode(new TestProperties().setHostedVespa(true) - .setMultitenant(true), - "<?xml version='1.0' encoding='UTF-8' ?>" + - "<services version='1.0'>" + - " <container id='default' version='1.0' />" + - " </services>"); + .setMultitenant(true), + "<?xml version='1.0' encoding='UTF-8' ?>" + + "<services version='1.0'>" + + " <container id='default' version='1.0' />" + + " </services>"); assertEquals(Map.of(), noContentModel.getContentClusters()); - assertNull("No cluster controller without content", noContentModel.getAdmin().getClusterControllers()); + assertNull(noContentModel.getAdmin().getClusterControllers(), "No cluster controller without content"); VespaModel oneContentModel = createEnd2EndOneNode(new TestProperties().setHostedVespa(true) - .setMultitenant(true), - "<?xml version='1.0' encoding='UTF-8' ?>" + - "<services version='1.0'>" + - " <container id='default' version='1.0' />" + - " <content id='storage' version='1.0'>" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document mode='index' type='type1' />" + - " </documents>" + - " </content>" + - " </services>"); - assertNotNull("Shared cluster controller with content", oneContentModel.getAdmin().getClusterControllers()); + .setMultitenant(true), + "<?xml version='1.0' encoding='UTF-8' ?>" + + "<services version='1.0'>" + + " <container id='default' version='1.0' />" + + " <content id='storage' version='1.0'>" + + " <redundancy>1</redundancy>" + + " <documents>" + + " <document mode='index' type='type1' />" + + " </documents>" + + " </content>" + + " </services>"); + assertNotNull(oneContentModel.getAdmin().getClusterControllers(), "Shared cluster controller with content"); String twoContentServices = "<?xml version='1.0' encoding='UTF-8' ?>" + - "<services version='1.0'>" + - " <container id='default' version='1.0' />" + - " <content id='storage' version='1.0'>" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document mode='index' type='type1' />" + - " </documents>" + - " <tuning>" + - " <cluster-controller>" + - " <min-distributor-up-ratio>0.618</min-distributor-up-ratio>" + - " </cluster-controller>" + - " </tuning>" + - " </content>" + - " <content id='dev-null' version='1.0'>" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document mode='index' type='type1' />" + - " </documents>" + - " <tuning>" + - " <cluster-controller>" + - " <min-distributor-up-ratio>0.418</min-distributor-up-ratio>" + - " </cluster-controller>" + - " </tuning>" + - " </content>" + - " </services>"; + "<services version='1.0'>" + + " <container id='default' version='1.0' />" + + " <content id='storage' version='1.0'>" + + " <redundancy>1</redundancy>" + + " <documents>" + + " <document mode='index' type='type1' />" + + " </documents>" + + " <tuning>" + + " <cluster-controller>" + + " <min-distributor-up-ratio>0.618</min-distributor-up-ratio>" + + " </cluster-controller>" + + " </tuning>" + + " </content>" + + " <content id='dev-null' version='1.0'>" + + " <redundancy>1</redundancy>" + + " <documents>" + + " <document mode='index' type='type1' />" + + " </documents>" + + " <tuning>" + + " <cluster-controller>" + + " <min-distributor-up-ratio>0.418</min-distributor-up-ratio>" + + " </cluster-controller>" + + " </tuning>" + + " </content>" + + " </services>"; VespaModel twoContentModel = createEnd2EndOneNode(new TestProperties().setHostedVespa(true) - .setMultitenant(true), - twoContentServices); - assertNotNull("Shared cluster controller with content", twoContentModel.getAdmin().getClusterControllers()); + .setMultitenant(true), + twoContentServices); + assertNotNull(twoContentModel.getAdmin().getClusterControllers(), "Shared cluster controller with content"); ClusterControllerContainerCluster clusterControllers = twoContentModel.getAdmin().getClusterControllers(); @@ -1204,11 +1202,11 @@ public class ContentClusterTest extends ContentBaseTest { assertEquals(0.418, devNullBuilder.build().min_distributor_up_ratio(), 1e-9); assertZookeeperServerImplementation("com.yahoo.vespa.zookeeper.ReconfigurableVespaZooKeeperServer", - clusterControllers); + clusterControllers); assertZookeeperServerImplementation("com.yahoo.vespa.zookeeper.Reconfigurer", - clusterControllers); + clusterControllers); assertZookeeperServerImplementation("com.yahoo.vespa.zookeeper.VespaZooKeeperAdminImpl", - clusterControllers); + clusterControllers); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java index 67260ce1f9d..da892934070 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaClusterTest.java @@ -12,7 +12,7 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.utils.ContentClusterBuilder; import com.yahoo.vespa.model.content.utils.DocType; import com.yahoo.vespa.model.content.utils.SchemaBuilder; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; @@ -21,10 +21,7 @@ import java.util.List; import static com.yahoo.config.model.test.TestUtil.joinLines; import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createCluster; import static com.yahoo.vespa.model.content.utils.SchemaBuilder.createSchemas; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Unit tests for content search cluster. @@ -99,51 +96,51 @@ public class ContentSchemaClusterTest { } @Test - public void requireThatProtonInitializeThreadsIsSet() throws Exception { + void requireThatProtonInitializeThreadsIsSet() throws Exception { assertEquals(2, getProtonConfig(createClusterWithOneDocumentType()).initialize().threads()); assertEquals(3, getProtonConfig(createClusterWithTwoDocumentType()).initialize().threads()); } @Test - public void requireThatProtonResourceLimitsCanBeSet() throws Exception { + void requireThatProtonResourceLimitsCanBeSet() throws Exception { assertProtonResourceLimits(0.88, 0.77, new ContentClusterBuilder().protonDiskLimit(0.88).protonMemoryLimit(0.77).getXml()); } @Test - public void requireThatOnlyDiskLimitCanBeSet() throws Exception { + void requireThatOnlyDiskLimitCanBeSet() throws Exception { assertProtonResourceLimits(0.88, 0.9, new ContentClusterBuilder().protonDiskLimit(0.88).getXml()); } @Test - public void requireThatOnlyMemoryLimitCanBeSet() throws Exception { + void requireThatOnlyMemoryLimitCanBeSet() throws Exception { assertProtonResourceLimits(0.9, 0.77, new ContentClusterBuilder().protonMemoryLimit(0.77).getXml()); } @Test - public void cluster_controller_resource_limits_can_be_set() throws Exception { + void cluster_controller_resource_limits_can_be_set() throws Exception { assertClusterControllerResourceLimits(0.92, 0.93, new ContentClusterBuilder().clusterControllerDiskLimit(0.92).clusterControllerMemoryLimit(0.93).getXml()); } @Test - public void resource_limits_are_derived_from_the_other_if_not_specified() throws Exception { + void resource_limits_are_derived_from_the_other_if_not_specified() throws Exception { var cluster = createCluster(new ContentClusterBuilder().clusterControllerDiskLimit(0.5).protonMemoryLimit(0.95).getXml()); assertProtonResourceLimits(0.8, 0.95, cluster); assertClusterControllerResourceLimits(0.5, 0.94, cluster); } @Test - public void default_resource_limits_with_feed_block_in_distributor() throws Exception { + void default_resource_limits_with_feed_block_in_distributor() throws Exception { var cluster = createCluster(new ContentClusterBuilder().getXml()); assertProtonResourceLimits(0.9, 0.9, cluster); assertClusterControllerResourceLimits(0.75, 0.8, cluster); } @Test - public void requireThatGloballyDistributedDocumentTypeIsTaggedAsSuch() throws Exception { + void requireThatGloballyDistributedDocumentTypeIsTaggedAsSuch() throws Exception { ProtonConfig cfg = getProtonConfig(createClusterWithGlobalType()); assertEquals(2, cfg.documentdb().size()); assertDocumentDb("global", true, cfg.documentdb(0)); @@ -156,7 +153,7 @@ public class ContentSchemaClusterTest { } @Test - public void require_that_document_types_with_references_are_topologically_sorted() throws Exception { + void require_that_document_types_with_references_are_topologically_sorted() throws Exception { ProtonConfig cfg = getProtonConfig(createClusterWithThreeDocumentTypes()); assertEquals(3, cfg.documentdb().size()); assertDocumentDb("c", true, cfg.documentdb(0)); @@ -202,7 +199,7 @@ public class ContentSchemaClusterTest { } @Test - public void require_that_document_types_belong_to_correct_bucket_spaces() throws Exception { + void require_that_document_types_belong_to_correct_bucket_spaces() throws Exception { BucketspacesConfig config = getBucketspacesConfig(createClusterWithGlobalType()); assertEquals(2, config.documenttype().size()); assertDocumentType("global", "global", config.documenttype(0)); @@ -210,7 +207,7 @@ public class ContentSchemaClusterTest { } @Test - public void bucket_space_config_builder_returns_correct_mappings() throws Exception { + void bucket_space_config_builder_returns_correct_mappings() throws Exception { ContentCluster cluster = createClusterWithGlobalType(); BucketspacesConfig expected = getBucketspacesConfig(cluster); AllClustersBucketSpacesConfig.Cluster actual = cluster.clusterBucketSpaceConfigBuilder().build(); @@ -223,13 +220,13 @@ public class ContentSchemaClusterTest { } @Test - public void cluster_with_global_document_types_sets_cluster_controller_global_docs_config_option() throws Exception { + void cluster_with_global_document_types_sets_cluster_controller_global_docs_config_option() throws Exception { ContentCluster cluster = createClusterWithGlobalType(); assertTrue(getFleetcontrollerConfig(cluster).cluster_has_global_document_types()); } @Test - public void cluster_without_global_document_types_unsets_cluster_controller_global_docs_config_option() throws Exception { + void cluster_without_global_document_types_unsets_cluster_controller_global_docs_config_option() throws Exception { ContentCluster cluster = createClusterWithoutGlobalType(); assertFalse(getFleetcontrollerConfig(cluster).cluster_has_global_document_types()); } @@ -241,21 +238,21 @@ public class ContentSchemaClusterTest { } @Test - public void fsync_is_controllable() throws Exception { + void fsync_is_controllable() throws Exception { assertTrue(getTlsConfig(createCluster(new ContentClusterBuilder().getXml())).usefsync()); assertTrue(getTlsConfig(createCluster(new ContentClusterBuilder().syncTransactionLog(true).getXml())).usefsync()); assertFalse(getTlsConfig(createCluster(new ContentClusterBuilder().syncTransactionLog(false).getXml())).usefsync()); } @Test - public void verifyDefaultDocStoreCompression() throws Exception { + void verifyDefaultDocStoreCompression() throws Exception { ProtonConfig cfg = getProtonConfig(createCluster(new ContentClusterBuilder().getXml())); assertEquals(3, cfg.summary().log().chunk().compression().level()); assertEquals(3, cfg.summary().log().compact().compression().level()); } @Test - public void verifyDefaultDiskBloatFactor() throws Exception { + void verifyDefaultDiskBloatFactor() throws Exception { var defaultCfg = getProtonConfig(createCluster(new ContentClusterBuilder().getXml())); assertEquals(0.25, defaultCfg.flush().memory().diskbloatfactor(), EPSILON); assertEquals(0.25, defaultCfg.flush().memory().each().diskbloatfactor(), EPSILON); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaTest.java index 952a0b945dd..ad17d6f385b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSchemaTest.java @@ -1,10 +1,10 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * @author Simon Thoresen Hult @@ -12,7 +12,7 @@ import static org.junit.Assert.assertNull; public class ContentSchemaTest { @Test - public void requireThatAccessorsWork() { + void requireThatAccessorsWork() { ContentSearch search = new ContentSearch.Builder() .setQueryTimeout(1.0) .setVisibilityDelay(2.0) @@ -22,7 +22,7 @@ public class ContentSchemaTest { } @Test - public void requireThatDefaultsAreNull() { + void requireThatDefaultsAreNull() { ContentSearch search = new ContentSearch.Builder().build(); assertNull(search.getQueryTimeout()); assertNull(search.getVisibilityDelay()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java index c3a40946c06..cddbe267628 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/DispatchTuningTest.java @@ -1,11 +1,10 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Simon Thoresen Hult @@ -13,7 +12,7 @@ import static org.junit.Assert.assertTrue; public class DispatchTuningTest { @Test - public void requireThatAccessorWork() { + void requireThatAccessorWork() { DispatchTuning dispatch = new DispatchTuning.Builder() .setMaxHitsPerPartition(69) .setDispatchPolicy("round-robin") @@ -22,29 +21,30 @@ public class DispatchTuningTest { .build(); assertEquals(69, dispatch.getMaxHitsPerPartition().intValue()); assertEquals(12.5, dispatch.getMinActiveDocsCoverage().doubleValue(), 0.0); - assertTrue(DispatchTuning.DispatchPolicy.ROUNDROBIN == dispatch.getDispatchPolicy()); + assertEquals(DispatchTuning.DispatchPolicy.ROUNDROBIN, dispatch.getDispatchPolicy()); assertEquals(18.3, dispatch.getTopkProbability(), 0.0); } + @Test - public void requireThatRandomDispatchWork() { + void requireThatRandomDispatchWork() { DispatchTuning dispatch = new DispatchTuning.Builder() .setDispatchPolicy("random") .build(); - assertTrue(DispatchTuning.DispatchPolicy.ADAPTIVE == dispatch.getDispatchPolicy()); + assertEquals(DispatchTuning.DispatchPolicy.ADAPTIVE, dispatch.getDispatchPolicy()); assertNull(dispatch.getMinActiveDocsCoverage()); } @Test - public void requireThatWeightedDispatchWork() { + void requireThatWeightedDispatchWork() { DispatchTuning dispatch = new DispatchTuning.Builder() .setDispatchPolicy("adaptive") .build(); - assertTrue(DispatchTuning.DispatchPolicy.ADAPTIVE == dispatch.getDispatchPolicy()); + assertEquals(DispatchTuning.DispatchPolicy.ADAPTIVE, dispatch.getDispatchPolicy()); assertNull(dispatch.getMinActiveDocsCoverage()); } @Test - public void requireThatDefaultsAreNull() { + void requireThatDefaultsAreNull() { DispatchTuning dispatch = new DispatchTuning.Builder().build(); assertNull(dispatch.getMaxHitsPerPartition()); assertNull(dispatch.getDispatchPolicy()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java index 015356d6088..06f78a1c68d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/DistributorTest.java @@ -9,13 +9,11 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.utils.ContentClusterUtils; import com.yahoo.vespa.model.content.utils.DocType; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Test for content DistributorCluster. @@ -37,14 +35,14 @@ public class DistributorTest { } @Test - public void testBasics() { + void testBasics() { StorServerConfig.Builder builder = new StorServerConfig.Builder(); parse("<content id=\"foofighters\"><documents/>\n" + - " <group>" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + - " </group>" + - "</content>\n"). + " <group>" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + + " </group>" + + "</content>\n"). getConfig(builder); StorServerConfig config = new StorServerConfig(builder); @@ -53,7 +51,7 @@ public class DistributorTest { } @Test - public void testRevertDefaultOffForSearch() { + void testRevertDefaultOffForSearch() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>" + @@ -66,7 +64,7 @@ public class DistributorTest { } @Test - public void testSplitAndJoin() { + void testSplitAndJoin() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>" + @@ -89,7 +87,7 @@ public class DistributorTest { } @Test - public void testThatGroupsAreCountedInWhenComputingSplitBits() { + void testThatGroupsAreCountedInWhenComputingSplitBits() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); ContentCluster cluster = parseCluster("<cluster id=\"storage\">\n" + " <documents/>" + @@ -145,7 +143,7 @@ public class DistributorTest { } @Test - public void testMaxMergesPerNode() { + void testMaxMergesPerNode() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); DistributorCluster dcluster = parse("<content id=\"storage\">\n" + " <documents/>" + @@ -159,30 +157,30 @@ public class DistributorTest { builder = new StorDistributormanagerConfig.Builder(); dcluster = parse("<content id=\"storage\">\n" + - " <documents/>" + - " <tuning>\n" + - " <merges max-nodes-per-merge=\"4\"/>\n" + - " </tuning>\n" + - " <group>" + - " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + - " </group>" + - "</content>"); + " <documents/>" + + " <tuning>\n" + + " <merges max-nodes-per-merge=\"4\"/>\n" + + " </tuning>\n" + + " <group>" + + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + + " </group>" + + "</content>"); ((ContentCluster) dcluster.getParent()).getConfig(builder); conf = new StorDistributormanagerConfig(builder); assertEquals(4, conf.maximum_nodes_per_merge()); } @Test - public void testGarbageCollectionSetExplicitly() { + void testGarbageCollectionSetExplicitly() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"storage\">\n" + - " <documents garbage-collection=\"true\">\n" + - " <document type=\"music\"/>\n" + - " </documents>\n" + + " <documents garbage-collection=\"true\">\n" + + " <document type=\"music\"/>\n" + + " </documents>\n" + " <group>" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + " </group>" + - "</cluster>").getConfig(builder); + "</cluster>").getConfig(builder); StorDistributormanagerConfig conf = new StorDistributormanagerConfig(builder); assertEquals(3600, conf.garbagecollection().interval()); @@ -190,7 +188,7 @@ public class DistributorTest { } @Test - public void testGarbageCollectionInterval() { + void testGarbageCollectionInterval() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents garbage-collection=\"true\" garbage-collection-interval=\"30\">\n" + @@ -206,7 +204,7 @@ public class DistributorTest { } @Test - public void testGarbageCollectionOffByDefault() { + void testGarbageCollectionOffByDefault() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents>\n" + @@ -223,7 +221,7 @@ public class DistributorTest { } @Test - public void testComplexGarbageCollectionSelectionForIndexedSearch() { + void testComplexGarbageCollectionSelectionForIndexedSearch() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"foo\">\n" + " <documents garbage-collection=\"true\" selection=\"true\">" + @@ -243,7 +241,7 @@ public class DistributorTest { } @Test - public void testGarbageCollectionDisabledIfForced() { + void testGarbageCollectionDisabledIfForced() { StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder(); parse("<cluster id=\"foo\">\n" + " <documents selection=\"true\" garbage-collection=\"false\" garbage-collection-interval=\"30\">\n" + @@ -261,7 +259,7 @@ public class DistributorTest { } @Test - public void testPortOverride() { + void testPortOverride() { StorCommunicationmanagerConfig.Builder builder = new StorCommunicationmanagerConfig.Builder(); DistributorCluster cluster = parse("<cluster id=\"storage\" distributor-base-port=\"14065\">" + @@ -277,7 +275,7 @@ public class DistributorTest { } @Test - public void testCommunicationManagerDefaults() { + void testCommunicationManagerDefaults() { StorCommunicationmanagerConfig.Builder builder = new StorCommunicationmanagerConfig.Builder(); DistributorCluster cluster = parse("<cluster id=\"storage\">" + @@ -305,38 +303,38 @@ public class DistributorTest { } @Test - public void bucket_activation_disabled_if_no_documents_in_indexed_mode() { + void bucket_activation_disabled_if_no_documents_in_indexed_mode() { StorDistributormanagerConfig config = clusterXmlToConfig( generateXmlForDocTypes(DocType.storeOnly("music"))); assertTrue(config.disable_bucket_activation()); } @Test - public void bucket_activation_enabled_with_single_indexed_document() { + void bucket_activation_enabled_with_single_indexed_document() { StorDistributormanagerConfig config = clusterXmlToConfig( generateXmlForDocTypes(DocType.index("music"))); assertFalse(config.disable_bucket_activation()); } @Test - public void bucket_activation_enabled_with_multiple_indexed_documents() { + void bucket_activation_enabled_with_multiple_indexed_documents() { StorDistributormanagerConfig config = clusterXmlToConfig( generateXmlForDocTypes(DocType.index("music"), - DocType.index("movies"))); + DocType.index("movies"))); assertFalse(config.disable_bucket_activation()); } @Test - public void bucket_activation_enabled_if_at_least_one_document_indexed() { + void bucket_activation_enabled_if_at_least_one_document_indexed() { StorDistributormanagerConfig config = clusterXmlToConfig( generateXmlForDocTypes(DocType.storeOnly("music"), - DocType.streaming("bunnies"), - DocType.index("movies"))); + DocType.streaming("bunnies"), + DocType.index("movies"))); assertFalse(config.disable_bucket_activation()); } @Test - public void bucket_activation_disabled_for_single_streaming_type() { + void bucket_activation_disabled_for_single_streaming_type() { StorDistributormanagerConfig config = clusterXmlToConfig( generateXmlForDocTypes(DocType.streaming("music"))); assertTrue(config.disable_bucket_activation()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java index f9fcb777408..1e6847a47be 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java @@ -8,11 +8,11 @@ import com.yahoo.config.model.test.MockRoot; import com.yahoo.text.XML; import com.yahoo.vespa.config.content.FleetcontrollerConfig; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.w3c.dom.Document; import static com.yahoo.config.model.test.TestUtil.joinLines; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; public class FleetControllerClusterTest { @@ -36,7 +36,7 @@ public class FleetControllerClusterTest { } @Test - public void testParameters() { + void testParameters() { FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>" + @@ -65,7 +65,7 @@ public class FleetControllerClusterTest { } @Test - public void testDurationParameters() { + void testDurationParameters() { FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>" + @@ -82,7 +82,7 @@ public class FleetControllerClusterTest { } @Test - public void min_node_ratio_per_group_tuning_config_is_propagated() { + void min_node_ratio_per_group_tuning_config_is_propagated() { FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>\n" + @@ -97,18 +97,18 @@ public class FleetControllerClusterTest { } @Test - public void min_node_ratio_per_group_is_implicitly_zero_when_omitted() { + void min_node_ratio_per_group_is_implicitly_zero_when_omitted() { var config = getConfigForBasicCluster(); assertEquals(0.0, config.min_node_ratio_per_group(), 0.01); } @Test - public void default_cluster_feed_block_limits_are_set() { + void default_cluster_feed_block_limits_are_set() { assertLimits(0.75, 0.8, getConfigForBasicCluster()); } @Test - public void resource_limits_can_be_set_in_tuning() { + void resource_limits_can_be_set_in_tuning() { assertLimits(0.6, 0.7, getConfigForResourceLimitsTuning(0.6, 0.7)); assertLimits(0.6, 0.8, getConfigForResourceLimitsTuning(0.6, null)); assertLimits(0.75, 0.7, getConfigForResourceLimitsTuning(null, 0.7)); @@ -140,7 +140,7 @@ public class FleetControllerClusterTest { } @Test - public void feature_flag_controls_min_node_ratio_per_group() { + void feature_flag_controls_min_node_ratio_per_group() { verifyFeatureFlagControlsMinNodeRatioPerGroup(0.0, new TestProperties()); verifyFeatureFlagControlsMinNodeRatioPerGroup(0.3, new TestProperties().setMinNodeRatioPerGroup(0.3)); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/GenericConfigTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/GenericConfigTest.java index e6e8a02e951..9fcf426e2e8 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/GenericConfigTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/GenericConfigTest.java @@ -7,10 +7,10 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.storagecluster.StorageCluster; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author gjoranv @@ -47,13 +47,13 @@ public class GenericConfigTest { "</services>"; } - @Before + @BeforeEach public void getVespaModel() { model = (new VespaModelCreatorWithMockPkg(ContentBaseTest.getHosts(), servicesXml(), ApplicationPackageUtils.generateSchemas("type1"))).create(); } @Test - public void config_override_on_root_is_visible_on_storage_cluster() { + void config_override_on_root_is_visible_on_storage_cluster() { StorageCluster cluster = model.getContentClusters().get("storage").getStorageCluster(); StorFilestorConfig config = model.getConfig(StorFilestorConfig.class, cluster.getConfigId()); @@ -61,7 +61,7 @@ public class GenericConfigTest { } @Test - public void config_override_on_root_is_visible_on_content_cluster() { + void config_override_on_root_is_visible_on_content_cluster() { ContentCluster cluster = model.getContentClusters().get("storage"); StorFilestorConfig config = model.getConfig(StorFilestorConfig.class, cluster.getConfigId()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java index a47d25ab391..4def4e0c10f 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/GlobalDistributionValidatorTest.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.model.content; import com.yahoo.documentmodel.NewDocumentType; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.HashMap; import java.util.HashSet; @@ -14,8 +14,8 @@ import java.util.stream.Stream; import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; import static java.util.stream.Collectors.toSet; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; /** * @author bjorncs @@ -23,20 +23,20 @@ import static org.junit.Assert.fail; public class GlobalDistributionValidatorTest { @Test - public void validation_succeeds_on_no_documents() { + void validation_succeeds_on_no_documents() { new GlobalDistributionValidator() .validate(emptyMap(), emptySet()); } @Test - public void validation_succeeds_on_no_global_documents() { + void validation_succeeds_on_no_global_documents() { Fixture fixture = new Fixture() .addNonGlobalDocument(createDocumentType("foo")); validate(fixture); } @Test - public void throws_exception_if_referenced_document_not_global() { + void throws_exception_if_referenced_document_not_global() { NewDocumentType parent = createDocumentType("parent"); Fixture fixture = new Fixture() .addNonGlobalDocument(parent) @@ -51,7 +51,7 @@ public class GlobalDistributionValidatorTest { } @Test - public void validation_succeeds_if_referenced_document_is_global() { + void validation_succeeds_if_referenced_document_is_global() { NewDocumentType parent = createDocumentType("parent"); Fixture fixture = new Fixture() .addGlobalDocument(parent) @@ -60,7 +60,7 @@ public class GlobalDistributionValidatorTest { } @Test - public void throws_exception_on_unknown_document() { + void throws_exception_on_unknown_document() { NewDocumentType unknown = new NewDocumentType(new NewDocumentType.Name("unknown")); NewDocumentType child = createDocumentType("child", unknown); Fixture fixture = new Fixture() @@ -76,7 +76,7 @@ public class GlobalDistributionValidatorTest { } @Test - public void throws_exception_if_referenced_document_not_global_end_to_end() { + void throws_exception_if_referenced_document_not_global_end_to_end() { try { new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/global_distribution_validation/").create(); fail(); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java index 7d7ba7994aa..07c032a52a5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedHierarchicDistributionTest.java @@ -6,7 +6,7 @@ import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.search.DispatchGroup; import com.yahoo.vespa.model.search.SearchInterface; import com.yahoo.vespa.model.search.SearchNode; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.List; @@ -15,10 +15,7 @@ import java.util.Optional; import static com.yahoo.config.model.test.TestUtil.joinLines; import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createCluster; import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createClusterXml; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * Unit tests for hierarchic distribution in an indexed content cluster. @@ -73,7 +70,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatSearchNodesAreCorrectWithOneGroup() throws Exception { + void requireThatSearchNodesAreCorrectWithOneGroup() throws Exception { ContentCluster c = getOneGroupCluster(); List<SearchNode> searchNodes = c.getSearch().getSearchNodes(); @@ -84,13 +81,13 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatActivePerLeafGroupIsDefaultWithOneGroup() throws Exception { + void requireThatActivePerLeafGroupIsDefaultWithOneGroup() throws Exception { ContentCluster c = getOneGroupCluster(); assertFalse(getStorDistributionConfig(c).active_per_leaf_group()); } @Test - public void requireThatSearchNodesAreCorrectWithTwoGroups() throws Exception { + void requireThatSearchNodesAreCorrectWithTwoGroups() throws Exception { ContentCluster c = getTwoGroupsCluster(); List<SearchNode> searchNodes = c.getSearch().getSearchNodes(); @@ -104,7 +101,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatActivePerLeafGroupIsSetWithTwoGroups() throws Exception { + void requireThatActivePerLeafGroupIsSetWithTwoGroups() throws Exception { ContentCluster c = getTwoGroupsCluster(); assertTrue(getStorDistributionConfig(c).active_per_leaf_group()); } @@ -174,7 +171,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatWeMustHaveOnlyOneGroupLevel() { + void requireThatWeMustHaveOnlyOneGroupLevel() { try { getIllegalMultipleGroupsLevelCluster(); fail("Did not get expected Exception"); @@ -184,7 +181,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatLeafGroupsMustHaveEqualNumberOfNodes() { + void requireThatLeafGroupsMustHaveEqualNumberOfNodes() { try { getIllegalGroupsCluster(); fail("Did not get expected Exception"); @@ -194,14 +191,14 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatLeafGroupsCanHaveUnequalNumberOfNodesIfRandomPolicy() throws Exception { + void requireThatLeafGroupsCanHaveUnequalNumberOfNodesIfRandomPolicy() throws Exception { ContentCluster c = getOddGroupsCluster(); DispatchGroup dg = c.getSearch().getIndexed().getRootDispatch(); assertEquals(8, dg.getRowBits()); assertEquals(3, dg.getNumPartitions()); assertTrue(dg.useFixedRowInDispatch()); ArrayList<SearchInterface> list = new ArrayList<>(); - for(SearchInterface si : dg.getSearchersIterable()) { + for (SearchInterface si : dg.getSearchersIterable()) { list.add(si); } assertEquals(5, list.size()); @@ -218,7 +215,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatLeafGroupsCountMustBeAFactorOfRedundancy() { + void requireThatLeafGroupsCountMustBeAFactorOfRedundancy() { try { getTwoGroupsCluster(3, 3, "2|*"); fail("Did not get expected Exception"); @@ -228,7 +225,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatRedundancyPerGroupMustBeIsEqual() { + void requireThatRedundancyPerGroupMustBeIsEqual() { try { getTwoGroupsCluster(4, 4, "1|*"); fail("Did not get expected Exception"); @@ -238,7 +235,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void requireThatReadyCopiesMustBeEqualToRedundancy() { + void requireThatReadyCopiesMustBeEqualToRedundancy() { try { getTwoGroupsCluster(4, 3, "2|*"); fail("Did not get expected Exception"); @@ -248,7 +245,7 @@ public class IndexedHierarchicDistributionTest { } @Test - public void allowLessReadyCopiesThanRedundancy() throws Exception { + void allowLessReadyCopiesThanRedundancy() throws Exception { getTwoGroupsCluster(4, 2, "2|*"); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedSchemaNodeNamingTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedSchemaNodeNamingTest.java index 17e295c1c2a..d2de9d6c23a 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedSchemaNodeNamingTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedSchemaNodeNamingTest.java @@ -5,14 +5,14 @@ import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.defaults.Defaults; import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.search.SearchNode; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import static com.yahoo.config.model.test.TestUtil.joinLines; import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createCluster; import static com.yahoo.vespa.model.content.utils.ContentClusterUtils.createClusterXml; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Unit tests for the naming of search nodes base dir and config ids in an indexed content cluster. @@ -69,14 +69,14 @@ public class IndexedSchemaNodeNamingTest { } @Test - public void requireThatSingleNodeIsNamedAfterDistributionKey() throws Exception { + void requireThatSingleNodeIsNamedAfterDistributionKey() throws Exception { ContentCluster cluster = getSingleNodeCluster(); List<SearchNode> nodes = cluster.getSearch().getSearchNodes(); assertSearchNode("n3", "3", nodes.get(0)); } @Test - public void requireThatMultipleNodesAreNamedAfterDistributionKey() throws Exception { + void requireThatMultipleNodesAreNamedAfterDistributionKey() throws Exception { ContentCluster cluster = getMultiNodeCluster(); List<SearchNode> nodes = cluster.getSearch().getSearchNodes(); assertEquals(3, nodes.size()); @@ -86,7 +86,7 @@ public class IndexedSchemaNodeNamingTest { } @Test - public void requireThatNodesInHierarchicGroupsAreNamedAfterDistributionKey() throws Exception { + void requireThatNodesInHierarchicGroupsAreNamedAfterDistributionKey() throws Exception { ContentCluster cluster = getMultiGroupCluster(); List<SearchNode> nodes = cluster.getSearch().getSearchNodes(); assertEquals(4, nodes.size()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java index a39cbc60a89..f65a72427de 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java @@ -15,13 +15,11 @@ import com.yahoo.vespa.model.routing.Routing; import com.yahoo.vespa.model.search.IndexedSearchCluster; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.*; /** * Test for using the content model to create indexed search clusters. @@ -111,7 +109,7 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void requireMultipleDocumentTypes() { + void requireMultipleDocumentTypes() { VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator(); VespaModel model = creator.create(); DeployState deployState = creator.deployState; @@ -126,7 +124,7 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void requireIndexedOnlyServices() { + void requireIndexedOnlyServices() { VespaModel model = getIndexedVespaModel(); // TODO // HostResource h = model.getHostSystem().getHosts().get(0); @@ -155,7 +153,7 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void requireProtonStreamingOnly() { + void requireProtonStreamingOnly() { VespaModel model = getStreamingVespaModel(); // TODO // HostResource h = model.getHostSystem().getHosts().get(0); @@ -173,7 +171,7 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void requireCorrectClusterList() { + void requireCorrectClusterList() { VespaModel model = getStreamingVespaModel(); ContentCluster s = model.getContentClusters().get("test"); assertNotNull(s); @@ -185,38 +183,38 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void testContentSummaryStore() { - String services= + void testContentSummaryStore() { + String services = "<services version='1.0'>" + - "<admin version='2.0'><adminserver hostalias='node0' /></admin>" + - "<content id='docstore' version='1.0'>\n" + - " <redundancy>1</redundancy>\n" + - " <documents>\n" + - " <document mode='index' type='docstorebench'/>\n" + - " </documents>\n" + - " <group>\n" + - " <node distribution-key='0' hostalias='node0'/>\n" + - " </group>\n" + - " <engine>\n" + - " <proton>\n" + - " <searchable-copies>1</searchable-copies>\n" + - " <tuning>\n" + - " <searchnode>\n" + - " <summary>\n" + - " <store>\n" + - " <logstore>\n" + - " <chunk>\n" + - " <maxsize>2048</maxsize>\n" + - " </chunk>\n" + - " </logstore>\n" + - " </store>\n" + - " </summary>\n" + - " </searchnode>\n" + - " </tuning>\n" + - " </proton>\n" + - " </engine>\n" + - " </content>\n" + - " </services>"; + "<admin version='2.0'><adminserver hostalias='node0' /></admin>" + + "<content id='docstore' version='1.0'>\n" + + " <redundancy>1</redundancy>\n" + + " <documents>\n" + + " <document mode='index' type='docstorebench'/>\n" + + " </documents>\n" + + " <group>\n" + + " <node distribution-key='0' hostalias='node0'/>\n" + + " </group>\n" + + " <engine>\n" + + " <proton>\n" + + " <searchable-copies>1</searchable-copies>\n" + + " <tuning>\n" + + " <searchnode>\n" + + " <summary>\n" + + " <store>\n" + + " <logstore>\n" + + " <chunk>\n" + + " <maxsize>2048</maxsize>\n" + + " </chunk>\n" + + " </logstore>\n" + + " </store>\n" + + " </summary>\n" + + " </searchnode>\n" + + " </tuning>\n" + + " </proton>\n" + + " </engine>\n" + + " </content>\n" + + " </services>"; List<String> sds = ApplicationPackageUtils.generateSchemas("docstorebench"); VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create(); @@ -225,21 +223,21 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void testMixedIndexAndStoreOnly() { - String services= + void testMixedIndexAndStoreOnly() { + String services = "<services version='1.0'>" + - " <admin version='2.0'><adminserver hostalias='node0' /></admin>" + - " <content id='docstore' version=\"1.0\">" + - " <redundancy>1</redundancy>" + - " <documents>" + - " <document type=\"index_me\" mode=\"index\"/>" + - " <document type=\"store_me\" mode=\"store-only\"/>" + - " </documents>" + - " <group>" + - " <node distribution-key=\"0\" hostalias=\"node0\"/>" + - " </group>" + - " </content>" + - "</services>"; + " <admin version='2.0'><adminserver hostalias='node0' /></admin>" + + " <content id='docstore' version=\"1.0\">" + + " <redundancy>1</redundancy>" + + " <documents>" + + " <document type=\"index_me\" mode=\"index\"/>" + + " <document type=\"store_me\" mode=\"store-only\"/>" + + " </documents>" + + " <group>" + + " <node distribution-key=\"0\" hostalias=\"node0\"/>" + + " </group>" + + " </content>" + + "</services>"; List<String> sds = ApplicationPackageUtils.generateSchemas("index_me", "store_me"); VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), services, sds).create(); @@ -254,7 +252,7 @@ public class IndexedTest extends ContentBaseTest { } @Test - public void requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey() { + void requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey() { VespaModel model = getIndexedVespaModel(); ApplicationContainerCluster cluster = model.getContainerClusters().get("container"); assertEquals("container/container.0", cluster.getContainers().get(0).getConfigId()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java index 0b7dbf2eb21..430628238d9 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexingAndDocprocRoutingTest.java @@ -15,7 +15,7 @@ import com.yahoo.vespa.model.routing.Protocol; import com.yahoo.vespa.model.routing.Routing; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; @@ -23,10 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author Einar M R Rosenvinge @@ -34,7 +31,7 @@ import static org.junit.Assert.fail; public class IndexingAndDocprocRoutingTest extends ContentBaseTest { @Test - public void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain() { + void oneContentOneDoctypeImplicitIndexingClusterImplicitIndexingChain() { final String CLUSTERNAME = "musiccluster"; SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null); searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -44,7 +41,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void oneContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() { + void oneContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() { final String CLUSTERNAME = "musicandbookscluster"; SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, null, null); searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -55,7 +52,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() { + void twoContentTwoDoctypesImplicitIndexingClusterImplicitIndexingChain() { final String MUSIC = "musiccluster"; SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, null, null); musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -67,7 +64,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { VespaModel model = getIndexedContentVespaModel(List.of(), List.of(musicCluster, booksCluster)); assertIndexing(model, - new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing"))); + new DocprocClusterSpec("container", new DocprocChainSpec("container/chain.indexing"))); assertFeedingRoute(model, MUSIC, "container/chain.indexing"); assertFeedingRoute(model, BOOKS, "container/chain.indexing"); @@ -75,7 +72,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { @Test - public void oneContentOneDoctypeExplicitIndexingClusterImplicitIndexingChain() { + void oneContentOneDoctypeExplicitIndexingClusterImplicitIndexingChain() { final String CLUSTERNAME = "musiccluster"; SearchClusterSpec searchCluster = new SearchClusterSpec(CLUSTERNAME, "dpcluster", null); searchCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -85,45 +82,45 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain() { + void oneSearchOneDoctypeExplicitIndexingClusterExplicitIndexingChain() { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + - "<services version=\"1.0\">\n" + - " <admin version=\"2.0\">\n" + - " <adminserver hostalias=\"node0\"/> \n" + - " </admin>\n" + - "\n" + - " <content id=\"searchcluster\" version=\"1.0\">\n" + - " <redundancy>2</redundancy>\n" + - " <documents>\n" + - " <document-processing cluster='dpcluster' chain='fooindexing'/>\n" + - " <document type=\"music\" mode=\"index\"/>\n" + - " </documents>\n" + - " <nodes>\n" + - " <node hostalias=\"node0\" distribution-key=\"0\"/>\n" + - " </nodes>\n" + - " </content>\n" + - " \n" + - " <container version='1.0' id='dpcluster'>\n" + - " <document-processing>\n" + - " <chain id='fooindexing' inherits='indexing '/>\n" + - " </document-processing>\n" + - " <nodes>\n" + - " <node hostalias='node0'/>\n" + - " </nodes>\n" + - " <http>\n" + - " <server id='dpcluster' port='8000'/>\n" + - " </http>\n" + - " </container>\n" + - "</services>\n"; + "<services version=\"1.0\">\n" + + " <admin version=\"2.0\">\n" + + " <adminserver hostalias=\"node0\"/> \n" + + " </admin>\n" + + "\n" + + " <content id=\"searchcluster\" version=\"1.0\">\n" + + " <redundancy>2</redundancy>\n" + + " <documents>\n" + + " <document-processing cluster='dpcluster' chain='fooindexing'/>\n" + + " <document type=\"music\" mode=\"index\"/>\n" + + " </documents>\n" + + " <nodes>\n" + + " <node hostalias=\"node0\" distribution-key=\"0\"/>\n" + + " </nodes>\n" + + " </content>\n" + + " \n" + + " <container version='1.0' id='dpcluster'>\n" + + " <document-processing>\n" + + " <chain id='fooindexing' inherits='indexing '/>\n" + + " </document-processing>\n" + + " <nodes>\n" + + " <node hostalias='node0'/>\n" + + " </nodes>\n" + + " <http>\n" + + " <server id='dpcluster' port='8000'/>\n" + + " </http>\n" + + " </container>\n" + + "</services>\n"; VespaModel model = getIndexedSearchVespaModel(xml); assertIndexing(model, new DocprocClusterSpec("dpcluster", new DocprocChainSpec("dpcluster/chain.fooindexing", "indexing"), - new DocprocChainSpec("dpcluster/chain.indexing"))); + new DocprocChainSpec("dpcluster/chain.indexing"))); assertFeedingRouteIndexed(model, "searchcluster", "dpcluster/chain.fooindexing"); } @Test - public void twoContentTwoDoctypesExplicitIndexingInSameIndexingCluster() { + void twoContentTwoDoctypesExplicitIndexingInSameIndexingCluster() { final String MUSIC = "musiccluster"; SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpcluster", null); musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -133,7 +130,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { booksCluster.searchDefs.add(new SearchDefSpec("book", "author", "title")); VespaModel model = getIndexedContentVespaModel(List.of(new DocprocClusterSpec("dpcluster")), - List.of(musicCluster, booksCluster)); + List.of(musicCluster, booksCluster)); assertIndexing(model, new DocprocClusterSpec("dpcluster", new DocprocChainSpec("dpcluster/chain.indexing"))); assertFeedingRoute(model, MUSIC, "dpcluster/chain.indexing"); @@ -141,7 +138,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void noContentClustersOneDocprocCluster() { + void noContentClustersOneDocprocCluster() { String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services version='1.0'>\n" + @@ -162,7 +159,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChain() { + void twoContentTwoDoctypesExplicitIndexingInDifferentIndexingClustersExplicitChain() { final String MUSIC = "musiccluster"; SearchClusterSpec musicCluster = new SearchClusterSpec(MUSIC, "dpmusiccluster", "dpmusicchain"); musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); @@ -174,7 +171,7 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain", "indexing")); DocprocClusterSpec dpBooksCluster = new DocprocClusterSpec("dpbookscluster", new DocprocChainSpec("dpbookschain", "indexing")); VespaModel model = getIndexedContentVespaModel(List.of(dpMusicCluster, dpBooksCluster), - List.of(musicCluster, booksCluster)); + List.of(musicCluster, booksCluster)); //after we generated model, add indexing chains for validation: dpMusicCluster.chains.clear(); @@ -191,11 +188,11 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void requiresIndexingInheritance() { + void requiresIndexingInheritance() { try { SearchClusterSpec musicCluster = new SearchClusterSpec("musiccluster", - "dpmusiccluster", - "dpmusicchain"); + "dpmusiccluster", + "dpmusicchain"); musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("dpmusicchain")); @@ -208,11 +205,11 @@ public class IndexingAndDocprocRoutingTest extends ContentBaseTest { } @Test - public void indexingChainShouldNotBeTheDefaultChain() { + void indexingChainShouldNotBeTheDefaultChain() { try { SearchClusterSpec musicCluster = new SearchClusterSpec("musiccluster", - "dpmusiccluster", - "default"); + "dpmusiccluster", + "default"); musicCluster.searchDefs.add(new SearchDefSpec("music", "artist", "album")); DocprocClusterSpec dpMusicCluster = new DocprocClusterSpec("dpmusiccluster", new DocprocChainSpec("default", "indexing")); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/MonitoringConfigSnoopTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/MonitoringConfigSnoopTest.java index d1ce16bfe73..95ab1b46401 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/MonitoringConfigSnoopTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/MonitoringConfigSnoopTest.java @@ -4,9 +4,10 @@ package com.yahoo.vespa.model.content; import com.yahoo.config.model.test.TestDriver; import com.yahoo.config.model.test.TestRoot; import com.yahoo.metrics.MetricsmanagerConfig; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; /** @@ -44,7 +45,7 @@ public class MonitoringConfigSnoopTest { } @Test - public void correct_config_is_snooped() { + void correct_config_is_snooped() { initRoot(60); assertEquals(2, getConfig().snapshot().periods().size()); assertEquals(60, getConfig().snapshot().periods(0)); @@ -52,7 +53,7 @@ public class MonitoringConfigSnoopTest { } @Test - public void correct_config_is_snooped_default_interval() { + void correct_config_is_snooped_default_interval() { String getAdminXmlIntervalNotSpecified = "<admin version='2.0'>" + " <adminserver hostalias='mockhost' />" + "</admin>"; @@ -64,8 +65,10 @@ public class MonitoringConfigSnoopTest { assertEquals(300, getConfig().snapshot().periods(1)); } - @Test(expected = Exception.class) - public void invalid_model_1() { - initRoot(120); + @Test + void invalid_model_1() { + assertThrows(Exception.class, () -> { + initRoot(120); + }); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/RedundancyTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/RedundancyTest.java index 437af50e3ef..c7e9b09d77d 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/RedundancyTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/RedundancyTest.java @@ -1,10 +1,10 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author bjorncs @@ -12,7 +12,7 @@ import static org.junit.Assert.assertTrue; public class RedundancyTest { @Test - public void effectively_globally_distributed_is_correct() { + void effectively_globally_distributed_is_correct() { assertFalse(createRedundancy(4, 2, 10).isEffectivelyGloballyDistributed()); assertFalse(createRedundancy(5, 1, 10).isEffectivelyGloballyDistributed()); assertFalse(createRedundancy(5, 2, 12).isEffectivelyGloballyDistributed()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java index 684f07d99f0..96ddf6ea215 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ReservedDocumentTypeNameValidatorTest.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.model.content; import com.yahoo.documentmodel.NewDocumentType; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Collections; @@ -12,9 +12,7 @@ import java.util.TreeMap; import java.util.function.Function; import java.util.stream.Collectors; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class ReservedDocumentTypeNameValidatorTest { @@ -23,7 +21,7 @@ public class ReservedDocumentTypeNameValidatorTest { } @Test - public void exception_thrown_on_reserved_names() { + void exception_thrown_on_reserved_names() { // Ensure ordering is consistent for testing Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(ReservedDocumentTypeNameValidator.ORDERED_RESERVED_NAMES)); @@ -40,13 +38,13 @@ public class ReservedDocumentTypeNameValidatorTest { } @Test - public void exception_is_not_thrown_on_unreserved_name() { + void exception_is_not_thrown_on_unreserved_name() { ReservedDocumentTypeNameValidator validator = new ReservedDocumentTypeNameValidator(); validator.validate(asDocTypeMapping(Collections.singletonList("foo"))); } @Test - public void validation_is_case_insensitive() { + void validation_is_case_insensitive() { ReservedDocumentTypeNameValidator validator = new ReservedDocumentTypeNameValidator(); Map<String, NewDocumentType> orderedDocTypes = new TreeMap<>(asDocTypeMapping(Arrays.asList("NULL", "True", "anD"))); try { @@ -54,7 +52,7 @@ public class ReservedDocumentTypeNameValidatorTest { fail(); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().startsWith("The following document types conflict with reserved keyword names: " + - "'NULL', 'True', 'anD'.")); + "'NULL', 'True', 'anD'.")); } } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/SchemaCoverageTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/SchemaCoverageTest.java index 66184d74251..7a331538291 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/SchemaCoverageTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/SchemaCoverageTest.java @@ -1,11 +1,9 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.content; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; /** * @author Simon Thoresen Hult @@ -13,7 +11,7 @@ import static org.junit.Assert.fail; public class SchemaCoverageTest { @Test - public void requireThatAccessorWork() { + void requireThatAccessorWork() { SearchCoverage coverage = new SearchCoverage.Builder() .setMinimum(0.1) .setMinWaitAfterCoverageFactor(0.2) @@ -25,7 +23,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatDefaultsAreNull() { + void requireThatDefaultsAreNull() { SearchCoverage search = new SearchCoverage.Builder().build(); assertNull(search.getMinimum()); assertNull(search.getMinWaitAfterCoverageFactor()); @@ -33,7 +31,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatInvalidMinimumCanNotBeSet() { + void requireThatInvalidMinimumCanNotBeSet() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMinimum(0.5); assertEquals(0.5, coverage.build().getMinimum(), 1E-6); @@ -54,7 +52,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatInvalidMinWaitAfterCoverageFactorCanNotBeSet() { + void requireThatInvalidMinWaitAfterCoverageFactorCanNotBeSet() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMinWaitAfterCoverageFactor(0.5); assertEquals(0.5, coverage.build().getMinWaitAfterCoverageFactor(), 1E-6); @@ -75,7 +73,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatInvalidMaxWaitAfterCoverageFactorCanNotBeSet() { + void requireThatInvalidMaxWaitAfterCoverageFactorCanNotBeSet() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMaxWaitAfterCoverageFactor(0.5); assertEquals(0.5, coverage.build().getMaxWaitAfterCoverageFactor(), 1E-6); @@ -96,7 +94,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatMinWaitCanNotBeSetLargerThanMaxWait() { + void requireThatMinWaitCanNotBeSetLargerThanMaxWait() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMaxWaitAfterCoverageFactor(0.5); coverage.setMinWaitAfterCoverageFactor(0.4); @@ -113,7 +111,7 @@ public class SchemaCoverageTest { } @Test - public void requireThatMaxWaitCanNotBeSetSmallerThanMaxWait() { + void requireThatMaxWaitCanNotBeSetSmallerThanMaxWait() { SearchCoverage.Builder coverage = new SearchCoverage.Builder(); coverage.setMinWaitAfterCoverageFactor(0.5); coverage.setMaxWaitAfterCoverageFactor(0.6); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java index c494ba0394a..f7afcc281f9 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageClusterTest.java @@ -21,13 +21,10 @@ import static com.yahoo.config.model.test.TestUtil.joinLines; import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.storagecluster.StorageCluster; import com.yahoo.vespa.model.content.utils.ContentClusterUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class StorageClusterTest { @@ -83,8 +80,9 @@ public class StorageClusterTest { group(), "</content>"); } + @Test - public void testBasics() { + void testBasics() { StorageCluster storage = parse(cluster("foofighters", "")); assertEquals(1, storage.getChildren().size()); @@ -95,8 +93,9 @@ public class StorageClusterTest { assertEquals("foofighters", config.cluster_name()); assertEquals(4, config.content_node_bucket_db_stripe_bits()); } + @Test - public void testCommunicationManagerDefaults() { + void testCommunicationManagerDefaults() { StorageCluster storage = parse(cluster("foofighters", "")); StorCommunicationmanagerConfig.Builder builder = new StorCommunicationmanagerConfig.Builder(); storage.getChildren().get("0").getConfig(builder); @@ -105,7 +104,7 @@ public class StorageClusterTest { } @Test - public void testMergeDefaults() { + void testMergeDefaults() { StorServerConfig.Builder builder = new StorServerConfig.Builder(); parse(cluster("foofighters", "")).getConfig(builder); @@ -116,7 +115,7 @@ public class StorageClusterTest { } @Test - public void testMerges() { + void testMerges() { StorServerConfig.Builder builder = new StorServerConfig.Builder(); parse(cluster("foofighters", joinLines( "<tuning>", @@ -127,7 +126,7 @@ public class StorageClusterTest { StorServerConfig config = new StorServerConfig(builder); assertEquals(1024, config.max_merges_per_node()); - assertEquals(1024*10, config.max_merge_queue_size()); + assertEquals(1024 * 10, config.max_merge_queue_size()); } private StorServerConfig configFromProperties(TestProperties properties) { @@ -149,7 +148,7 @@ public class StorageClusterTest { } @Test - public void verifyDefaultMbusConfig() { + void verifyDefaultMbusConfig() { var confg = communicationmanagerConfigFromProperties(new TestProperties()); assertEquals(1, confg.mbus().num_network_threads()); assertEquals(1, confg.mbus().num_rpc_targets()); @@ -159,7 +158,7 @@ public class StorageClusterTest { } @Test - public void verifyDefaultMbusConfigControl() { + void verifyDefaultMbusConfigControl() { var confg = communicationmanagerConfigFromProperties(new TestProperties() .setMbusNetworkThreads(7) .setRpcNumTargets(11) @@ -174,20 +173,20 @@ public class StorageClusterTest { } @Test - public void testMergeFeatureFlags() { + void testMergeFeatureFlags() { var config = configFromProperties(new TestProperties().setMaxMergeQueueSize(1919).setMaxConcurrentMergesPerNode(37)); assertEquals(37, config.max_merges_per_node()); assertEquals(1919, config.max_merge_queue_size()); } @Test - public void merge_throttling_policy_config_defaults_to_static() { + void merge_throttling_policy_config_defaults_to_static() { var config = configFromProperties(new TestProperties()); assertEquals(StorServerConfig.Merge_throttling_policy.Type.STATIC, config.merge_throttling_policy().type()); } @Test - public void merge_throttling_policy_config_is_derived_from_flag() { + void merge_throttling_policy_config_is_derived_from_flag() { var config = configFromProperties(new TestProperties().setMergeThrottlingPolicy("STATIC")); assertEquals(StorServerConfig.Merge_throttling_policy.Type.STATIC, config.merge_throttling_policy().type()); @@ -200,15 +199,15 @@ public class StorageClusterTest { } @Test - public void testVisitors() { + void testVisitors() { StorVisitorConfig.Builder builder = new StorVisitorConfig.Builder(); parse(cluster("bees", joinLines( - "<tuning>", - " <visitors thread-count=\"7\" max-queue-size=\"1000\">", - " <max-concurrent fixed=\"42\" variable=\"100\"/>", - " </visitors>", - "</tuning>")) + "<tuning>", + " <visitors thread-count=\"7\" max-queue-size=\"1000\">", + " <max-concurrent fixed=\"42\" variable=\"100\"/>", + " </visitors>", + "</tuning>")) ).getConfig(builder); StorVisitorConfig config = new StorVisitorConfig(builder); @@ -219,9 +218,9 @@ public class StorageClusterTest { } @Test - public void testPersistenceThreads() { + void testPersistenceThreads() { - StorageCluster stc = parse(cluster("bees",joinLines( + StorageCluster stc = parse(cluster("bees", joinLines( "<tuning>", " <persistence-threads count=\"7\"/>", "</tuning>")), @@ -244,9 +243,9 @@ public class StorageClusterTest { } @Test - public void testResponseThreads() { + void testResponseThreads() { - StorageCluster stc = parse(cluster("bees",joinLines( + StorageCluster stc = parse(cluster("bees", joinLines( "<tuning>", " <persistence-threads count=\"7\"/>", "</tuning>")), @@ -259,7 +258,7 @@ public class StorageClusterTest { } @Test - public void testPersistenceThreadsOld() { + void testPersistenceThreadsOld() { StorageCluster stc = parse(cluster("bees", joinLines( "<tuning>", @@ -287,7 +286,7 @@ public class StorageClusterTest { } @Test - public void testNoPersistenceThreads() { + void testNoPersistenceThreads() { StorageCluster stc = parse(cluster("bees", ""), new Flavor(new FlavorsConfig.Flavor.Builder().name("test-flavor").minCpuCores(9).build()) ); @@ -311,7 +310,7 @@ public class StorageClusterTest { } @Test - public void testFeatureFlagControlOfResponseSequencer() { + void testFeatureFlagControlOfResponseSequencer() { var config = filestorConfigFromProducer(simpleCluster(new TestProperties().setResponseNumThreads(13).setResponseSequencerType("THROUGHPUT"))); assertEquals(13, config.num_response_threads()); assertEquals(StorFilestorConfig.Response_sequencer_type.THROUGHPUT, config.response_sequencer_type()); @@ -321,14 +320,15 @@ public class StorageClusterTest { var config = filestorConfigFromProducer(simpleCluster(new TestProperties().setAsyncMessageHandlingOnSchedule(value))); assertEquals(expected, config.use_async_message_handling_on_schedule()); } + @Test - public void testFeatureFlagControlOfAsyncMessageHandlingOnSchedule() { + void testFeatureFlagControlOfAsyncMessageHandlingOnSchedule() { verifyAsyncMessageHandlingOnSchedule(false, false); verifyAsyncMessageHandlingOnSchedule(true, true); } @Test - public void persistence_dynamic_throttling_parameters_have_sane_defaults() { + void persistence_dynamic_throttling_parameters_have_sane_defaults() { var config = filestorConfigFromProducer(simpleCluster(new TestProperties())); assertEquals(StorFilestorConfig.Async_operation_throttler.Type.DYNAMIC, config.async_operation_throttler().type()); assertEquals(1.2, config.async_operation_throttler().window_size_decrement_factor(), 0.0001); @@ -340,7 +340,7 @@ public class StorageClusterTest { } @Test - public void persistence_dynamic_throttling_parameters_can_be_set_through_feature_flags() { + void persistence_dynamic_throttling_parameters_can_be_set_through_feature_flags() { var config = filestorConfigFromProducer(simpleCluster(new TestProperties() .setPersistenceThrottlingWsDecrementFactor(1.5) .setPersistenceThrottlingWsBackoff(0.8) @@ -357,7 +357,7 @@ public class StorageClusterTest { } @Test - public void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() { + void integrity_checker_explicitly_disabled_when_not_running_with_vds_provider() { StorIntegritycheckerConfig.Builder builder = new StorIntegritycheckerConfig.Builder(); parse(cluster("bees", "")).getConfig(builder); StorIntegritycheckerConfig config = new StorIntegritycheckerConfig(builder); @@ -366,7 +366,7 @@ public class StorageClusterTest { } @Test - public void testCapacity() { + void testCapacity() { String xml = joinLines( "<cluster id=\"storage\">", " <documents/>", @@ -385,12 +385,12 @@ public class StorageClusterTest { cluster.getStorageCluster().getConfig(builder); node.getConfig(builder); StorServerConfig config = new StorServerConfig(builder); - assertEquals(1.0 + (double)i * 0.5, config.node_capacity(), 0.001); + assertEquals(1.0 + (double) i * 0.5, config.node_capacity(), 0.001); } } @Test - public void testRootFolder() { + void testRootFolder() { ContentCluster cluster = ContentClusterUtils.createCluster(cluster("storage", ""), new MockRoot()); StorageNode node = cluster.getStorageCluster().getChildren().get("0"); @@ -413,7 +413,7 @@ public class StorageClusterTest { } @Test - public void testGenericPersistenceTuning() { + void testGenericPersistenceTuning() { String xml = joinLines( "<cluster id=\"storage\">", " <documents/>", @@ -439,7 +439,7 @@ public class StorageClusterTest { } @Test - public void requireThatUserDoesNotSpecifyBothGroupAndNodes() { + void requireThatUserDoesNotSpecifyBothGroupAndNodes() { String xml = joinLines( "<cluster id=\"storage\">", " <documents/>", @@ -465,12 +465,12 @@ public class StorageClusterTest { fail("Did not fail when having both group and nodes"); } catch (RuntimeException e) { assertEquals("Both <group> and <nodes> is specified: Only one of these tags can be used in the same configuration", - e.getMessage()); + e.getMessage()); } } @Test - public void requireThatGroupNamesMustBeUniqueAmongstSiblings() { + void requireThatGroupNamesMustBeUniqueAmongstSiblings() { String xml = joinLines( "<cluster id=\"storage\">", " <redundancy>2</redundancy>", @@ -491,12 +491,12 @@ public class StorageClusterTest { fail("Did not get exception with duplicate group names"); } catch (RuntimeException e) { assertEquals("Cluster 'storage' has multiple groups with name 'bar' in the same subgroup. " + - "Group sibling names must be unique.", e.getMessage()); + "Group sibling names must be unique.", e.getMessage()); } } @Test - public void requireThatGroupNamesCanBeDuplicatedAcrossLevels() { + void requireThatGroupNamesCanBeDuplicatedAcrossLevels() { String xml = joinLines( "<cluster id=\"storage\">", " <redundancy>2</redundancy>", @@ -521,7 +521,7 @@ public class StorageClusterTest { } @Test - public void requireThatNestedGroupsRequireDistribution() { + void requireThatNestedGroupsRequireDistribution() { String xml = joinLines( "<cluster id=\"storage\">", " <documents/>", diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageContentTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageContentTest.java index bbfcc0ac4c4..a7ad376b483 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageContentTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageContentTest.java @@ -9,7 +9,7 @@ import com.yahoo.vespa.model.routing.DocumentProtocol; import com.yahoo.vespa.model.routing.Routing; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import java.util.Map; @@ -17,10 +17,7 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.*; public class StorageContentTest extends ContentBaseTest { // TODO: Test with document-definitions @@ -105,7 +102,7 @@ public class StorageContentTest extends ContentBaseTest { } @Test - public void testDocumentTypesRouting() throws Exception { + void testDocumentTypesRouting() throws Exception { String cluster1docs = "<documents>\n" + " <document type=\"type1\" mode=\"store-only\"/>\n" + " <document type=\"type2\" mode=\"store-only\"/>\n" + @@ -120,7 +117,7 @@ public class StorageContentTest extends ContentBaseTest { } @Test - public void testDocumentTypesAndLocalSelectionRouting() throws Exception { + void testDocumentTypesAndLocalSelectionRouting() throws Exception { String cluster1docs = "<documents>\n" + " <document type=\"type1\" mode=\"store-only\" selection=\"1 != 2\"/>\n" + " <document type=\"type2\" mode=\"store-only\" selection=\"now() > 1000\"/>\n" + @@ -135,7 +132,7 @@ public class StorageContentTest extends ContentBaseTest { } @Test - public void testDocumentTypesAndGlobalSelection() throws Exception { + void testDocumentTypesAndGlobalSelection() throws Exception { String cluster1docs = "<documents selection=\"5 != 6\">\n" + " <document type=\"type1\" mode=\"store-only\" selection=\"type1.f1 == 'baz'\"/>\n" + // Can refer to own type " <document type=\"type2\" mode=\"store-only\"/>\n" + @@ -150,7 +147,7 @@ public class StorageContentTest extends ContentBaseTest { } @Test - public void testIllegalDocumentTypesInSelection() throws Exception { + void testIllegalDocumentTypesInSelection() throws Exception { String localDefs = "<documents>\n" + " <document type=\"type1\" mode=\"store-only\"/>\n" + " <document type=\"type2\" mode=\"store-only\" selection=\"type1.bar == 'baz'\"/>\n" + // Not own type diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageGroupTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageGroupTest.java index 7ea8420c162..5407298d0a5 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/StorageGroupTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/StorageGroupTest.java @@ -6,10 +6,10 @@ import com.yahoo.vespa.config.content.DistributionConfig; import com.yahoo.vespa.config.content.StorDistributionConfig; import com.yahoo.vespa.model.content.cluster.ContentCluster; import com.yahoo.vespa.model.content.utils.ContentClusterUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.fail; /** * Test for storage groups. @@ -21,7 +21,7 @@ public class StorageGroupTest { } @Test - public void testSingleGroup() throws Exception { + void testSingleGroup() throws Exception { ContentCluster cluster = parse( "<content id=\"storage\">\n" + " <documents/>" + @@ -65,7 +65,7 @@ public class StorageGroupTest { } @Test - public void testNestedGroupsNoDistribution() { + void testNestedGroupsNoDistribution() { try { parse( "<content version=\"1.0\" id=\"storage\">\n" + @@ -87,7 +87,7 @@ public class StorageGroupTest { } @Test - public void testNestedGroups() throws Exception { + void testNestedGroups() throws Exception { ContentCluster cluster = parse( "<content version=\"1.0\" id=\"storage\">\n" + " <redundancy>4</redundancy>" + @@ -171,7 +171,7 @@ public class StorageGroupTest { } @Test - public void testGroupCapacity() throws Exception { + void testGroupCapacity() throws Exception { ContentCluster cluster = parse( "<content version=\"1.0\" id=\"storage\">\n" + " <redundancy>2</redundancy>" + diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java index b6e2e9e4eae..cad888168fe 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorterTest.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.model.content; import com.yahoo.documentmodel.NewDocumentType; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.ArrayList; import java.util.Arrays; @@ -11,7 +11,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author geirst @@ -19,14 +19,14 @@ import static org.junit.Assert.assertEquals; public class TopologicalDocumentTypeSorterTest { @Test - public void require_that_types_without_references_are_returned_in_input_order() { + void require_that_types_without_references_are_returned_in_input_order() { assertOrder(Arrays.asList("a"), new DocumentTypesBuilder().add("a")); assertOrder(Arrays.asList("a", "c", "b"), new DocumentTypesBuilder().add("a").add("c").add("b")); } @Test - public void require_that_types_with_references_are_sorted_in_topological_order() { + void require_that_types_with_references_are_sorted_in_topological_order() { assertOrder(Arrays.asList("b", "a"), new DocumentTypesBuilder() .add("a", Arrays.asList("b")) .add("b")); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java index aa68dad83cd..1104ac7477a 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/ClusterTest.java @@ -9,13 +9,13 @@ import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.model.content.Content; import com.yahoo.vespa.model.search.IndexedSearchCluster; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.List; import static com.yahoo.config.model.test.TestUtil.joinLines; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * @author Simon Thoresen Hult @@ -25,7 +25,7 @@ public class ClusterTest { private static final double DELTA = 1E-12; @Test - public void requireThatContentSearchIsApplied() { + void requireThatContentSearchIsApplied() { ContentCluster cluster = newContentCluster(joinLines("<search>", " <query-timeout>1.1</query-timeout>", " <visibility-delay>2.3</visibility-delay>", @@ -39,7 +39,7 @@ public class ClusterTest { } @Test - public void requireThatVisibilityDelayIsZeroForGlobalDocumentType() { + void requireThatVisibilityDelayIsZeroForGlobalDocumentType() { ContentCluster cluster = newContentCluster(joinLines("<search>", " <visibility-delay>2.3</visibility-delay>", "</search>"), true); @@ -48,7 +48,7 @@ public class ClusterTest { } @Test - public void requireThatSearchCoverageIsApplied() { + void requireThatSearchCoverageIsApplied() { ContentCluster cluster = newContentCluster(joinLines("<search>", " <coverage>", " <minimum>0.11</minimum>", @@ -67,15 +67,15 @@ public class ClusterTest { } @Test - public void requireThatDispatchTuningIsApplied() { + void requireThatDispatchTuningIsApplied() { ContentCluster cluster = newContentCluster(joinLines("<search>", "</search>"), - "", - joinLines( - "<max-hits-per-partition>77</max-hits-per-partition>", - "<dispatch-policy>round-robin</dispatch-policy>", - "<min-active-docs-coverage>93</min-active-docs-coverage>", - "<top-k-probability>0.777</top-k-probability>"), - false); + "", + joinLines( + "<max-hits-per-partition>77</max-hits-per-partition>", + "<dispatch-policy>round-robin</dispatch-policy>", + "<min-active-docs-coverage>93</min-active-docs-coverage>", + "<top-k-probability>0.777</top-k-probability>"), + false); DispatchConfig.Builder builder = new DispatchConfig.Builder(); cluster.getSearch().getConfig(builder); DispatchConfig config = new DispatchConfig(builder); @@ -87,9 +87,9 @@ public class ClusterTest { } @Test - public void requireThatDefaultDispatchConfigIsCorrect() { + void requireThatDefaultDispatchConfigIsCorrect() { ContentCluster cluster = newContentCluster(joinLines("<search>", "</search>"), - joinLines("<tuning>", "</tuning>")); + joinLines("<tuning>", "</tuning>")); DispatchConfig.Builder builder = new DispatchConfig.Builder(); cluster.getSearch().getConfig(builder); DispatchConfig config = new DispatchConfig(builder); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomContentApplicationBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomContentApplicationBuilderTest.java index 11aeea5f90d..d73b7f78391 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomContentApplicationBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomContentApplicationBuilderTest.java @@ -3,14 +3,14 @@ package com.yahoo.vespa.model.content.cluster; import com.yahoo.vespa.model.content.ContentSearch; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; -import org.junit.Test; +import org.junit.jupiter.api.Test; import javax.xml.parsers.DocumentBuilderFactory; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * @author Simon Thoresen Hult @@ -18,7 +18,7 @@ import static org.junit.Assert.assertNull; public class DomContentApplicationBuilderTest { @Test - public void requireThatDefaultsAreNull() throws Exception { + void requireThatDefaultsAreNull() throws Exception { ContentSearch search = newContentSearch( "<content/>"); assertNull(search.getVisibilityDelay()); @@ -26,24 +26,24 @@ public class DomContentApplicationBuilderTest { } @Test - public void requireThatEmptySearchIsSafe() throws Exception { + void requireThatEmptySearchIsSafe() throws Exception { ContentSearch search = newContentSearch( "<content>" + - " <search/>" + - "</content>"); + " <search/>" + + "</content>"); assertNull(search.getVisibilityDelay()); assertNull(search.getQueryTimeout()); } @Test - public void requireThatContentSearchCanBeBuilt() throws Exception { + void requireThatContentSearchCanBeBuilt() throws Exception { ContentSearch search = newContentSearch( "<content>" + - " <search>" + - " <query-timeout>1.1</query-timeout>" + - " <visibility-delay>2.3</visibility-delay>" + - " </search>" + - "</content>"); + " <search>" + + " <query-timeout>1.1</query-timeout>" + + " <visibility-delay>2.3</visibility-delay>" + + " </search>" + + "</content>"); assertEquals(1.1, search.getQueryTimeout(), 1E-6); assertEquals(2.3, search.getVisibilityDelay(), 1E-6); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java index a9a784668b3..564d6024acf 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomDispatchTuningBuilderTest.java @@ -4,15 +4,14 @@ package com.yahoo.vespa.model.content.cluster; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; import com.yahoo.vespa.model.content.DispatchTuning; import com.yahoo.vespa.model.test.utils.DeployLoggerStub; -import org.junit.Test; +import org.junit.jupiter.api.Test; import javax.xml.parsers.DocumentBuilderFactory; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author Simon Thoresen Hult @@ -20,29 +19,29 @@ import static org.junit.Assert.assertTrue; public class DomDispatchTuningBuilderTest { @Test - public void requireThatDefaultsAreNull() throws Exception { + void requireThatDefaultsAreNull() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content/>"); assertNull(dispatch.getMaxHitsPerPartition()); } @Test - public void requireThatEmptyTuningIsSafe() throws Exception { + void requireThatEmptyTuningIsSafe() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content>" + - " <tuning/>" + - "</content>"); + " <tuning/>" + + "</content>"); assertNull(dispatch.getMaxHitsPerPartition()); } @Test - public void requireThatEmptydispatchIsSafe() throws Exception { + void requireThatEmptydispatchIsSafe() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content>" + - " <tuning>" + - " <dispatch/>" + - " </tuning>" + - "</content>"); + " <tuning>" + + " <dispatch/>" + + " </tuning>" + + "</content>"); assertNull(dispatch.getMaxHitsPerPartition()); assertNull(dispatch.getMinActiveDocsCoverage()); assertNull(dispatch.getDispatchPolicy()); @@ -50,23 +49,24 @@ public class DomDispatchTuningBuilderTest { } @Test - public void requireThatTuningDispatchCanBeBuilt() throws Exception { + void requireThatTuningDispatchCanBeBuilt() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content>" + - " <tuning>" + - " <dispatch>" + - " <max-hits-per-partition>69</max-hits-per-partition>" + - " <min-active-docs-coverage>12.5</min-active-docs-coverage>" + - " <top-k-probability>0.999</top-k-probability>" + - " </dispatch>" + - " </tuning>" + - "</content>"); + " <tuning>" + + " <dispatch>" + + " <max-hits-per-partition>69</max-hits-per-partition>" + + " <min-active-docs-coverage>12.5</min-active-docs-coverage>" + + " <top-k-probability>0.999</top-k-probability>" + + " </dispatch>" + + " </tuning>" + + "</content>"); assertEquals(69, dispatch.getMaxHitsPerPartition().intValue()); assertEquals(12.5, dispatch.getMinActiveDocsCoverage().doubleValue(), 0.0); assertEquals(0.999, dispatch.getTopkProbability().doubleValue(), 0.0); } + @Test - public void requireThatTuningDispatchPolicyRoundRobin() throws Exception { + void requireThatTuningDispatchPolicyRoundRobin() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content>" + " <tuning>" + @@ -75,10 +75,11 @@ public class DomDispatchTuningBuilderTest { " </dispatch>" + " </tuning>" + "</content>"); - assertTrue(DispatchTuning.DispatchPolicy.ROUNDROBIN == dispatch.getDispatchPolicy()); + assertEquals(DispatchTuning.DispatchPolicy.ROUNDROBIN, dispatch.getDispatchPolicy()); } + @Test - public void requireThatTuningDispatchPolicyRandom() throws Exception { + void requireThatTuningDispatchPolicyRandom() throws Exception { DispatchTuning dispatch = newTuningDispatch( "<content>" + " <tuning>" + @@ -87,7 +88,7 @@ public class DomDispatchTuningBuilderTest { " </dispatch>" + " </tuning>" + "</content>"); - assertTrue(DispatchTuning.DispatchPolicy.ADAPTIVE == dispatch.getDispatchPolicy()); + assertEquals(DispatchTuning.DispatchPolicy.ADAPTIVE, dispatch.getDispatchPolicy()); } private static DispatchTuning newTuningDispatch(String xml) throws Exception { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomSchemaCoverageBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomSchemaCoverageBuilderTest.java index 6c5456e73fc..8fae348f648 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomSchemaCoverageBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/DomSchemaCoverageBuilderTest.java @@ -3,14 +3,14 @@ package com.yahoo.vespa.model.content.cluster; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; import com.yahoo.vespa.model.content.SearchCoverage; -import org.junit.Test; +import org.junit.jupiter.api.Test; import javax.xml.parsers.DocumentBuilderFactory; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; /** * @author Simon Thoresen Hult @@ -18,7 +18,7 @@ import static org.junit.Assert.assertNull; public class DomSchemaCoverageBuilderTest { @Test - public void requireThatDefaultsAreNull() throws Exception { + void requireThatDefaultsAreNull() throws Exception { SearchCoverage coverage = newSearchCoverage( "<content/>"); assertNull(coverage.getMinimum()); @@ -27,41 +27,41 @@ public class DomSchemaCoverageBuilderTest { } @Test - public void requireThatEmptySearchIsSafe() throws Exception { + void requireThatEmptySearchIsSafe() throws Exception { SearchCoverage coverage = newSearchCoverage( "<content>" + - " <search/>" + - "</content>"); + " <search/>" + + "</content>"); assertNull(coverage.getMinimum()); assertNull(coverage.getMinWaitAfterCoverageFactor()); assertNull(coverage.getMaxWaitAfterCoverageFactor()); } @Test - public void requireThatEmptyCoverageIsSafe() throws Exception { + void requireThatEmptyCoverageIsSafe() throws Exception { SearchCoverage coverage = newSearchCoverage( "<content>" + - " <search>" + - " <coverage/>" + - " </search>" + - "</content>"); + " <search>" + + " <coverage/>" + + " </search>" + + "</content>"); assertNull(coverage.getMinimum()); assertNull(coverage.getMinWaitAfterCoverageFactor()); assertNull(coverage.getMaxWaitAfterCoverageFactor()); } @Test - public void requireThatSearchCoverageCanBeBuilt() throws Exception { + void requireThatSearchCoverageCanBeBuilt() throws Exception { SearchCoverage coverage = newSearchCoverage( "<content>" + - " <search>" + - " <coverage>" + - " <minimum>0.11</minimum>" + - " <min-wait-after-coverage-factor>0.23</min-wait-after-coverage-factor>" + - " <max-wait-after-coverage-factor>0.58</max-wait-after-coverage-factor>" + - " </coverage>" + - " </search>" + - "</content>"); + " <search>" + + " <coverage>" + + " <minimum>0.11</minimum>" + + " <min-wait-after-coverage-factor>0.23</min-wait-after-coverage-factor>" + + " <max-wait-after-coverage-factor>0.58</max-wait-after-coverage-factor>" + + " </coverage>" + + " </search>" + + "</content>"); assertEquals(0.11, coverage.getMinimum(), 1E-6); assertEquals(0.23, coverage.getMinWaitAfterCoverageFactor(), 1E-6); assertEquals(0.58, coverage.getMaxWaitAfterCoverageFactor(), 1E-6); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java index 8f654a86fef..e1b33ddedd2 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/cluster/GlobalDistributionBuilderTest.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.model.content.cluster; import com.yahoo.documentmodel.NewDocumentType; import com.yahoo.text.XML; import com.yahoo.vespa.model.builder.xml.dom.ModelElement; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.HashMap; @@ -12,7 +12,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * @author bjorncs @@ -25,15 +25,15 @@ public class GlobalDistributionBuilderTest { private static final NewDocumentType GLOBAL_2 = new NewDocumentType(new NewDocumentType.Name("global-2")); @Test - public void global_documents_are_identified() { + void global_documents_are_identified() { GlobalDistributionBuilder builder = new GlobalDistributionBuilder(createDocumentDefinitions()); String documentsElement = "<documents>" + - " <document type=\"" + NON_GLOBAL_EXPLICIT.getName() + "\" global=\"false\"/>" + - " <document type=\"" + GLOBAL_1.getName() + "\" global=\"true\"/>" + - " <document type=\"" + NON_GLOBAL_IMPLICIT.getName() + "\"/>" + - " <document type=\"" + GLOBAL_2.getName() + "\" global=\"true\"/>" + - "</documents>"; + " <document type=\"" + NON_GLOBAL_EXPLICIT.getName() + "\" global=\"false\"/>" + + " <document type=\"" + GLOBAL_1.getName() + "\" global=\"true\"/>" + + " <document type=\"" + NON_GLOBAL_IMPLICIT.getName() + "\"/>" + + " <document type=\"" + GLOBAL_2.getName() + "\" global=\"true\"/>" + + "</documents>"; Set<NewDocumentType> expectedResult = new HashSet<>(Arrays.asList(GLOBAL_1, GLOBAL_2)); Set<NewDocumentType> actualResult = builder.build(new ModelElement(XML.getDocument(documentsElement).getDocumentElement())); |