Search in sources :

Example 1 with ConfigModel

use of com.yahoo.config.model.ConfigModel in project vespa by vespa-engine.

the class Content method createTlds.

public void createTlds(ConfigModelRepo modelRepo) {
    IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
    if (indexedCluster == null)
        return;
    SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
    for (ConfigModel model : modelRepo.asMap().values()) {
        if (!(model instanceof ContainerModel))
            continue;
        ContainerCluster containerCluster = ((ContainerModel) model).getCluster();
        // this is not a qrs cluster
        if (containerCluster.getSearch() == null)
            continue;
        log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName());
        indexedCluster.addTldsWithSameIdsAsContainers(tldParent, containerCluster);
    }
    indexedCluster.setupDispatchGroups();
}
Also used : IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) ConfigModel(com.yahoo.config.model.ConfigModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContainerModel(com.yahoo.vespa.model.container.ContainerModel)

Example 2 with ConfigModel

use of com.yahoo.config.model.ConfigModel in project vespa by vespa-engine.

the class SystemModelTestCase method testPlugins.

/**
 * This test is the same as the system test cloudconfig/plugins.
 * Be sure to update it as well if you change this.
 */
@Test
public void testPlugins() {
    VespaModel vespaModel = getVespaModelDoNotValidateXml(TESTDIR + "plugins");
    assertNotNull(vespaModel);
    ApplicationConfigProducerRoot root = vespaModel.getVespa();
    assertEquals(5, vespaModel.configModelRepo().asMap().size());
    assertTrue(vespaModel.configModelRepo().asMap().keySet().contains("simple"));
    assertTrue(vespaModel.configModelRepo().asMap().keySet().contains("api"));
    assertTrue(root.getConfigIds().contains("simple/simpleservice.0"));
    assertTrue(root.getConfigIds().contains("simple/simpleservice.1"));
    assertTrue(root.getConfigIds().contains("api/apiservice.0"));
    // Verify that configModelRegistry iterates in dependency order
    Iterator<ConfigModel> i = vespaModel.configModelRepo().iterator();
    ConfigModel plugin = i.next();
    assertEquals("admin", plugin.getId());
    plugin = i.next();
    assertEquals("simple", plugin.getId());
    plugin = i.next();
    assertEquals("simple2", plugin.getId());
    plugin = i.next();
    assertEquals("api", plugin.getId());
    plugin = i.next();
    assertEquals("routing", plugin.getId());
    assertEquals(vespaModel.getConfig(StandardConfig.class, "api/apiservice.0").astring(), "apiservice");
    assertEquals(vespaModel.getConfig(StandardConfig.class, "simple/simpleservice.0").astring(), "simpleservice");
    assertEquals(vespaModel.getConfig(StandardConfig.class, "simple/simpleservice.1").astring(), "simpleservice");
    assertEquals(vespaModel.getConfig(StandardConfig.class, "simple2/simpleservice.0").astring(), "simpleservice");
}
Also used : ApplicationConfigProducerRoot(com.yahoo.config.model.ApplicationConfigProducerRoot) SimpleConfigModel(com.yahoo.vespa.model.test.SimpleConfigModel) ConfigModel(com.yahoo.config.model.ConfigModel) ApiConfigModel(com.yahoo.vespa.model.test.ApiConfigModel) Test(org.junit.Test)

Example 3 with ConfigModel

use of com.yahoo.config.model.ConfigModel in project vespa by vespa-engine.

the class ApiConfigModel method prepare.

// Inherit doc from ConfigModel.
public void prepare(ConfigModelRepo configModelRepo) {
    int numSimpleServices = 0;
    ConfigModel simplePlugin = configModelRepo.get("simple");
    if ((simplePlugin != null) && (simplePlugin instanceof TestApi)) {
        TestApi testApi = (TestApi) simplePlugin;
        numSimpleServices = testApi.getNumSimpleServices();
    }
    for (Object apiService : apiServices) {
        ApiService as = (ApiService) apiService;
        as.setNumSimpleServices(numSimpleServices);
    }
}
Also used : ConfigModel(com.yahoo.config.model.ConfigModel)

Aggregations

ConfigModel (com.yahoo.config.model.ConfigModel)3 ApplicationConfigProducerRoot (com.yahoo.config.model.ApplicationConfigProducerRoot)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1 ContainerModel (com.yahoo.vespa.model.container.ContainerModel)1 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)1 ApiConfigModel (com.yahoo.vespa.model.test.ApiConfigModel)1 SimpleConfigModel (com.yahoo.vespa.model.test.SimpleConfigModel)1 Test (org.junit.Test)1