Class FakeSystaWebTest

java.lang.Object
de.freaklamarsch.systarest.tests.FakeSystaWebTest

class FakeSystaWebTest
extends java.lang.Object
  • Field Details

    • data

      java.nio.ByteBuffer[] data
    • logDir

      private static final java.lang.String logDir
      See Also:
      Constant Field Values
    • logfileFilter

      private java.io.FilenameFilter logfileFilter
    • logFileFilterStringField

      private java.lang.reflect.Field logFileFilterStringField
    • logFileFilterString

      private java.lang.String logFileFilterString
    • fsw

      private FakeSystaWeb fsw
    • RING_BUFFER_SIZE

      private java.lang.reflect.Field RING_BUFFER_SIZE
    • readIndex

      private java.lang.reflect.Field readIndex
    • writeIndex

      private java.lang.reflect.Field writeIndex
    • timestamp

      private java.lang.reflect.Field timestamp
    • socketField

      private java.lang.reflect.Field socketField
    • socket

      private java.net.DatagramSocket socket
    • intData

      private java.lang.reflect.Field intData
    • logInt

      private DataLogger<java.lang.Integer> logInt
    • logIntDataBufferField

      private java.lang.reflect.Field logIntDataBufferField
    • logIntDataBuffer

      private CircularBuffer<java.lang.Integer> logIntDataBuffer
    • logRaw

      private DataLogger<java.lang.Byte> logRaw
  • Constructor Details

    • FakeSystaWebTest

      FakeSystaWebTest() throws java.lang.NoSuchFieldException, java.lang.SecurityException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.NoSuchMethodException
      Throws:
      java.lang.NoSuchFieldException
      java.lang.SecurityException
      java.lang.IllegalArgumentException
      java.lang.IllegalAccessException
      java.lang.NoSuchMethodException
  • Method Details

    • initialize

      private boolean initialize()
      initialize components for access via reflection
    • findSC

      @Test void findSC()
    • testProcessDataType1

      @Test void testProcessDataType1()
    • testProcessDatagram

      @Test void testProcessDatagram()
    • testGetAllLogs

      @Test void testGetAllLogs()
    • prepareInvokeMethod

      private java.lang.reflect.Method prepareInvokeMethod​(java.lang.String methodName, java.lang.Class<?>... parameters) throws java.lang.NoSuchFieldException, java.lang.SecurityException, java.lang.IllegalArgumentException, java.lang.IllegalAccessException, java.lang.NoSuchMethodException
      Parameters:
      methodName - the name of the method, that should be retrieved from FakeSystaWeb
      Returns:
      Method processDatagram from fsw
      Throws:
      java.lang.NoSuchFieldException
      java.lang.SecurityException
      java.lang.IllegalArgumentException
      java.lang.IllegalAccessException
      java.lang.NoSuchMethodException
    • updateWriteIndexAndTimestamp

      private boolean updateWriteIndexAndTimestamp​(FakeSystaWeb fsw)
      update the writeIndex and timestamp as it is done inside the FakeSystaWeb run method
      Parameters:
      fsw -
      Returns:
      true if everything worked fine, false if an error occurred
    • changeDefaultLogDir

      private void changeDefaultLogDir​(java.lang.String newDir)
      Use reflection to change the hardcoded directory used for the location of log files. As DEFAULT_ROOT_PATH is static final in DataLogger, it is officially a security risk to change this value. This function might not work with future Java versions.
    • initializeData

      private void initializeData()
    • readHexTextIntoByteBuffer

      private void readHexTextIntoByteBuffer​(java.nio.ByteBuffer byteBuffer, java.lang.String hexTextFile)
      loads a hexText file into a ByteBuffer. A hexText file is a file, that has the Hex Stream of a captured packet as a single line. The size of the ByteBuffer has to match the Hex Stream in the file. No checks are done.
      Parameters:
      byteBuffer - the buffer in which the bytes from the hexText file should be stored
      hexTextFile - path to the hexText file