Skip to content

Commit f96c8c5

Browse files
committed
repaired some obvious error in tests
1 parent 26dc80f commit f96c8c5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/net/sharksystem/asap/protocol/ASAP_1_0.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Descriptions of ASAP protocol data units and some constants
1414
*/
1515
public interface ASAP_1_0 {
16-
int CMD_MASK = 0x6; // 0110
16+
int CMD_MASK = 0x7; // 0111
1717
byte OFFER_CMD = 0;
1818
byte INTEREST_CMD = 2;
1919
byte ASSIMILATE_CMD = 4;

test/net/sharksystem/asap/MultihopTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public void twoHops() throws IOException, ASAPException, InterruptedException {
2020

2121
ui.doResetASAPStorages();
2222

23+
ui.doCreateASAPPeer("Alice");
24+
ui.doCreateASAPPeer("Bob");
25+
ui.doCreateASAPPeer("Clara");
26+
2327
// create storages
2428
ui.doCreateASAPApp("Alice twoHops");
2529
ui.doCreateASAPApp("Bob twoHops");
@@ -42,11 +46,9 @@ public void twoHops() throws IOException, ASAPException, InterruptedException {
4246
System.out.println("** connect Alice with Bob **");
4347
System.out.println("**************************************************************************");
4448
// connect alice with bob
45-
ui.doCreateASAPPeer("Alice");
4649
ui.doOpen("7070 Alice");
4750
// wait a moment to give server socket time to be created
4851
Thread.sleep(10);
49-
ui.doCreateASAPPeer("Bob");
5052

5153
ui.doConnect("7070 Bob");
5254

@@ -66,7 +68,6 @@ public void twoHops() throws IOException, ASAPException, InterruptedException {
6668
System.out.println("**************************************************************************");
6769
System.out.println("** connect Bob with Clara **");
6870
System.out.println("**************************************************************************");
69-
ui.doCreateASAPPeer("Clara");
7071
ui.doOpen("8080 Clara");
7172
// wait a moment to give server socket time to be created
7273
Thread.sleep(10);
@@ -135,6 +136,11 @@ public void closedChannelTest() throws IOException, ASAPException, InterruptedEx
135136
CmdLineUI ui = new CmdLineUI(System.out);
136137
ui.doResetASAPStorages();
137138

139+
ui.doCreateASAPPeer("Alice");
140+
ui.doCreateASAPPeer("Bob");
141+
ui.doCreateASAPPeer("Clara");
142+
ui.doCreateASAPPeer("David");
143+
138144
// create app on each peer
139145
ui.doCreateASAPApp("Alice chat");
140146
ui.doCreateASAPApp("Bob chat");
@@ -164,11 +170,9 @@ public void closedChannelTest() throws IOException, ASAPException, InterruptedEx
164170
System.out.println("** connect Alice with Bob **");
165171
System.out.println("**************************************************************************");
166172
// connect alice with bob
167-
ui.doCreateASAPPeer("Alice");
168173
ui.doOpen("7070 Alice");
169174
// wait a moment to give server socket time to be created
170175
Thread.sleep(10);
171-
ui.doCreateASAPPeer("Bob");
172176
ui.doConnect("7070 Bob");
173177

174178
// alice should be in era 1 (content has changed before connection) and bob era is 0 - no changes
@@ -214,11 +218,9 @@ public void closedChannelTest() throws IOException, ASAPException, InterruptedEx
214218
System.out.println("** connect Bob with Clara **");
215219
System.out.println("**************************************************************************");
216220
// connect alice with bob
217-
ui.doCreateASAPPeer("Bob");
218221
ui.doOpen("7071 Bob");
219222
// wait a moment to give server socket time to be created
220223
Thread.sleep(10);
221-
ui.doCreateASAPPeer("Clara");
222224
ui.doConnect("7071 Clara");
223225

224226
// alice should be in era 1 (content has changed before connection) and bob era is 0 - no changes
@@ -264,11 +266,9 @@ public void closedChannelTest() throws IOException, ASAPException, InterruptedEx
264266
System.out.println("** connect Clara with David **");
265267
System.out.println("**************************************************************************");
266268
// connect alice with bob
267-
ui.doCreateASAPPeer("Clara");
268269
ui.doOpen("7072 Clara");
269270
// wait a moment to give server socket time to be created
270271
Thread.sleep(10);
271-
ui.doCreateASAPPeer("David");
272272
ui.doConnect("7072 David");
273273

274274
// wait a moment

0 commit comments

Comments
 (0)