blob: 8fba76e1bc83e990d472c6e4e8d1b20f5b6c672f (
plain)
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
|
package pl.edu.mimuw.cloudatlas.agent.modules;
import org.junit.Test;
import pl.edu.mimuw.cloudatlas.agent.modules.GossipGirlStrategies;
import pl.edu.mimuw.cloudatlas.model.PathName;
import java.util.HashMap;
public class GossipGirlStrategyTest {
@Test
public void seeHowTheyWork() {
PathName fullPath = new PathName("/pl/mazowieckie/warszawa/ochota/mimuw");
GossipGirlStrategies gossipGirlStrategies = new GossipGirlStrategies(fullPath);
int loopCount = 1000;
PathName selectedPath;
HashMap<PathName, Integer> freqs = new HashMap<>();
freqs.put(new PathName("/pl/mazowieckie/warszawa/ochota/mimuw"), 0);
freqs.put(new PathName("/pl/mazowieckie/warszawa/ochota"), 0);
freqs.put(new PathName("/pl/mazowieckie/warszawa"), 0);
freqs.put(new PathName("/pl/mazowieckie"), 0);
freqs.put(new PathName("/pl"), 0);
for (int i = 0; i < loopCount; i++) {
selectedPath =
gossipGirlStrategies.selectStrategy(GossipGirlStrategies.ZoneSelectionStrategy.ROUND_ROBIN_EXP_FREQ);
freqs.put(selectedPath, freqs.get(selectedPath) + 1);
System.out.println(selectedPath);
System.out.println(freqs);
}
}
}
|