Skip to content

Commit 456d983

Browse files
committed
extended test - message reaches first hop
1 parent b37c4e5 commit 456d983

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/net/sharksystem/asap/MultihopTests.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public void createNonOpenStorage() throws IOException, ASAPException, Interrupte
107107
ui.doCreateASAPChannel(" Alice chat sn2://closedChannel Bob Clara");
108108
ui.doPrintChannelInformation("Alice chat sn2://closedChannel");
109109

110+
// add message
111+
// add message to alice storage
112+
String messageAlice2Clara = "HiClara";
113+
String parameters = "Alice chat sn2://closedChannel " + messageAlice2Clara;
114+
ui.doCreateASAPMessage(parameters);
115+
110116
System.out.println("**************************************************************************");
111117
System.out.println("** connect Alice with Bob **");
112118
System.out.println("**************************************************************************");
@@ -152,6 +158,19 @@ public void createNonOpenStorage() throws IOException, ASAPException, Interrupte
152158
}
153159

154160
Assert.assertTrue(aliceFound && bobFound && claraFound);
161+
162+
// check for a message
163+
/* message was actually from Bob but originated from Alice. It is put
164+
into a incoming folder as it would have been directly received from Alice.
165+
Signatures would allow ensuring if origin was really who mediator claims to be.
166+
*/
167+
ASAPChunkStorage bobAlice = bobStorage.getIncomingChunkStorage("Alice");
168+
169+
// clara era was increased after connection terminated - message from bob is in era before current one
170+
int eraToLook = ASAPEngine.previousEra(bobStorage.getEra());
171+
ASAPChunk bobABCChat = bobAlice.getChunk("sn2://closedChannel", eraToLook);
172+
CharSequence message = bobABCChat.getMessages().next();
173+
Assert.assertTrue(messageAlice2Clara.equalsIgnoreCase(message.toString()));
155174
}
156175

157176
private ASAPStorage getFreshStorageByName(CmdLineUI ui, String storageName) throws ASAPException, IOException {

0 commit comments

Comments
 (0)