m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/pl/edu/mimuw/cloudatlas
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 12:17:47 +0100
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2020-01-11 12:17:47 +0100
commit9828dbbba3a0398f7bd8a713137cb8747dac60cd (patch)
tree3eb1f2bd52214b4492886d04acc34dd90830c5e5 /src/test/java/pl/edu/mimuw/cloudatlas
parent63ed859398a815e310129de1af1f8821b690b700 (diff)
parentea35ef1c86401257d82daf978d5870285f7c163e (diff)
Merge branch 'master' into gossip-girl-2
Diffstat (limited to 'src/test/java/pl/edu/mimuw/cloudatlas')
-rw-r--r--src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java
new file mode 100644
index 0000000..681483d
--- /dev/null
+++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java
@@ -0,0 +1,31 @@
+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);
+ }
+ }
+}