summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@oath.com>2017-12-05 11:29:53 +0100
committerHarald Musum <musum@oath.com>2017-12-05 11:29:53 +0100
commitc87da6a4eae79bbb5e9bf823b48eeedb87f44a04 (patch)
tree729bc9d31bc7ecc0296751d1b38984965e523802 /config-model
parent43e141e0567ae7eb67c0d7eeb9eb8177a59fab04 (diff)
Remove testing of gateway (removed in Vespa 6)
Move testing of QrConfig, which I could find no other place, to its own test
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/clients/test/Gateway20TestCase.java65
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java38
2 files changed, 37 insertions, 66 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/clients/test/Gateway20TestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/clients/test/Gateway20TestCase.java
deleted file mode 100644
index e7df151a3c4..00000000000
--- a/config-model/src/test/java/com/yahoo/vespa/model/clients/test/Gateway20TestCase.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.clients.test;
-
-import com.yahoo.container.ComponentsConfig;
-import com.yahoo.container.QrConfig;
-import com.yahoo.container.QrConfig.Builder;
-import com.yahoo.net.HostName;
-import com.yahoo.vespa.model.VespaModel;
-import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
-/**
- * @author Gunnar Gauslaa Bergem
- */
-public class Gateway20TestCase {
-
- private static String hostname = HostName.getLocalhost(); // Using the same way of getting hostname as filedistribution model
-
- @Test
- public void testSimpleDocprocV3() throws Exception {
- VespaModel model = new VespaModelCreatorWithFilePkg("src/test/cfg/clients/simpleconfig.v2.docprocv3").create();
- QrConfig qrConfig = new QrConfig((Builder) model.getConfig(new QrConfig.Builder(), "container/container.0"));
- assertEquals(qrConfig.rpc().enabled(), true);
- assertEquals("filedistribution/" + hostname, qrConfig.filedistributor().configid());
- assertEquals("container.container.0", qrConfig.discriminator());
-
- ComponentsConfig componentsConfig = new ComponentsConfig((ComponentsConfig.Builder) model.getConfig(new ComponentsConfig.Builder(), "container/container.0"));
- ArrayList<String> components = new ArrayList<>();
- for (ComponentsConfig.Components component : componentsConfig.components()) {
- components.add(component.id());
- }
- List<String> expectedComponents = Arrays.asList("com.yahoo.docproc.jdisc.DocumentProcessingHandler",
- "com.yahoo.feedhandler.VespaFeedHandler",
- "com.yahoo.feedhandler.VespaFeedHandlerCompatibility",
- "com.yahoo.feedhandler.VespaFeedHandlerGet",
- "com.yahoo.feedhandler.VespaFeedHandlerRemove",
- "com.yahoo.feedhandler.VespaFeedHandlerRemoveLocation",
- "com.yahoo.feedhandler.VespaFeedHandlerStatus",
- "com.yahoo.feedhandler.VespaFeedHandlerVisit",
- "com.yahoo.search.handler.SearchHandler",
- "com.yahoo.container.jdisc.state.StateHandler");
- assertTrue(components.containsAll(expectedComponents));
- }
-
- @Test
- public void testAdvanced() throws Exception {
- VespaModel model = new VespaModelCreatorWithFilePkg("src/test/cfg/clients/advancedconfig.v2").create();
-
- QrConfig qrConfig = new QrConfig((Builder) model.getConfig(new QrConfig.Builder(), "container/container.0"));
- assertEquals(qrConfig.rpc().enabled(), true);
- assertEquals(qrConfig.filedistributor().configid(), "filedistribution/" + hostname);
- assertEquals("container.container.0", qrConfig.discriminator());
-
- qrConfig = new QrConfig((Builder) model.getConfig(new QrConfig.Builder(), "container/container.0"));
- assertEquals(qrConfig.rpc().enabled(), true);
- assertEquals(qrConfig.filedistributor().configid(), "filedistribution/" + hostname);
- }
-
-}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java
index d09211aea45..5e093bdb32a 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilderTest.java
@@ -16,6 +16,7 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
import com.yahoo.container.ComponentsConfig;
+import com.yahoo.container.QrConfig;
import com.yahoo.container.config.StatisticsRequestHandler;
import com.yahoo.container.core.ChainsConfig;
import com.yahoo.container.core.VipStatusConfig;
@@ -25,6 +26,7 @@ import com.yahoo.container.jdisc.JdiscBindingsConfig;
import com.yahoo.container.servlet.ServletConfigConfig;
import com.yahoo.container.usability.BindingsOverviewHandler;
import com.yahoo.jdisc.http.ServletPathsConfig;
+import com.yahoo.net.HostName;
import com.yahoo.prelude.cluster.QrMonitorConfig;
import com.yahoo.vespa.model.AbstractService;
import com.yahoo.vespa.model.VespaModel;
@@ -61,7 +63,6 @@ import static org.junit.Assert.fail;
/**
* @author gjoranv
- * @since 5.1.9
*/
public class ContainerModelBuilderTest extends ContainerModelBuilderTestBase {
@@ -571,6 +572,41 @@ public class ContainerModelBuilderTest extends ContainerModelBuilderTestBase {
assertEquals(ContainerModelBuilder.HOSTED_VESPA_STATUS_FILE, vipStatusConfig.statusfile());
}
+ @Test
+ public void qrconfig_is_produced() throws IOException, SAXException {
+ String servicesXml =
+ "<services>" +
+ "<admin version='3.0'>" +
+ " <nodes count='1'/>" +
+ "</admin>" +
+ "<jdisc id ='default' version='1.0'>" +
+ " <nodes>" +
+ " <node hostalias='node1' />" +
+ " </nodes>" +
+ "</jdisc>" +
+ "</services>";
+
+ ApplicationPackage applicationPackage = new MockApplicationPackage.Builder()
+ .withServices(servicesXml)
+ .build();
+ VespaModel model = new VespaModel(new NullConfigModelRegistry(), new DeployState.Builder()
+ .applicationPackage(applicationPackage)
+ .properties(new DeployProperties.Builder().build())
+ .build());
+
+ String hostname = HostName.getLocalhost(); // Using the same way of getting hostname as filedistribution model
+
+ QrConfig config = model.getConfig(QrConfig.class, "default/container.0");
+ assertEquals("default.container.0", config.discriminator());
+ assertEquals(19102, config.rpc().port());
+ assertEquals("vespa/service/default/container.0", config.rpc().slobrokId());
+ assertEquals(true, config.rpc().enabled());
+ assertEquals("", config.rpc().host());
+ assertEquals(false, config.restartOnDeploy());
+ assertEquals(false, config.coveragereports());
+ assertEquals("filedistribution/" + hostname, config.filedistributor().configid());
+ }
+
private Element generateContainerElementWithRenderer(String rendererId) {
return DomBuilderTest.parse(
"<jdisc id='default' version='1.0'>",