diff --git a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/CommentPDUFisherTest.java b/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/CommentPDUFisherTest.java deleted file mode 100644 index ff165032efa81a43cd8be01cfc16b95f1c08c095..0000000000000000000000000000000000000000 --- a/assignments/src/MV3500Cohort2021JulySeptember/projects/Fisher/CommentPDUFisherTest.java +++ /dev/null @@ -1,131 +0,0 @@ -package MV3500Cohort2021JulySeptember.projects.Fisher; - -import edu.nps.moves.dis7.enumerations.VariableRecordType; -import edu.nps.moves.dis7.pdus.Pdu; -import edu.nps.moves.dis7.utilities.PduFactory; - -/** - * - * @author adfis - */ -public class CommentPDUFisherTest { - - //BeforeAll - public static void setUpClass() - { - System.out.println("CommentPdusTest"); - } - - //AfterAll - public static void tearDownClass() - { - } - - //BeforeEach - public void setUp() - { - } - - //AfterEach - public void tearDown() - { - } - - private Pdu receivedPdu; - - //Test - public void testRoundTrip() - { - PduFactory factory = new PduFactory(); - setUpReceiver(); - - testOne(factory.makeCommentPdu()); - testOne(factory.makeCommentPdu("123_test_string")); - testOne(factory.makeCommentPdu(VariableRecordType.MODEL_TYPE, "456_test with type = modeltype")); - testOne(factory.makeCommentPdu("xyz first message","mno second message", "jkl third message")); - - testOne(factory.makeCommentReliablePdu()); - testOne(factory.makeCommentReliablePdu("789_test_string")); - testOne(factory.makeCommentReliablePdu(VariableRecordType.ACLS_AIRCRAFT_REPORT, "abc_test with type = acls_aircraft_report")); - testOne(factory.makeCommentReliablePdu("xyz R first message","mno R second message", "jkl R third message")); - } - - private void testOne(Pdu pdu) - { - sendPdu(pdu); // will wait a while - assertTrue(receivedPdu != null, "No response from network receive"); - assertTrue(compare(pdu,receivedPdu),"Comparison failed"); - receivedPdu = null; - } - - private void sendPdu(Pdu pdu) - { - try { - Thread.sleep(250l); // make sure receiver is listening - DisNetworking disnet = new DisNetworking(); - disnet.sendPdu(pdu); - - Thread.sleep(1000l); - } - catch (InterruptedException ex) { - System.err.println("Error sending Multicast: " + ex.getLocalizedMessage()); - System.exit(1); - } - } - - private boolean compare(Pdu pdu1, Pdu pdu2) - { - return pdu1.equals(pdu2); - } - - private void setUpReceiver() - { - Thread rcvThread = new Thread(() -> { - while(true) { - receivedPdu = new DisNetworking().receivePdu(); // blocks - } - }); - - rcvThread.setPriority(Thread.NORM_PRIORITY); - rcvThread.setDaemon(true); - rcvThread.start(); - } - - /** - * - * @param args - */ - public static void main(String[] args) - { - //new CommentPdusTest().testRoundTrip(); - } - - private void assertTrue(boolean b, String no_response_from_network_receive) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - private static class CommentPdusTest { - - public CommentPdusTest() { - } - - //private void testRoundTrip() { - // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - // } - } - - private static class DisNetworking { - - public DisNetworking() { - } - - private Pdu receivePdu() { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - private void sendPdu(Pdu pdu) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - } -} -