1- package bugreports ;
1+ package junit5Tests . release_1 ;
22
33import net .sharksystem .TestConstants ;
44import net .sharksystem .TestHelper ;
1616import java .util .ArrayList ;
1717import java .util .Collection ;
1818
19- public class BugReportASAPPeerFS {
20- private static final String TEST_FOLDER = "SemanticTests " ;
19+ public class MultipleEncounterTests {
20+ private static final String TEST_FOLDER = "MultipleEncounterTests " ;
2121 public static final String ANIMAL = "animal" ;
2222 public static final String WATER = "water" ;
2323 public static final String ICE_CREAM = "ice_cream" ;
@@ -43,7 +43,7 @@ public class BugReportASAPPeerFS {
4343 private static int port = 0 ;
4444
4545 /* clear folder before launching tests */
46- public BugReportASAPPeerFS () {
46+ public MultipleEncounterTests () {
4747 ASAPEngineFS .removeFolder (TEST_FOLDER );
4848 }
4949
@@ -155,10 +155,10 @@ public void multiEncounter_sameURIs() throws InterruptedException, IOException,
155155 @ Test
156156 public void multiEncounter_partiallyDifferentURIs () throws InterruptedException , IOException , ASAPException {
157157 // sending different uris back and forth now breaks it
158- simpleEncounterWithMessageExchange (TIGER_URI , ICE_CREAM );
159- simpleEncounterWithMessageExchange (ICE_CREAM , ELEPHANT_URI );
160- simpleEncounterWithMessageExchange (HELLO_URI , ICE_CREAM );
161- simpleEncounterWithMessageExchange (ICE_CREAM , HELLO_URI );
158+ simpleEncounterWithMessageExchange (TIGER_URI , ICE_CREAM , 1 );
159+ simpleEncounterWithMessageExchange (ICE_CREAM , ELEPHANT_URI , 2 );
160+ simpleEncounterWithMessageExchange (HELLO_URI , ICE_CREAM , 3 );
161+ simpleEncounterWithMessageExchange (ICE_CREAM , HELLO_URI , 4 );
162162
163163 int era = 0 ;
164164 // encounter #1: Alice (TIGER_URI) < - > Bob (ICE_CREAM)
@@ -216,7 +216,7 @@ public void multiEncounter_completelyDifferentURIs() throws InterruptedException
216216
217217 // run encounter
218218 for (int i = 0 ; i < numberEncounter ; i ++) {
219- simpleEncounterWithMessageExchange (exchangedUris [i ][0 ], exchangedUris [i ][1 ]);
219+ simpleEncounterWithMessageExchange (exchangedUris [i ][0 ], exchangedUris [i ][1 ], i );
220220 }
221221
222222 // test
@@ -247,13 +247,19 @@ public void multiEncounter_completelyDifferentURIs() throws InterruptedException
247247 */
248248 }
249249
250+ public void simpleEncounterWithMessageExchange (String uriAlice , String uriBob )
251+ throws IOException , ASAPException , InterruptedException {
252+ this .simpleEncounterWithMessageExchange (uriAlice , uriBob , 0 );
253+ }
254+
255+
250256 // sends messages with given uri, starts and then stops the encounter
251257 // message content is irrelevant, we don't test for it
252- public void simpleEncounterWithMessageExchange (String uriAlice , String uriBob )
258+ public void simpleEncounterWithMessageExchange (String uriAlice , String uriBob , int encounterNumber )
253259 throws IOException , ASAPException , InterruptedException {
254260
255261 // simulate ASAP first encounter with full ASAP protocol stack and engines
256- System .out .println ("+++++++++++++++++++ 1st encounter starts soon ++++++++++++++++++++" );
262+ System .out .println ("+++++++++++++++++++ encounter #" + encounterNumber + " starts soon ++++++++++++++++++++" );
257263 Thread .sleep (50 );
258264
259265 // setup message received listener - this should be replaced with your code - you implement a listener.
0 commit comments