Search in sources :

Example 6 with ModelFactoryRegistry

use of com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry in project vespa by vespa-engine.

the class DeployTester method createComponentRegistry.

private TestComponentRegistry createComponentRegistry(Curator curator, Metrics metrics, List<ModelFactory> modelFactories, ConfigserverConfig configserverConfig, Clock clock) {
    TestComponentRegistry.Builder builder = new TestComponentRegistry.Builder();
    if (configserverConfig.hostedVespa()) {
        builder.provisioner(createHostProvisioner());
    }
    builder.configServerConfig(configserverConfig).curator(curator).modelFactoryRegistry(new ModelFactoryRegistry(modelFactories)).metrics(metrics).clock(clock);
    return builder.build();
}
Also used : TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)

Example 7 with ModelFactoryRegistry

use of com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry in project vespa by vespa-engine.

the class ModelFactoryRegistryTest method testThatAllFactoriesAreReturned.

@Test
public void testThatAllFactoriesAreReturned() {
    TestFactory a = new TestFactory(Version.fromIntValues(5, 38, 4));
    TestFactory b = new TestFactory(Version.fromIntValues(5, 58, 1));
    TestFactory c = new TestFactory(Version.fromIntValues(5, 48, 44));
    TestFactory d = new TestFactory(Version.fromIntValues(5, 18, 44));
    ModelFactoryRegistry registry = new ModelFactoryRegistry(Arrays.asList(a, b, c, d));
    assertThat(registry.getFactories().size(), is(4));
    assertTrue(registry.getFactories().contains(a));
    assertTrue(registry.getFactories().contains(b));
    assertTrue(registry.getFactories().contains(c));
    assertTrue(registry.getFactories().contains(d));
}
Also used : ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) Test(org.junit.Test)

Example 8 with ModelFactoryRegistry

use of com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry in project vespa by vespa-engine.

the class ModelFactoryRegistryTest method testThatUnknownVersionGivesError.

@Test(expected = UnknownVespaVersionException.class)
public void testThatUnknownVersionGivesError() {
    ModelFactoryRegistry registry = new ModelFactoryRegistry(Arrays.asList(new TestFactory(Version.fromIntValues(1, 2, 3))));
    registry.getFactory(Version.fromIntValues(3, 2, 1));
}
Also used : ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) Test(org.junit.Test)

Example 9 with ModelFactoryRegistry

use of com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry in project vespa by vespa-engine.

the class SessionActiveHandlerTest method setup.

@Before
public void setup() throws Exception {
    remoteSessionRepo = new RemoteSessionRepo(tenant);
    applicationRepo = new MemoryTenantApplications();
    curator = new MockCurator();
    configCurator = ConfigCurator.create(curator);
    localRepo = new LocalSessionRepo(Clock.systemUTC());
    pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
    hostProvisioner = new MockProvisioner();
    modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    componentRegistry = new TestComponentRegistry.Builder().curator(curator).configCurator(configCurator).modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(modelFactory))).build();
}
Also used : VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) RemoteSessionRepo(com.yahoo.vespa.config.server.session.RemoteSessionRepo) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 10 with ModelFactoryRegistry

use of com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry in project vespa by vespa-engine.

the class RemoteSessionTest method createSession.

private RemoteSession createSession(long sessionId, SessionZooKeeperClient zkc, List<ModelFactory> modelFactories, Optional<PermanentApplicationPackage> permanentApplicationPackage, Clock clock) {
    zkc.writeStatus(Session.Status.NEW);
    zkc.writeApplicationId(new ApplicationId.Builder().applicationName("foo").instanceName("bim").build());
    TestComponentRegistry.Builder registryBuilder = new TestComponentRegistry.Builder().curator(curator).modelFactoryRegistry(new ModelFactoryRegistry(modelFactories));
    if (permanentApplicationPackage.isPresent())
        registryBuilder.permanentApplicationPackage(permanentApplicationPackage.get());
    return new RemoteSession(tenantName, sessionId, registryBuilder.build(), zkc, clock);
}
Also used : TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)

Aggregations

ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)13 Test (org.junit.Test)7 TestComponentRegistry (com.yahoo.vespa.config.server.TestComponentRegistry)5 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)4 VespaModelFactory (com.yahoo.vespa.model.VespaModelFactory)4 TestModelFactory (com.yahoo.vespa.config.server.model.TestModelFactory)3 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)3 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)2 FilesApplicationPackage (com.yahoo.config.model.application.provider.FilesApplicationPackage)2 Version (com.yahoo.config.provision.Version)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 RemoteSession (com.yahoo.vespa.config.server.session.RemoteSession)2 File (java.io.File)2 Before (org.junit.Before)2 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)1 ModelContext (com.yahoo.config.model.api.ModelContext)1 ModelFactory (com.yahoo.config.model.api.ModelFactory)1 ServiceInfo (com.yahoo.config.model.api.ServiceInfo)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 Rotation (com.yahoo.config.provision.Rotation)1