@@ -104,16 +104,6 @@ public void createNonOpenStorage() throws IOException, ASAPException, Interrupte
104104 ui .doCreateASAPStorage ("Bob nonOpen" );
105105 ui .doCreateASAPStorage ("Clara nonOpen" );
106106
107- ui .doAddRecipient ("Alice:nonOpen Bob" );
108- ui .doAddRecipient ("Alice:nonOpen Clara" );
109- ui .doAddRecipient ("Alice:nonOpen David" );
110-
111- // message shall reach Bob and Clara but not David
112- ui .doAddRecipient ("Bob:nonOpen Clara" );
113-
114- ui .doSetSendReceivedMessage ("Alice:nonOpen on" );
115- ui .doSetSendReceivedMessage ("Bob:nonOpen on" );
116-
117107 // add message to alice storage
118108 String messageAlice2Clara = "HiClara" ;
119109 String parameters = "Alice nonOpen abcChat " + messageAlice2Clara ;
@@ -169,116 +159,6 @@ public void createNonOpenStorage() throws IOException, ASAPException, Interrupte
169159 Assert .assertTrue (aliceFound && bobFound && claraFound && davidFound );
170160 }
171161
172- //@Test
173- public void twoHopsNonOpenStorage () throws IOException , ASAPException , InterruptedException {
174- CmdLineUI ui = new CmdLineUI (System .out );
175-
176- ui .doResetASAPStorages ();
177-
178- // create storages
179- ui .doCreateASAPStorage ("Alice twoHops" );
180- ui .doCreateASAPStorage ("Bob twoHops" );
181- ui .doCreateASAPStorage ("Clara twoHops" );
182- ui .doCreateASAPStorage ("David twoHops" );
183-
184- ui .doAddRecipient ("Alice:twoHops Bob" );
185- ui .doAddRecipient ("Alice:twoHops Clara" );
186- ui .doAddRecipient ("Alice:twoHops David" );
187-
188- // message shall reach Bob and Clara but not David
189- ui .doAddRecipient ("Bob:twoHops Clara" );
190-
191- ui .doSetSendReceivedMessage ("Alice:twoHops on" );
192- ui .doSetSendReceivedMessage ("Bob:twoHops on" );
193-
194- // add message to alice storage
195- String messageAlice2Clara = "HiClara" ;
196- String parameters = "Alice twoHops abcChat " + messageAlice2Clara ;
197- ui .doCreateASAPMessage (parameters );
198-
199- System .out .println ("**************************************************************************" );
200- System .out .println ("** connect Alice with Bob **" );
201- System .out .println ("**************************************************************************" );
202- // connect alice with bob
203- ui .doCreateASAPMultiEngine ("Alice" );
204- ui .doOpen ("7070 Alice" );
205- // wait a moment to give server socket time to be created
206- Thread .sleep (10 );
207- ui .doCreateASAPMultiEngine ("Bob" );
208-
209- ui .doConnect ("7070 Bob" );
210-
211- // alice should be in era 1 (content has changed before connection) and bob era is 0 - no changes
212-
213- // wait a moment
214- Thread .sleep (1000 );
215-
216- // kill connections
217- ui .doKill ("all" );
218-
219- // alice should stay in era 1 (no content change), bob should be in era 1 received something
220-
221- // wait a moment
222- Thread .sleep (1000 );
223-
224- System .out .println ("**************************************************************************" );
225- System .out .println ("** connect Bob with David **" );
226- System .out .println ("**************************************************************************" );
227- // connect alice with bob
228- ui .doCreateASAPMultiEngine ("Bob" );
229- ui .doOpen ("7070 Bob" );
230- // wait a moment to give server socket time to be created
231- Thread .sleep (10 );
232- ui .doCreateASAPMultiEngine ("David" );
233-
234- ui .doConnect ("7070 David" );
235-
236- // alice should be in era 1 (content has changed before connection) and bob era is 0 - no changes
237-
238- // wait a moment
239- Thread .sleep (1000 );
240-
241- // kill connections
242- ui .doKill ("all" );
243-
244- // alice should stay in era 1 (no content change), bob should be in era 1 received something
245-
246- // wait a moment
247- Thread .sleep (1000 );
248-
249- System .out .println ("**************************************************************************" );
250- System .out .println ("** connect Bob with Clara **" );
251- System .out .println ("**************************************************************************" );
252- ui .doCreateASAPMultiEngine ("Clara" );
253- ui .doOpen ("8080 Clara" );
254- // wait a moment to give server socket time to be created
255- Thread .sleep (10 );
256- ui .doConnect ("8080 Bob" );
257-
258- // bob should remain in era 1 o changes, clara is era 0
259-
260- // wait a moment
261- Thread .sleep (1000 );
262- // kill connections
263- ui .doKill ("all" );
264-
265- // get Clara storage
266- ASAPStorage clara = this .getFreshStorageByName (ui , "Clara:twoHops" );
267-
268- /* message was actually from Bob but originated from Alice. It is put
269- into a incoming folder as it would have been directly received from Alice.
270- Signatures would allow ensuring if origin was really who mediator claims to be.
271- */
272- ASAPChunkStorage claraBob = clara .getIncomingChunkStorage ("Alice" );
273-
274- // clara era was increased after connection terminated - message from bob is in era before current one
275- int eraToLook = ASAPEngine .previousEra (clara .getEra ());
276- ASAPChunk claraABCChat = claraBob .getChunk ("abcChat" , eraToLook );
277- CharSequence message = claraABCChat .getMessages ().next ();
278- boolean same = messageAlice2Clara .equalsIgnoreCase (message .toString ());
279- Assert .assertTrue (same );
280- }
281-
282162 private ASAPStorage getFreshStorageByName (CmdLineUI ui , String storageName ) throws ASAPException , IOException {
283163 String rootFolder = ui .getEngineRootFolderByStorageName (storageName );
284164 return ASAPEngineFS .getExistingASAPEngineFS (rootFolder );
0 commit comments