Search in sources :

Example 1 with ModelConfig

use of com.yahoo.cloud.config.ModelConfig in project vespa by vespa-engine.

the class ModelConfigProviderTest method testGetModelConfig.

/**
 * Get the config via ConfigInstance based API, by getting whole config
 */
@Test
public void testGetModelConfig() {
    VespaModel vespaModel = new VespaModelCreatorWithFilePkg("src/test/cfg/admin/adminconfig20").create();
    ModelConfig config = vespaModel.getConfig(ModelConfig.class, "");
    assertEquals(config.hosts().size(), 1);
    // Actually set to hostname.
    ModelConfig.Hosts localhost = config.hosts(0);
    int numLogservers = 0;
    int numSlobroks = 0;
    for (ModelConfig.Hosts.Services service : localhost.services()) {
        if ("logserver".equals(service.type())) {
            numLogservers++;
        }
        if ("slobrok".equals(service.type())) {
            numSlobroks++;
        }
    }
    assertEquals(1, numLogservers);
    assertEquals(2, numSlobroks);
}
Also used : VespaModelCreatorWithFilePkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg) ModelConfig(com.yahoo.cloud.config.ModelConfig) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Aggregations

ModelConfig (com.yahoo.cloud.config.ModelConfig)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 VespaModelCreatorWithFilePkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithFilePkg)1 Test (org.junit.Test)1