Package edu.nps.moves.dis7.test
Class PduTest
java.lang.Object
edu.nps.moves.dis7.test.PduTest
- Direct Known Subclasses:
DetonationPduTest,EntityStatePduTest,FirePduTest
Abstract superclass for PDU testing, originally extracted using Netbeans refactoring feature.
- Author:
- Don Brutzman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longdefault thread sleep interval msec -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanCompare all values of these two objects and report if identicalintAccessor to set maximum retry attemptslongThreaded sleep may be necessary to ensure completion of sending/receiving PDUprotected voidsendIeeeStandardPdu(Pdu createdPdu) Handler that passes PDU to DIS network interface for marshalling (serialization), which then sends IEEE Standard (binary) PDU to self, which is then read separately for unmarshalling (deserialization) further unit testing.voidsetMaximumRetryAttempts(int maximumRetryAttempts) Accessor to get maximum retry attemptsvoidsetThreadSleepInterval(long threadSleepInterval) Threaded sleep may be necessary to ensure completion of sending/receiving PDUvoidsetUp()Ensure network connections, listener and handler are preparedstatic voidpreparationprotected voidsetUpReceiver(Pdu newPdu) HandlervoidtearDown()Ensure network connections are removedstatic voidhousekeepingprotected abstract voidtestOnePdu(Pdu createdPdu) Test single PDU for correctness according to all contained fields in this PDU typeprotected voidtestPduFinishingChecks(Pdu createdPdu) Final common tests of PDU characteristics after individual fields are checked.protected voidtestPduSendReceiveHeaderMatch(Pdu createdPdu) Initial common tests for fields in PDU header.abstract voidTest PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization)
-
Field Details
-
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
protected final long THREAD_SLEEP_INTERVAL_MSEC_DEFAULTdefault thread sleep interval msec- See Also:
-
-
Constructor Details
-
PduTest
public PduTest()default constructor
-
-
Method Details
-
setUpClass
@BeforeAll public static void setUpClass()preparation -
tearDownClass
@AfterAll public static void tearDownClass()housekeeping -
setUp
@BeforeEach public void setUp()Ensure network connections, listener and handler are prepared -
tearDown
@AfterEach public void tearDown()Ensure network connections are removed -
sendIeeeStandardPdu
Handler that passes PDU to DIS network interface for marshalling (serialization), which then sends IEEE Standard (binary) PDU to self, which is then read separately for unmarshalling (deserialization) further unit testing.- Parameters:
createdPdu- new PDU of interest
-
compare
Compare all values of these two objects and report if identical- Parameters:
pdu1- first pdupdu2- second pdu- Returns:
- true if identical values found
-
setUpReceiver
Handler- Parameters:
newPdu- new PDU of interest
-
testPduSendReceiveHeaderMatch
Initial common tests for fields in PDU header. See https://en.wikipedia.org/wiki/Marshalling_(computer_science)- Parameters:
createdPdu- separate PDU for comparison
-
testPduFinishingChecks
Final common tests of PDU characteristics after individual fields are checked. See https://en.wikipedia.org/wiki/Marshalling_(computer_science)- Parameters:
createdPdu- separate PDU for comparison
-
testRoundTrip
public abstract void testRoundTrip()Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization) -
testOnePdu
Test single PDU for correctness according to all contained fields in this PDU type- Parameters:
createdPdu- separate PDU for comparison
-
getThreadSleepInterval
public long getThreadSleepInterval()Threaded sleep may be necessary to ensure completion of sending/receiving PDU- Returns:
- the threadSleepInterval
-
setThreadSleepInterval
public void setThreadSleepInterval(long threadSleepInterval) Threaded sleep may be necessary to ensure completion of sending/receiving PDU- Parameters:
threadSleepInterval- the threadSleepInterval to set
-
getMaximumRetryAttempts
public int getMaximumRetryAttempts()Accessor to set maximum retry attempts- Returns:
- the maximumRetryAttempts value
-
setMaximumRetryAttempts
public void setMaximumRetryAttempts(int maximumRetryAttempts) Accessor to get maximum retry attempts- Parameters:
maximumRetryAttempts- the maximumRetryAttempts value to set
-