blob: c229ab7a1d4f0fd556c0c4859cd9271bce1ef06d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.routing.mock;
import com.yahoo.vespa.hosted.routing.status.RoutingStatus;
import java.util.HashSet;
import java.util.Set;
/**
* @author mortent
*/
public class RoutingStatusMock implements RoutingStatus {
private final Set<String> outOfRotation = new HashSet<>();
@Override
public boolean isActive(String upstreamName) {
return !outOfRotation.contains(upstreamName);
}
public RoutingStatusMock setStatus(String upstreamName, boolean active) {
if (active) {
outOfRotation.remove(upstreamName);
} else {
outOfRotation.add(upstreamName);
}
return this;
}
}
|