MCPcopy Create free account
hub / github.com/akeranen/the-one / testThreshold

Method testThreshold

test/MaxPropRouterTest.java:103–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101 }
102
103 public void testThreshold() {
104 int msgSize = 90;
105
106 Message m1 = new Message(h1,h5, msgId1, msgSize);
107 h1.createNewMessage(m1);
108 checkCreates(1);
109 h1.connect(h2);
110
111 /* thresholds should be zero before any transfers */
112 assertEquals(0, r1.calcThreshold());
113 assertEquals(0, r2.calcThreshold());
114
115 /* simple delivery of msgId1 from h1 to h2 */
116 updateAllNodes();
117 checkTransferStart(h1, h2, msgId1);
118 assertFalse(mc.next());
119 clock.advance(5);
120 updateAllNodes();
121 assertFalse(mc.next()); // transfer should not be ready yet
122 clock.advance(5); // now it should be done
123 updateAllNodes();
124 checkDelivered(h1, h2, msgId1, false);
125
126 disconnect(h1);
127 assertEquals(1, r1.calcThreshold());
128 assertEquals(2, r2.calcThreshold());
129
130 h2.connect(h3);
131 deliverMessage(h2, h3, msgId1, msgSize, false);
132 disconnect(h2);
133 assertEquals(2, r2.calcThreshold());
134 /* msg at h3 has traveled 2 hops and "bsize > avgTransferredBytes > 0"
135 * so threshold should be only msg's hopcount+1 */
136 assertEquals(3, r3.calcThreshold());
137 }
138
139 public void testAckedMessageDeleting() {
140 int msgSize = 10;

Callers

nothing calls this directly

Calls 11

checkCreatesMethod · 0.80
updateAllNodesMethod · 0.80
checkTransferStartMethod · 0.80
nextMethod · 0.80
advanceMethod · 0.80
checkDeliveredMethod · 0.80
deliverMessageMethod · 0.80
createNewMessageMethod · 0.45
connectMethod · 0.45
calcThresholdMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected