Package edu.nps.moves.dis7
Class PduTest
java.lang.Object
edu.nps.moves.dis7.PduTest
- Direct Known Subclasses:
DetonationPduTest
,EntityStatePduTest
,FirePduTest
Abstract superclass for PDU testing, originally extracted using Netbeans refactoring feature.
- Author:
- Don Brutzman
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Compare all values of these two objects and report if identicalint
long
Threaded sleep may be necessary to ensure completion of sending/receiving PDUprotected void
sendIeeeStandardPdu(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.void
setMaximumRetryAttempts(int maximumRetryAttempts)
void
setThreadSleepInterval(long threadSleepInterval)
Threaded sleep may be necessary to ensure completion of sending/receiving PDUvoid
setUp()
Ensure network connections, listener and handler are preparedstatic void
protected void
setUpReceiver(Pdu newPdu)
Handlervoid
tearDown()
Ensure network connections are removedstatic void
protected abstract void
testOnePdu(Pdu createdPdu)
Test single PDU for correctness according to all contained fields in this PDU typeprotected void
testPduFinishingChecks(Pdu createdPdu)
Final common tests of PDU characteristics after individual fields are checked.protected void
testPduSendReceiveHeaderMatch(Pdu createdPdu)
Initial common tests for fields in PDU header.abstract void
Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization)
-
Field Details
-
THREAD_SLEEP_INTERVAL_MSEC_DEFAULT
protected final long THREAD_SLEEP_INTERVAL_MSEC_DEFAULT- See Also:
- Constant Field Values
-
-
Constructor Details
-
PduTest
public PduTest()
-
-
Method Details
-
setUpClass
@BeforeAll public static void setUpClass() -
tearDownClass
@AfterAll public static void tearDownClass() -
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()- Returns:
- the maximumRetryAttempts value
-
setMaximumRetryAttempts
public void setMaximumRetryAttempts(int maximumRetryAttempts)- Parameters:
maximumRetryAttempts
- the maximumRetryAttempts value to set
-