Skip to content
Snippets Groups Projects
Commit feb6c12c authored by Brutzman, Don's avatar Brutzman, Don
Browse files

javadoc

parent a432ffea
No related branches found
No related tags found
No related merge requests found
...@@ -39,7 +39,6 @@ import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface; ...@@ -39,7 +39,6 @@ import edu.nps.moves.dis7.utilities.DisThreadedNetworkInterface;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
...@@ -68,6 +67,7 @@ abstract public class PduTest ...@@ -68,6 +67,7 @@ abstract public class PduTest
Pdu receivedPdu; Pdu receivedPdu;
DisThreadedNetworkInterface.PduListener pduListener; DisThreadedNetworkInterface.PduListener pduListener;
/** Ensure network connections, listener and handler are prepared */
@BeforeEach @BeforeEach
public void setUp() public void setUp()
{ {
...@@ -83,6 +83,7 @@ abstract public class PduTest ...@@ -83,6 +83,7 @@ abstract public class PduTest
disNetworkInterface.addListener(pduListener); disNetworkInterface.addListener(pduListener);
} }
/** Ensure network connections are removed */
@AfterEach @AfterEach
public void tearDown() public void tearDown()
{ {
...@@ -91,15 +92,20 @@ abstract public class PduTest ...@@ -91,15 +92,20 @@ abstract public class PduTest
disNetworkInterface = null; disNetworkInterface = null;
} }
protected void sendPdu(Pdu pdu) /**
* Handler
* @param newPdu new PDU of interest
*/
protected void sendPdu(Pdu newPdu)
{ {
try try
{ {
disNetworkInterface.send(pdu); disNetworkInterface.send(newPdu);
Thread.sleep(getThreadSleepInterval()); // TODO better way to wait? Thread.sleep(getThreadSleepInterval()); // TODO better way to wait?
} catch (InterruptedException ex) }
catch (InterruptedException ex)
{ {
System.err.println("Error sending Multicast: " + ex.getLocalizedMessage()); System.err.println(this.getClass().getName() + ".sendPdu(Pdu newPdu), error sending Multicast: " + ex.getLocalizedMessage());
System.exit(1); System.exit(1);
} }
} }
...@@ -116,6 +122,10 @@ abstract public class PduTest ...@@ -116,6 +122,10 @@ abstract public class PduTest
return result; return result;
} }
/**
* Handler
* @param newPdu new PDU of interest
*/
protected void setUpReceiver(Pdu newPdu) protected void setUpReceiver(Pdu newPdu)
{ {
receivedPdu = newPdu; receivedPdu = newPdu;
...@@ -138,7 +148,9 @@ abstract public class PduTest ...@@ -138,7 +148,9 @@ abstract public class PduTest
assertEquals (newPdu.getTimestamp(), receivedPdu.getTimestamp(), "mismatched Timestamp"); assertEquals (newPdu.getTimestamp(), receivedPdu.getTimestamp(), "mismatched Timestamp");
} }
/** Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization) */ /**
* Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization)
*/
public abstract void testRoundTrip(); public abstract void testRoundTrip();
/** Test single PDU for correctness according to all contained fields in this PDU type /** Test single PDU for correctness according to all contained fields in this PDU type
...@@ -147,6 +159,7 @@ abstract public class PduTest ...@@ -147,6 +159,7 @@ abstract public class PduTest
protected abstract void testOnePdu(Pdu newPdu); protected abstract void testOnePdu(Pdu newPdu);
/** /**
* Threaded sleep may be necessary to ensure completion of sending/receiving PDU
* @return the threadSleepInterval * @return the threadSleepInterval
*/ */
public long getThreadSleepInterval() public long getThreadSleepInterval()
...@@ -155,6 +168,7 @@ abstract public class PduTest ...@@ -155,6 +168,7 @@ abstract public class PduTest
} }
/** /**
* Threaded sleep may be necessary to ensure completion of sending/receiving PDU
* @param threadSleepInterval the threadSleepInterval to set * @param threadSleepInterval the threadSleepInterval to set
*/ */
public void setThreadSleepInterval(long threadSleepInterval) public void setThreadSleepInterval(long threadSleepInterval)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment