use of com.yahoo.vespa.hosted.controller.versions.DeploymentStatistics in project vespa by vespa-engine.
the class VersionStatusSerializerTest method testSerialization.
@Test
public void testSerialization() {
List<VespaVersion> vespaVersions = new ArrayList<>();
DeploymentStatistics statistics = new DeploymentStatistics(Version.fromString("5.0"), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default")), Arrays.asList(ApplicationId.from("tenant2", "success1", "default"), ApplicationId.from("tenant2", "success2", "default")), Arrays.asList(ApplicationId.from("tenant1", "failing1", "default"), ApplicationId.from("tenant2", "success2", "default")));
vespaVersions.add(new VespaVersion(statistics, "dead", Instant.now(), false, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
vespaVersions.add(new VespaVersion(statistics, "cafe", Instant.now(), true, Arrays.asList("cfg1", "cfg2", "cfg3"), VespaVersion.Confidence.normal));
VersionStatus status = new VersionStatus(vespaVersions);
VersionStatusSerializer serializer = new VersionStatusSerializer();
VersionStatus deserialized = serializer.fromSlime(serializer.toSlime(status));
assertEquals(status.versions().size(), deserialized.versions().size());
for (int i = 0; i < status.versions().size(); i++) {
VespaVersion a = status.versions().get(i);
VespaVersion b = deserialized.versions().get(i);
assertEquals(a.releaseCommit(), b.releaseCommit());
assertEquals(a.committedAt(), b.committedAt());
assertEquals(a.isCurrentSystemVersion(), b.isCurrentSystemVersion());
assertEquals(a.statistics(), b.statistics());
assertEquals(a.configServerHostnames(), b.configServerHostnames());
assertEquals(a.confidence(), b.confidence());
}
}
Aggregations