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;
}
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;
}
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()));
}
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);
}
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)));
}
Aggregations