Search in sources :

Example 36 with Version

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

the class MessagesTestBase method deserialize.

/**
 * Reads the content of the given file and creates a corresponding routable.
 *
 * @param filename The name of the file to read from.
 * @param classId  The type that the routable must decode as.
 * @param lang     The language constant that dictates what file format to read from.
 * @return The decoded routable.
 */
public Routable deserialize(String filename, int classId, Language lang) {
    Version version = version();
    String path = getPath(version + "-" + (lang == Language.JAVA ? "java" : "cpp") + "-" + filename + ".dat");
    System.out.println("Deserializing from '" + path + "'..");
    byte[] data;
    try {
        data = TestFileUtil.readFile(path);
    } catch (IOException e) {
        throw new AssertionError(e);
    }
    Routable ret = protocol.decode(version, data);
    assertNotNull(ret);
    assertEquals(classId, ret.getType());
    return ret;
}
Also used : Version(com.yahoo.component.Version) IOException(java.io.IOException) Routable(com.yahoo.messagebus.Routable)

Example 37 with Version

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

the class MessagesTestBase method serialize.

/**
 * Writes the content of the given routable to the given file.
 *
 * @param filename The name of the file to write to.
 * @param routable The routable to serialize.
 * @return The size of the written file.
 */
public int serialize(String filename, Routable routable) {
    Version version = version();
    String path = getPath(version + "-java-" + filename + ".dat");
    System.out.println("Serializing to '" + path + "'..");
    byte[] data = protocol.encode(version, routable);
    assertNotNull(data);
    assertTrue(data.length > 0);
    try {
        TestFileUtil.writeToFile(path, data);
    } catch (IOException e) {
        throw new AssertionError(e);
    }
    assertEquals(routable.getType(), protocol.decode(version, data).getType());
    return data.length;
}
Also used : Version(com.yahoo.component.Version) IOException(java.io.IOException)

Example 38 with Version

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

the class SearchChainTestCase method testSearchChainCreation.

@Test
public void testSearchChainCreation() {
    assertEquals("test", searchChain.getId().stringValue());
    assertEquals("test", searchChain.getId().getName());
    assertEquals(Version.emptyVersion, searchChain.getId().getVersion());
    assertEquals(new Version(), searchChain.getId().getVersion());
    assertEqualMembers(Arrays.asList("one", "two"), searcherNames(searchChain.searchers()));
}
Also used : Version(com.yahoo.component.Version) Test(org.junit.Test)

Example 39 with Version

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

the class DeployOptionsTest method it_serializes_version.

@Test
public void it_serializes_version() throws IOException {
    DeployOptions options = new DeployOptions(Optional.empty(), Optional.of(new Version("6.98.227")), false, false);
    final ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).registerModule(new Jdk8Module());
    String string = objectMapper.writeValueAsString(options);
    assertEquals("{\"screwdriverBuildJob\":null,\"vespaVersion\":\"6.98.227\",\"ignoreValidationErrors\":false,\"deployCurrentVersion\":false}", string);
}
Also used : DeployOptions(com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions) Jdk8Module(com.fasterxml.jackson.datatype.jdk8.Jdk8Module) Version(com.yahoo.component.Version) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 40 with Version

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

the class Controller method updateVersionStatus.

/**
 * Replace the current version status by a new one
 */
public void updateVersionStatus(VersionStatus newStatus) {
    VersionStatus currentStatus = versionStatus();
    if (newStatus.systemVersion().isPresent() && !newStatus.systemVersion().equals(currentStatus.systemVersion())) {
        log.info("Changing system version from " + printableVersion(currentStatus.systemVersion()) + " to " + printableVersion(newStatus.systemVersion()));
    }
    curator.writeVersionStatus(newStatus);
    // Removes confidence overrides for versions that no longer exist in the system
    removeConfidenceOverride(version -> newStatus.versions().stream().noneMatch(vespaVersion -> vespaVersion.versionNumber().equals(version)));
}
Also used : AthenzClientFactory(com.yahoo.vespa.hosted.controller.api.integration.athenz.AthenzClientFactory) ArtifactRepository(com.yahoo.vespa.hosted.controller.api.integration.deployment.ArtifactRepository) NodeRepositoryClientInterface(com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepositoryClientInterface) Organization(com.yahoo.vespa.hosted.controller.api.integration.organization.Organization) Version(com.yahoo.component.Version) EntityService(com.yahoo.vespa.hosted.controller.api.integration.entity.EntityService) PropertyId(com.yahoo.vespa.hosted.controller.api.identifiers.PropertyId) Inject(com.google.inject.Inject) DeploymentId(com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId) Vtag(com.yahoo.component.Vtag) ConfigServerClient(com.yahoo.vespa.hosted.controller.api.integration.configserver.ConfigServerClient) GitHub(com.yahoo.vespa.hosted.controller.api.integration.github.GitHub) Chef(com.yahoo.vespa.hosted.controller.api.integration.chef.Chef) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) JsonNode(com.fasterxml.jackson.databind.JsonNode) RoutingGenerator(com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator) MetricsService(com.yahoo.vespa.hosted.controller.api.integration.MetricsService) AthenzDomain(com.yahoo.vespa.athenz.api.AthenzDomain) ControllerDb(com.yahoo.vespa.hosted.controller.persistence.ControllerDb) Predicate(java.util.function.Predicate) CuratorDb(com.yahoo.vespa.hosted.controller.persistence.CuratorDb) ZoneRegistry(com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry) Logger(java.util.logging.Logger) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) Property(com.yahoo.vespa.hosted.controller.api.identifiers.Property) ApplicationView(com.yahoo.vespa.serviceview.bindings.ApplicationView) Objects(java.util.Objects) List(java.util.List) RotationStatus(com.yahoo.vespa.hosted.controller.api.integration.routing.RotationStatus) AbstractComponent(com.yahoo.component.AbstractComponent) SystemName(com.yahoo.config.provision.SystemName) Clock(java.time.Clock) Optional(java.util.Optional) NameService(com.yahoo.vespa.hosted.controller.api.integration.dns.NameService) RotationsConfig(com.yahoo.vespa.hosted.rotation.config.RotationsConfig) GlobalRoutingService(com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus) VersionStatus(com.yahoo.vespa.hosted.controller.versions.VersionStatus)

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