Search in sources :

Example 36 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class FileSenderTest method require_that_leaf_maps_are_modified.

@Test
public void require_that_leaf_maps_are_modified() {
    def.leafMapDef("fileMap").setTypeSpec(new ConfigDefinition.TypeSpec("fileMap", "file", null, null, null, null));
    def.leafMapDef("pathMap").setTypeSpec(new ConfigDefinition.TypeSpec("pathMap", "path", null, null, null, null));
    def.leafMapDef("stringMap").setTypeSpec(new ConfigDefinition.TypeSpec("stringMap", "string", null, null, null, null));
    builder.getMap("fileMap").put("foo", "foo.txt");
    builder.getMap("fileMap").put("bar", "bar.txt");
    builder.getMap("pathMap").put("path", "path.txt");
    builder.getMap("stringMap").put("bar", "bar.txt");
    service.pathToRef.put("foo.txt", new FileNode("foohash").value());
    service.pathToRef.put("bar.txt", new FileNode("barhash").value());
    service.pathToRef.put("path.txt", new FileNode("pathhash").value());
    FileSender.sendUserConfiguredFiles(producer, serviceList, new BaseDeployLogger());
    assertThat(builder.getMap("fileMap").get("foo").getValue(), is("foohash"));
    assertThat(builder.getMap("fileMap").get("bar").getValue(), is("barhash"));
    assertThat(builder.getMap("pathMap").get("path").getValue(), is("pathhash"));
    assertThat(builder.getMap("stringMap").get("bar").getValue(), is("bar.txt"));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) FileNode(com.yahoo.config.FileNode) Test(org.junit.Test)

Example 37 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class SessionActiveHandlerTest method createRemoteSession.

private RemoteSession createRemoteSession(long sessionId, Session.Status status, SessionZooKeeperClient zkClient, Clock clock) throws IOException {
    zkClient.writeStatus(status);
    ZooKeeperClient zkC = new ZooKeeperClient(configCurator, new BaseDeployLogger(), false, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)));
    zkC.write(Collections.singletonMap(modelFactory.getVersion(), new MockFileRegistry()));
    zkC.write(AllocatedHosts.withHosts(Collections.emptySet()));
    RemoteSession session = new RemoteSession(TenantName.from("default"), sessionId, componentRegistry, zkClient, clock);
    remoteSessionRepo.addSession(session);
    return session;
}
Also used : ZooKeeperClient(com.yahoo.vespa.config.server.deploy.ZooKeeperClient) SessionZooKeeperClient(com.yahoo.vespa.config.server.session.SessionZooKeeperClient) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) RemoteSession(com.yahoo.vespa.config.server.session.RemoteSession) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry)

Example 38 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class TenantRequestHandlerTest method feedApp.

private void feedApp(File appDir, long sessionId, ApplicationId appId) throws IOException {
    SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)), new TestConfigDefinitionRepo(), "", Optional.empty());
    zkc.writeApplicationId(appId);
    File app = tempFolder.newFolder();
    IOUtils.copyDirectory(appDir, app);
    ZooKeeperDeployer deployer = zkc.createDeployer(new BaseDeployLogger());
    deployer.deploy(FilesApplicationPackage.fromFile(appDir), Collections.singletonMap(vespaVersion, new MockFileRegistry()), AllocatedHosts.withHosts(Collections.emptySet()));
}
Also used : BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) ZooKeeperDeployer(com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer) TestConfigDefinitionRepo(com.yahoo.vespa.config.server.TestConfigDefinitionRepo) File(java.io.File) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) SessionZooKeeperClient(com.yahoo.vespa.config.server.session.SessionZooKeeperClient)

Example 39 with BaseDeployLogger

use of com.yahoo.config.model.application.provider.BaseDeployLogger in project vespa by vespa-engine.

the class ModelContextImplTest method testModelContextTest.

@Test
public void testModelContextTest() {
    final Rotation rotation = new Rotation("this.is.a.mock.rotation");
    final Set<Rotation> rotations = Collections.singleton(rotation);
    ModelContext context = new ModelContextImpl(MockApplicationPackage.createEmpty(), Optional.empty(), Optional.empty(), new BaseDeployLogger(), new StaticConfigDefinitionRepo(), new MockFileRegistry(), Optional.empty(), new ModelContextImpl.Properties(ApplicationId.defaultId(), true, Collections.emptyList(), null, false, Zone.defaultZone(), rotations), Optional.empty(), new Version(6), new Version(6));
    assertTrue(context.applicationPackage() instanceof MockApplicationPackage);
    assertFalse(context.hostProvisioner().isPresent());
    assertFalse(context.permanentApplicationPackage().isPresent());
    assertFalse(context.previousModel().isPresent());
    assertTrue(context.getFileRegistry() instanceof MockFileRegistry);
    assertTrue(context.configDefinitionRepo() instanceof StaticConfigDefinitionRepo);
    assertThat(context.properties().applicationId(), is(ApplicationId.defaultId()));
    assertTrue(context.properties().configServerSpecs().isEmpty());
    assertTrue(context.properties().multitenant());
    assertTrue(context.properties().zone() instanceof Zone);
    assertFalse(context.properties().hostedVespa());
    assertThat(context.properties().rotations(), equalTo(rotations));
}
Also used : ModelContext(com.yahoo.config.model.api.ModelContext) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) BaseDeployLogger(com.yahoo.config.model.application.provider.BaseDeployLogger) Version(com.yahoo.component.Version) Zone(com.yahoo.config.provision.Zone) ModelContextImpl(com.yahoo.vespa.config.server.deploy.ModelContextImpl) Rotation(com.yahoo.config.provision.Rotation) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) Test(org.junit.Test)

Aggregations

BaseDeployLogger (com.yahoo.config.model.application.provider.BaseDeployLogger)39 Test (org.junit.Test)30 Search (com.yahoo.searchdefinition.Search)12 QueryProfiles (com.yahoo.vespa.model.container.search.QueryProfiles)12 RankProfileRegistry (com.yahoo.searchdefinition.RankProfileRegistry)10 FileNode (com.yahoo.config.FileNode)8 SDDocumentType (com.yahoo.searchdefinition.document.SDDocumentType)7 QueryProfileRegistry (com.yahoo.search.query.profile.QueryProfileRegistry)6 SDField (com.yahoo.searchdefinition.document.SDField)6 UserConfigRepo (com.yahoo.config.model.producer.UserConfigRepo)4 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)4 MockFileRegistry (com.yahoo.config.model.application.provider.MockFileRegistry)3 File (java.io.File)3 Iterator (java.util.Iterator)3 Element (org.w3c.dom.Element)3 Version (com.yahoo.component.Version)2 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)2 DeployLogger (com.yahoo.config.application.api.DeployLogger)2 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 RankProfile (com.yahoo.searchdefinition.RankProfile)2