summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-06-01 13:47:25 +0200
committergjoranv <gv@verizonmedia.com>2022-06-08 11:45:24 +0200
commit778db579931c6f2e08e40d7cb37c1090422f7164 (patch)
treed182e3bfb8e0d634a63fbe8ad904605de5edd40b /config-model/src/test/java
parentdaa980fcd31971bc9418fe8717f835e53d501969 (diff)
Remove on Vespa 8
Diffstat (limited to 'config-model/src/test/java')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesModelTest.java61
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java71
2 files changed, 0 insertions, 132 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesModelTest.java b/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesModelTest.java
deleted file mode 100644
index 7b7fc83131e..00000000000
--- a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesModelTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.generic;
-
-import com.yahoo.config.model.ConfigModelContext;
-import com.yahoo.config.model.builder.xml.ConfigModelId;
-import com.yahoo.config.model.test.MockApplicationPackage;
-import com.yahoo.config.model.test.MockRoot;
-import com.yahoo.vespa.model.VespaModel;
-import com.yahoo.vespa.model.generic.service.ServiceCluster;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * @author Ulf Lilleengen
- * @since 5.1
- */
-public class GenericServicesModelTest {
-
- @Test
- public void test_generic_services_builder() {
- GenericServicesBuilder builder = new GenericServicesBuilder();
- assertThat(builder.handlesElements().size(), is(1));
- assertThat(builder.handlesElements().get(0), is(ConfigModelId.fromName("service")));
- }
-
- @Test
- public void test_generic_services_model() {
- MockRoot root = new MockRoot();
- GenericServicesModel model = new GenericServicesModel(ConfigModelContext.create(root.getDeployState(), null, null, root, "foo"));
- assertThat(model.serviceClusters().size(), is(0));
- model.addCluster(new ServiceCluster(root, "mycluster", "/bin/foo"));
- assertThat(model.serviceClusters().size(), is(1));
- assertThat(model.serviceClusters().get(0).getName(), is("mycluster"));
- }
-
- @Test
- public void test_generic_services_parsing() throws IOException, SAXException {
- final String hosts =
- "<hosts>" +
- "<host name=\"localhost\">" +
- " <alias>mockhost</alias>" +
- " </host> " +
- "</hosts>";
- String services = "<services version=\"1.0\">"
- + "<service id=\"me\" name=\"foo\" command=\"/bin/bar\" version=\"1.0\">"
- + "<node hostalias=\"mockhost\" />"
- + "</service>"
- + "</services>";
- VespaModel model = new VespaModel(new MockApplicationPackage.Builder().withHosts(hosts).withServices(services).build());
- GenericServicesModel gsModel = (GenericServicesModel) model.configModelRepo().get("me");
- assertThat(gsModel.serviceClusters().size(), is(1));
- assertThat(gsModel.serviceClusters().get(0).getName(), is("foo"));
- assertThat(gsModel.serviceClusters().get(0).services().size(), is(1));
- }
-
-}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java
deleted file mode 100644
index 7429c2cc113..00000000000
--- a/config-model/src/test/java/com/yahoo/vespa/model/generic/GenericServicesTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.generic;
-
-import com.yahoo.cloud.config.SentinelConfig;
-import com.yahoo.config.application.api.ApplicationPackage;
-import com.yahoo.config.model.application.provider.FilesApplicationPackage;
-import com.yahoo.vespa.model.VespaModel;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Iterator;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests that generic services result in correct sentinel config settings
- *
- * @author vegardh
- */
-public class GenericServicesTest {
-
- private static VespaModel model;
-
- @BeforeClass
- public static void getModel() throws IOException, SAXException {
- String appDir = "src/test/cfg/application/app_genericservices";
- ApplicationPackage app = FilesApplicationPackage.fromFile(new File(appDir));
- model = new VespaModel(app);
- }
-
- @Test
- public void testServicesSentinelConfig() {
- String sentinelConfigId1="hosts/bogusname1/sentinel";
- String sentinelConfigId2="hosts/bogusname2/sentinel";
- String sentinelConfigId3="hosts/bogusname3/sentinel";
- String sentinelConfigId4="hosts/bogusname4/sentinel";
- SentinelConfig sentinel1 = model.getConfig(SentinelConfig.class, sentinelConfigId1);
- SentinelConfig sentinel2 = model.getConfig(SentinelConfig.class, sentinelConfigId2);
- SentinelConfig sentinel3 = model.getConfig(SentinelConfig.class, sentinelConfigId3);
- SentinelConfig sentinel4 = model.getConfig(SentinelConfig.class, sentinelConfigId4);
-
- assertServiceExists(sentinel1, "myservice", "mycmd1.sh", "myservice/0");
- assertServiceExists(sentinel2, "myservice", "mycmd1.sh", "myservice/1");
- assertServiceExists(sentinel3, "myservice", "mycmd1.sh", "myservice/2");
- assertServiceExists(sentinel3, "myservice2", "mycmd1.sh", "myservice/3");
- assertServiceExists(sentinel3, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/0");
- assertServiceExists(sentinel4, "myotherservice", "/home/vespa/bin/mycmd2.sh --ytest $FOO_BAR", "myotherservice/1");
- }
-
- private void assertServiceExists(SentinelConfig sentinel, String serviceName, String cmd, String configId) {
- boolean matches = false;
- Iterator<SentinelConfig.Service> it = sentinel.service().iterator();
- while (!matches && it.hasNext()) {
- SentinelConfig.Service service = it.next();
- matches =
- service.name().equals(serviceName) &&
- service.id().equals(configId) &&
- service.command().equals(cmd);
- }
- assertTrue(matches);
- }
-
- @Test
- public void testServicesModel() {
- // Testing that this model can be constructed only for now
- }
-
-}