Add convenience method to create AssignedRotations
@@ -4,8 +4,10 @@ import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.RegionName;
import com.yahoo.vespa.hosted.controller.rotation.RotationId;
+import java.util.Collection;
import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
/**
* Contains the tuple of [clusterId, endpointId, rotationId, regions[]], to keep track
@@ -65,4 +67,14 @@ public class AssignedRotation {
}
return object;
}
+
+ /** Convenience method intended for tests */
+ public static AssignedRotation fromStrings(String clusterId, String endpointId, String rotationId, Collection<String> regions) {
+ return new AssignedRotation(
+ new ClusterSpec.Id(clusterId),
+ new EndpointId(endpointId),
+ new RotationId(rotationId),
+ regions.stream().map(RegionName::from).collect(Collectors.toSet())
+ );
+ }
}
