Class PduTest

java.lang.Object
edu.nps.moves.dis7.PduTest
Direct Known Subclasses:
DetonationPduTest, EntityStatePduTest, FirePduTest

public abstract class PduTest extends Object
Abstract superclass for PDU testing, originally extracted using Netbeans refactoring feature.
Author:
Don Brutzman
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected boolean
    compare​(Pdu pdu1, Pdu pdu2)
    Compare all values of these two objects and report if identical
    int
     
    long
    Threaded sleep may be necessary to ensure completion of sending/receiving PDU
    protected 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 PDU
    void
    Ensure network connections, listener and handler are prepared
    static void
     
    protected void
    setUpReceiver​(Pdu newPdu)
    Handler
    void
    Ensure network connections are removed
    static void
     
    protected abstract void
    testOnePdu​(Pdu createdPdu)
    Test single PDU for correctness according to all contained fields in this PDU type
    protected void
    testPduFinishingChecks​(Pdu createdPdu)
    Final common tests of PDU characteristics after individual fields are checked.
    protected void
    Initial common tests for fields in PDU header.
    abstract void
    Test PDU sending, receiving, marshalling (serialization) and unmarshalling (deserialization)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      protected 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.
      Parameters:
      createdPdu - new PDU of interest
    • compare

      protected boolean compare(Pdu pdu1, Pdu pdu2)
      Compare all values of these two objects and report if identical
      Parameters:
      pdu1 - first pdu
      pdu2 - second pdu
      Returns:
      true if identical values found
    • setUpReceiver

      protected void setUpReceiver(Pdu newPdu)
      Handler
      Parameters:
      newPdu - new PDU of interest
    • testPduSendReceiveHeaderMatch

      protected void testPduSendReceiveHeaderMatch(Pdu createdPdu)
      Initial common tests for fields in PDU header. See https://en.wikipedia.org/wiki/Marshalling_(computer_science)
      Parameters:
      createdPdu - separate PDU for comparison
    • testPduFinishingChecks

      protected void testPduFinishingChecks(Pdu createdPdu)
      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

      protected abstract void testOnePdu(Pdu createdPdu)
      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