blob: 725f8256ba39963a0b1cd5acdc08e7797a6d8cc3 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Smoke test that VipStatus has the right basic logic.
*
* @author steinar
*/
public class VipStatusTestCase {
@Test
public final void testSmoke() {
Object cluster1 = new Object();
Object cluster2 = new Object();
Object cluster3 = new Object();
VipStatus v = new VipStatus();
// initial state
assertTrue(v.isInRotation());
// all clusters down
v.removeFromRotation(cluster1);
v.removeFromRotation(cluster2);
v.removeFromRotation(cluster3);
assertFalse(v.isInRotation());
// some clusters down
v.addToRotation(cluster2);
assertTrue(v.isInRotation());
// all clusters up
v.addToRotation(cluster1);
v.addToRotation(cluster3);
assertTrue(v.isInRotation());
// and down again
v.removeFromRotation(cluster1);
v.removeFromRotation(cluster2);
v.removeFromRotation(cluster3);
assertFalse(v.isInRotation());
}
}
|