From 894c95df2ca1d1bb781dc39943a922392d881577 Mon Sep 17 00:00:00 2001 From: terry-norbraten <tnorb@comcast.net> Date: Fri, 26 Jun 2020 23:03:05 -0600 Subject: [PATCH] pdu dup checking --- .../nps/moves/dis7/AllPduRoundTripTest.java | 37 ++++++++++--------- test/edu/nps/moves/dis7/SignalPdusTest.java | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java index 77791537fd..484f495eee 100644 --- a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java +++ b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java @@ -144,7 +144,7 @@ public class AllPduRoundTripTest pdusSent.forEach(p -> { disnetworking.send(p); - sleep(1l); // give receiver time to process + sleep(5l); // give receiver time to process }); shutDownSenderRecorder(); @@ -169,23 +169,24 @@ public class AllPduRoundTripTest assertNull(ex, "Exception should be null if successful creation of all objects"); } - private void setupSenderRecorder() throws Exception - { - recorder = new PduRecorder(); // default mcaddr, port, logfile dir - disnetworking = recorder.getDisThreadedNetIF(); - - // When the DisThreadedNetIF receives a pdu, a call is made to the - // everyTypeListeners which makes a lamba call back here to capture received - // pdus - lis = new DisThreadedNetIF.PduListener() { - @Override - public void incomingPdu(Pdu pdu) { - pdusReceived.add(pdu); - } - }; - disnetworking.addListener(lis); - System.out.println("Recorder log at " + recorder.getLogFile()); - } + private void setupSenderRecorder() throws Exception { + recorder = new PduRecorder(); // default mcaddr, port, logfile dir + disnetworking = recorder.getDisThreadedNetIF(); + + // When the DisThreadedNetIF receives a pdu, a call is made to the + // everyTypeListeners which makes a lamba call back here to capture received + // pdus + lis = new DisThreadedNetIF.PduListener() { + @Override + public void incomingPdu(Pdu pdu) { + if (!pdusReceived.contains(pdu)) { + pdusReceived.add(pdu); + } + } + }; + disnetworking.addListener(lis); + System.out.println("Recorder log at " + recorder.getLogFile()); + } /** Will shutdown the common send/receive network interface */ private void shutDownSenderRecorder() throws Exception diff --git a/test/edu/nps/moves/dis7/SignalPdusTest.java b/test/edu/nps/moves/dis7/SignalPdusTest.java index aa97bd2268..c416f7bd35 100644 --- a/test/edu/nps/moves/dis7/SignalPdusTest.java +++ b/test/edu/nps/moves/dis7/SignalPdusTest.java @@ -82,7 +82,7 @@ public class SignalPdusTest { sentPdus.forEach(p -> { netif.send(p); - sleep(10l); // give receiver time to process + sleep(5l); // give receiver time to process }); } -- GitLab