Search in sources :

Example 46 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class ComponentClassTestCase method testCreateComponent.

@SuppressWarnings("unchecked")
@Test
public void testCreateComponent() throws NoSuchMethodException {
    Map<ConfigKey, ConfigInstance> availableConfigs = new HashMap<>();
    String configId = "testConfigId";
    availableConfigs.put(new ConfigKey(StringConfig.class, configId), new StringConfig(new StringConfig.Builder()));
    availableConfigs.put(new ConfigKey(IntConfig.class, configId), new IntConfig(new IntConfig.Builder()));
    ComponentClass<TestComponent> testClass = new ComponentClass<>(TestComponent.class);
    TestComponent component = testClass.createComponent(new ComponentId("test", new Version(1)), availableConfigs, configId);
    assertEquals("test", component.getId().getName());
    assertEquals(1, component.getId().getVersion().getMajor());
    assertEquals(1, component.intVal);
    assertEquals("_default_", component.stringVal);
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) HashMap(java.util.HashMap) IntConfig(com.yahoo.config.core.IntConfig) StringConfig(com.yahoo.config.core.StringConfig) Version(com.yahoo.component.Version) ComponentId(com.yahoo.component.ComponentId) ComponentClass(com.yahoo.component.provider.ComponentClass) ConfigInstance(com.yahoo.config.ConfigInstance) Test(org.junit.Test)

Example 47 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class ComponentClassTestCase method testNullIdComponent.

/**
 * Verifies that ComponentClass sets the ComponentId when a component that takes a ComponentId as
 * constructor argument fails to call super(id).
 */
@Test
public void testNullIdComponent() throws NoSuchMethodException {
    ComponentClass<NullIdComponent> testClass = new ComponentClass<>(NullIdComponent.class);
    NullIdComponent component = testClass.createComponent(new ComponentId("null-test", new Version(1)), new HashMap<ConfigKey, ConfigInstance>(), null);
    assertEquals("null-test", component.getId().getName());
    assertEquals(1, component.getId().getVersion().getMajor());
}
Also used : ConfigKey(com.yahoo.vespa.config.ConfigKey) Version(com.yahoo.component.Version) ComponentId(com.yahoo.component.ComponentId) ComponentClass(com.yahoo.component.provider.ComponentClass) ConfigInstance(com.yahoo.config.ConfigInstance) Test(org.junit.Test)

Example 48 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class VespaModelCreatorWithFilePkg method validate.

public void validate() throws IOException {
    ApplicationPackageXmlFilesValidator validator = ApplicationPackageXmlFilesValidator.create(applicationPkg.getAppDir(), new Version(6));
    validator.checkApplication();
    validator.checkIncludedDirs(applicationPkg);
}
Also used : Version(com.yahoo.component.Version)

Example 49 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class PrepareParamsTest method testCorrectParsingWithRotation.

@Test
public void testCorrectParsingWithRotation() {
    PrepareParams prepareParams = createParams(request + "&" + PrepareParams.ROTATIONS_PARAM_NAME + "=" + rotation, TenantName.from("foo"));
    assertThat(prepareParams.getApplicationId().serializedForm(), is("foo:baz:default"));
    assertTrue(prepareParams.isDryRun());
    assertTrue(prepareParams.isVerbose());
    assertFalse(prepareParams.ignoreValidationErrors());
    Version expectedVersion = Version.fromString(vespaVersion);
    assertThat(prepareParams.vespaVersion().get(), is(expectedVersion));
    assertTrue(prepareParams.getTimeoutBudget().hasTimeLeft());
    Set<Rotation> rotations = prepareParams.rotations();
    assertThat(rotations.size(), is(1));
    assertThat(rotations, contains(equalTo(new Rotation(rotation))));
}
Also used : Version(com.yahoo.component.Version) Rotation(com.yahoo.config.provision.Rotation) Test(org.junit.Test)

Example 50 with Version

use of com.yahoo.component.Version 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

Version (com.yahoo.component.Version)83 Test (org.junit.Test)46 Application (com.yahoo.vespa.hosted.controller.Application)32 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)30 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)25 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)25 DeploymentTester (com.yahoo.vespa.hosted.controller.deployment.DeploymentTester)24 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)22 ApplicationPackageBuilder (com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder)17 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)15 ApplicationId (com.yahoo.config.provision.ApplicationId)11 Collections (java.util.Collections)11 List (java.util.List)11 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)10 Optional (java.util.Optional)10 Slime (com.yahoo.slime.Slime)9 Map (java.util.Map)9 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)7 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)7 URI (java.net.URI)7