diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-02-18 22:53:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 22:53:49 +0100 |
commit | 07466b9a8a8d4b6d61b193893a1ef13bed1f47c0 (patch) | |
tree | 99bf9a95e96b7aa52ade0e9f4d0a7668fc54ef2a /config-model/src/test | |
parent | 44df20d9b47440b38ad49a95f972e47c0e997898 (diff) | |
parent | 760e14dfef63c04d27a6b6e88bd2d003bafdd314 (diff) |
Merge pull request #12202 from vespa-engine/revert-12197-revert-12184-balder/rpcresourcepool
Revert "Revert "Create a resourcepool so that we do not need to reconnect to content …""
Diffstat (limited to 'config-model/src/test')
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java index 1c4e005cb67..e5bc0644e10 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java @@ -18,12 +18,15 @@ import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.container.ContainerCluster; import com.yahoo.vespa.model.container.component.Component; import com.yahoo.vespa.model.search.AbstractSearchCluster; -import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils; import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + /** * Unit tests for SearchCluster. Please use this instead of SearchModelTestCase if possible and @@ -160,23 +163,30 @@ public class SearchClusterTest { AbstractSearchCluster searchCluster2 = model.getSearchClusters().get(xbulkIndex); assertEquals("xbulk", searchCluster2.getClusterName()); - Component<?,?> normalDispatcher = (Component<?, ?>)containerCluster1.getComponentsMap().get(new ComponentId("dispatcher.normal")); - assertNotNull(normalDispatcher); - assertEquals("dispatcher.normal", normalDispatcher.getComponentId().stringValue()); - assertEquals("com.yahoo.search.dispatch.Dispatcher", normalDispatcher.getClassId().stringValue()); - assertEquals("j1/component/dispatcher.normal", normalDispatcher.getConfigId()); - DispatchConfig.Builder normalDispatchConfigBuilder = new DispatchConfig.Builder(); - model.getConfig(normalDispatchConfigBuilder, "j1/component/dispatcher.normal"); - assertEquals("node2host", normalDispatchConfigBuilder.build().node(0).host()); - - Component<?,?> xbulkDispatcher = (Component<?, ?>)containerCluster1.getComponentsMap().get(new ComponentId("dispatcher.xbulk")); - assertNotNull(xbulkDispatcher); - assertEquals("dispatcher.xbulk", xbulkDispatcher.getComponentId().stringValue()); - assertEquals("com.yahoo.search.dispatch.Dispatcher", xbulkDispatcher.getClassId().stringValue()); - assertEquals("j1/component/dispatcher.xbulk", xbulkDispatcher.getConfigId()); - DispatchConfig.Builder xbulkDispatchConfigBuilder = new DispatchConfig.Builder(); - model.getConfig(xbulkDispatchConfigBuilder, "j1/component/dispatcher.xbulk"); - assertEquals("node0host", xbulkDispatchConfigBuilder.build().node(0).host()); + verifyDispatch(model, containerCluster1, "normal", "node2host"); + verifyDispatch(model, containerCluster1, "xbulk", "node0host"); + } + + private void verifyDispatch(VespaModel model, ContainerCluster containerCluster, String cluster, String host) { + Component<?,?> dispatcher = (Component<?, ?>)containerCluster.getComponentsMap().get(new ComponentId("dispatcher." + cluster)); + assertNotNull(dispatcher); + assertEquals("dispatcher." + cluster, dispatcher.getComponentId().stringValue()); + assertEquals("com.yahoo.search.dispatch.Dispatcher", dispatcher.getClassId().stringValue()); + assertEquals("j1/component/dispatcher." + cluster, dispatcher.getConfigId()); + DispatchConfig.Builder dispatchConfigBuilder = new DispatchConfig.Builder(); + model.getConfig(dispatchConfigBuilder, dispatcher.getConfigId()); + assertEquals(host, dispatchConfigBuilder.build().node(0).host()); + + assertTrue(dispatcher.getInjectedComponentIds().contains("com.yahoo.search.dispatch.rpc.RpcResourcePool")); + + Component<?,?> rpcResourcePool = (Component<?, ?>)dispatcher.getChildren().get("com.yahoo.search.dispatch.rpc.RpcResourcePool"); + assertNotNull(rpcResourcePool); + assertEquals("com.yahoo.search.dispatch.rpc.RpcResourcePool", rpcResourcePool.getComponentId().stringValue()); + assertEquals("com.yahoo.search.dispatch.rpc.RpcResourcePool", rpcResourcePool.getClassId().stringValue()); + assertEquals("j1/component/dispatcher." + cluster + "/com.yahoo.search.dispatch.rpc.RpcResourcePool", rpcResourcePool.getConfigId()); + dispatchConfigBuilder = new DispatchConfig.Builder(); + model.getConfig(dispatchConfigBuilder, rpcResourcePool.getConfigId()); + assertEquals(host, dispatchConfigBuilder.build().node(0).host()); } } |