diff --git a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java index 31f8866d0c95b6df3d605428e4ae8ef93e0cea88..a98057ecdf7fcfba855afca7d7ba4e8d40836ca2 100644 --- a/test/edu/nps/moves/dis7/AllPduRoundTripTest.java +++ b/test/edu/nps/moves/dis7/AllPduRoundTripTest.java @@ -39,7 +39,7 @@ public class AllPduRoundTripTest List<Pdu> pdusReceived = new ArrayList<>(); List<Pdu> pdusRead = new ArrayList<>(); PduFactory pduFactory; - PduRecorder recorder; + PduRecorder pduRecorder; @BeforeAll public static void beforeAllTests() @@ -176,8 +176,8 @@ public class AllPduRoundTripTest } private void setupSenderRecorder() throws Exception { - recorder = new PduRecorder(); // default mcaddr, port, logfile dir - disNetworkInterface = recorder.getDisThreadedNetIF(); + pduRecorder = new PduRecorder(); // default network address, port, logfile dir + disNetworkInterface = pduRecorder.getDisThreadedNetworkInterface(); // When the DisThreadedNetworkInterface receives a pdu, a call is made to the // everyTypeListeners which makes a lamba call back here to capture received @@ -191,14 +191,14 @@ public class AllPduRoundTripTest } }; disNetworkInterface.addListener(pduListener); - System.out.println("Recorder log at " + recorder.getLogFilePath()); + System.out.println("Recorder log at " + pduRecorder.getLogFilePath()); } /** Will shutdown the common send/receive network interface */ private void shutDownSenderRecorder() throws Exception { disNetworkInterface.removeListener(pduListener); - recorder.end(); + pduRecorder.stop(); } private void testForEquals() throws Exception @@ -212,8 +212,8 @@ public class AllPduRoundTripTest private void getAllFromRecorder(Semaphore sem) throws Exception { sem.acquire(); - Path path = Path.of(recorder.getLogFilePath()).getParent(); - PduPlayer player = new PduPlayer(disNetworkInterface.getMulticastGroup(), disNetworkInterface.getDisPort(), path, false); + Path path = Path.of(pduRecorder.getLogFilePath()).getParent(); + PduPlayer player = new PduPlayer(disNetworkInterface.getAddress(), disNetworkInterface.getPort(), path, false); player.addRawListener(ba -> { if (ba != null) { Pdu pdu = pduFactory.createPdu(ba); diff --git a/test/edu/nps/moves/dis7/BitFieldRoundTripTest.java b/test/edu/nps/moves/dis7/BitFieldRoundTripTest.java index fc773e3b1363c06b4570f13a1b05ad801afa0ba7..9555eede8524544b393069941ff5383e5037b4c1 100644 --- a/test/edu/nps/moves/dis7/BitFieldRoundTripTest.java +++ b/test/edu/nps/moves/dis7/BitFieldRoundTripTest.java @@ -52,8 +52,7 @@ public class BitFieldRoundTripTest public void tearDown() { disNetworkInterface.removeListener(pduListener); - disNetworkInterface.kill(); - disNetworkInterface = null; + disNetworkInterface.close(); } @Test diff --git a/test/edu/nps/moves/dis7/CommentPdusTest.java b/test/edu/nps/moves/dis7/CommentPdusTest.java index c47a74aabba14fed80d507b821a563ba2630b27b..a60cab955bba22dd71cf590fb1e567e15797e220 100644 --- a/test/edu/nps/moves/dis7/CommentPdusTest.java +++ b/test/edu/nps/moves/dis7/CommentPdusTest.java @@ -46,8 +46,7 @@ public class CommentPdusTest public void tearDown() { disNetworkInterface.removeListener(pduListener); - disNetworkInterface.kill(); - disNetworkInterface = null; + disNetworkInterface.close(); } /** Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization) */ diff --git a/test/edu/nps/moves/dis7/DataQueryPduRoundTripTest.java b/test/edu/nps/moves/dis7/DataQueryPduRoundTripTest.java index 5444bb89bd073b371d04ce32c4817f05b8e082dd..eaec4deaf228297d70c9fc278c1a35b5333914f1 100644 --- a/test/edu/nps/moves/dis7/DataQueryPduRoundTripTest.java +++ b/test/edu/nps/moves/dis7/DataQueryPduRoundTripTest.java @@ -50,8 +50,7 @@ public class DataQueryPduRoundTripTest public void tearDown() { disNetworkInterface.removeListener(pduListener); - disNetworkInterface.kill(); - disNetworkInterface = null; + disNetworkInterface.close(); } private static int REQUEST_ID = 0x00112233; diff --git a/test/edu/nps/moves/dis7/FixedAndVariableDatumRoundTripTest.java b/test/edu/nps/moves/dis7/FixedAndVariableDatumRoundTripTest.java index 0824fc17725d542d0050639015e551d146241c21..4f99a9be8b1145132e6ce5665bc603c063e4b894 100644 --- a/test/edu/nps/moves/dis7/FixedAndVariableDatumRoundTripTest.java +++ b/test/edu/nps/moves/dis7/FixedAndVariableDatumRoundTripTest.java @@ -49,8 +49,7 @@ public class FixedAndVariableDatumRoundTripTest public void tearDown() { disNetworkInterface.removeListener(pduListener); - disNetworkInterface.kill(); - disNetworkInterface = null; + disNetworkInterface.close(); } private static final FixedDatum fixedDatum1 = new FixedDatum(); diff --git a/test/edu/nps/moves/dis7/PduTest.java b/test/edu/nps/moves/dis7/PduTest.java index d0a49a387691e2d7b89f922155543166df70f60d..70f98504bf2e908ce415fdee747b667fb7fd98a8 100644 --- a/test/edu/nps/moves/dis7/PduTest.java +++ b/test/edu/nps/moves/dis7/PduTest.java @@ -90,8 +90,7 @@ abstract public class PduTest public void tearDown() { disNetworkInterface.removeListener(pduListener); - disNetworkInterface.kill(); - disNetworkInterface = null; + disNetworkInterface.close(); try // additional sleep, allowing teardown to proceed { Thread.sleep(getThreadSleepInterval()); diff --git a/test/edu/nps/moves/dis7/SignalPdusTest.java b/test/edu/nps/moves/dis7/SignalPdusTest.java index 57f3a251b0c92555aa34aabdfbc4005a206a59ce..27f2851c65be33eb01cce9463866d518cb2ec646 100644 --- a/test/edu/nps/moves/dis7/SignalPdusTest.java +++ b/test/edu/nps/moves/dis7/SignalPdusTest.java @@ -36,10 +36,10 @@ public class SignalPdusTest { static DisThreadedNetworkInterface disNetworkInterface; static DisThreadedNetworkInterface.PduListener pduListener; static List<Pdu> receivedPdus; - static PduRecorder recorder; + static PduRecorder pduRecorder; static Semaphore mutex; - static PduFactory pduFac; + static PduFactory pduFactory; static List<Pdu> sentPdus; byte[] bufferByteArray; int size; @@ -48,8 +48,8 @@ public class SignalPdusTest { public static void setUpClass() throws IOException { System.out.println("SignalPdusTest"); - recorder = new PduRecorder(); // default dir - disNetworkInterface = recorder.getDisThreadedNetIF(); + pduRecorder = new PduRecorder(); // default dir + disNetworkInterface = pduRecorder.getDisThreadedNetworkInterface(); pduListener = new DisThreadedNetworkInterface.PduListener() { @Override public void incomingPdu(Pdu pdu) { @@ -60,24 +60,24 @@ public class SignalPdusTest { mutex = new Semaphore(1); - sentPdus = new ArrayList<>(); + sentPdus = new ArrayList<>(); receivedPdus = new ArrayList<>(); - pduFac = new PduFactory(); + pduFactory = new PduFactory(); - Pdu pdu = pduFac.makeSignalPdu(); // empty contents + Pdu pdu = pduFactory.makeSignalPdu(); // empty contents sentPdus.add(pdu); - pdu = pduFac.makeSignalPdu(); + pdu = pduFactory.makeSignalPdu(); ((SignalPdu) pdu).setEncodingScheme((short) 0x1111); ((SignalPdu) pdu).setSampleRate(0x22222222); ((SignalPdu) pdu).setSamples((short) 0x3333); ((SignalPdu) pdu).setData("SignalPdu-testdata".getBytes()); sentPdus.add(pdu); - pdu = pduFac.makeIntercomSignalPdu(); + pdu = pduFactory.makeIntercomSignalPdu(); sentPdus.add(pdu); - pdu = pduFac.makeIntercomSignalPdu(); + pdu = pduFactory.makeIntercomSignalPdu(); ((IntercomSignalPdu) pdu).setEncodingScheme((short) 0x1111); ((IntercomSignalPdu) pdu).setSampleRate(0x22222222); ((IntercomSignalPdu) pdu).setSamples((short) 0x3333); @@ -102,7 +102,7 @@ public class SignalPdusTest { @AfterEach public void tearDown() throws IOException { disNetworkInterface.removeListener(pduListener); - recorder.end(); // kills the disNetworkInterface as well + pduRecorder.stop(); // kills the disNetworkInterface as well } @Test @@ -118,7 +118,7 @@ public class SignalPdusTest { assertTrue(size > 0, "Unmarshalling error: Unmarshalled size: " + size); // This also unmarshalls the pdu - pdu = pduFac.createPdu(bufferByteArray); + pdu = pduFactory.createPdu(bufferByteArray); assertNotNull(pdu, "Unmarshalling error " + pdu); } catch (Exception ex) { Logger.getLogger(SignalPdusTest.class.getName()).log(Level.SEVERE, null, ex); @@ -138,12 +138,12 @@ public class SignalPdusTest { Path path = Path.of("./pduLog"); // Note: the player will playback all log files in the given path - PduPlayer player = new PduPlayer(DisThreadedNetworkInterface.DEFAULT_MULTICAST_ADDRESS, DisThreadedNetworkInterface.DEFAULT_DIS_PORT, path, false); - player.addRawListener(ba -> { + PduPlayer pduPlayer = new PduPlayer(DisThreadedNetworkInterface.DEFAULT_DIS_ADDRESS, DisThreadedNetworkInterface.DEFAULT_DIS_PORT, path, false); + pduPlayer.addRawListener(ba -> { if (ba != null) - assertNotNull(pduFac.createPdu(ba), "PDU creation failure"); + assertNotNull(pduFactory.createPdu(ba), "PDU creation failure"); else { - player.end(); + pduPlayer.end(); mutex.release(); } }); diff --git a/test/edu/nps/moves/dis7/X3dInterpolatorsTest.java b/test/edu/nps/moves/dis7/X3dInterpolatorsTest.java index bebd497ecce3d211b2f584f2c9cf169b91a901b1..0ae573f648c640f363ccd78ad2bcf9c9a520b04c 100644 --- a/test/edu/nps/moves/dis7/X3dInterpolatorsTest.java +++ b/test/edu/nps/moves/dis7/X3dInterpolatorsTest.java @@ -62,7 +62,7 @@ public class X3dInterpolatorsTest { Path path = Path.of("./pduLog"); // Note: the player will playback all log files in the given path - PduPlayer pduPlayer = new PduPlayer(DisThreadedNetworkInterface.DEFAULT_MULTICAST_ADDRESS, DisThreadedNetworkInterface.DEFAULT_DIS_PORT, path, true); + PduPlayer pduPlayer = new PduPlayer(DisThreadedNetworkInterface.DEFAULT_DIS_ADDRESS, DisThreadedNetworkInterface.DEFAULT_DIS_PORT, path, true); pduPlayer.addRawListener(ba -> { if (ba == null) { pduPlayer.end();