Class SystaRESTAPITest

java.lang.Object
org.glassfish.jersey.test.JerseyTest
de.freaklamarsch.systarest.tests.SystaRESTAPITest

@TestInstance(PER_CLASS)
class SystaRESTAPITest
extends org.glassfish.jersey.test.JerseyTest
  • Field Details

    • testData

      private static final java.util.List<java.nio.ByteBuffer> testData
    • IDX_DATA00_09_00

      private static final int IDX_DATA00_09_00
      See Also:
      Constant Field Values
    • IDX_DATA01_09_00

      private static final int IDX_DATA01_09_00
      See Also:
      Constant Field Values
    • IDX_DATA02_09_01

      private static final int IDX_DATA02_09_01
      See Also:
      Constant Field Values
    • IDX_DATA03_09_02

      private static final int IDX_DATA03_09_02
      See Also:
      Constant Field Values
    • IDX_DATA04_09_03

      private static final int IDX_DATA04_09_03
      See Also:
      Constant Field Values
    • IDX_DATA05_09_00

      private static final int IDX_DATA05_09_00
      See Also:
      Constant Field Values
    • IDX_DATA06_09_01

      private static final int IDX_DATA06_09_01
      See Also:
      Constant Field Values
    • IDX_DATA07_09_02

      private static final int IDX_DATA07_09_02
      See Also:
      Constant Field Values
    • IDX_DATA08_09_03

      private static final int IDX_DATA08_09_03
      See Also:
      Constant Field Values
    • tempDir

      @TempDir public java.nio.file.Path tempDir
    • effectiveLogPath

      private java.lang.String effectiveLogPath
  • Constructor Details

    • SystaRESTAPITest

      SystaRESTAPITest()
  • Method Details

    • initializeTestData

      @BeforeAll public static void initializeTestData()
    • before

      @BeforeAll public void before() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • after

      @AfterAll public void after() throws java.lang.Exception
      Throws:
      java.lang.Exception
    • deleteDirectoryRecursively

      private static void deleteDirectoryRecursively​(java.nio.file.Path path) throws java.io.IOException
      Throws:
      java.io.IOException
    • configure

      public jakarta.ws.rs.core.Application configure()
      Overrides:
      configure in class org.glassfish.jersey.test.JerseyTest
    • testInvalidEndpoint

      @Test void testInvalidEndpoint()
    • testStart

      @Test public void testStart()
      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.
    • testStop

      @Test public void testStop()
    • testEnablelogging

      @Test public void testEnablelogging()
    • testLogFileCreation

      @Test void testLogFileCreation()
    • testDisablelogging

      @Test public void testDisablelogging()
    • testEnableLogging_DefaultParameters

      @Test void testEnableLogging_DefaultParameters()
    • testEnableLogging_InvalidParameters

      @Test void testEnableLogging_InvalidParameters()
    • testEnableLogging_EmptyParameters

      @Test void testEnableLogging_EmptyParameters()
    • getIPv4Address

      private static java.lang.String getIPv4Address​(java.lang.String interfaceName)
      Helper function to get the IPv4 address for a given interface name
      Parameters:
      interfaceName -
      Returns:
      the configured IPv4 address as String, e.g. "127.0.0.1", or null if no configured IPv4 address was found
    • testGetAllLogs_NoLogs

      @Test void testGetAllLogs_NoLogs() throws java.io.IOException
      Throws:
      java.io.IOException
    • testGetAllLogs_WithLogs

      @Test void testGetAllLogs_WithLogs() throws java.io.IOException
      Throws:
      java.io.IOException
    • testDeleteAllLogs

      @Test void testDeleteAllLogs() throws java.io.IOException
      Throws:
      java.io.IOException
    • testGetRawData_ReturnsJson

      @Test void testGetRawData_ReturnsJson()
    • testGetWaterHeater_ReturnsJson

      @Test void testGetWaterHeater_ReturnsJson()
    • testGetStatus_ReturnsJson

      @Test void testGetStatus_ReturnsJson()
    • testFindSystaComfort_ReturnsJson

      @Test void testFindSystaComfort_ReturnsJson()
    • testGetMonitorRawDataHTML_DefaultTheme

      @Test void testGetMonitorRawDataHTML_DefaultTheme()
    • testGetMonitorRawDataHTML_SystaWebTheme

      @Test void testGetMonitorRawDataHTML_SystaWebTheme()
    • testGetMonitorRawDataHTML_OtherTheme

      @Test void testGetMonitorRawDataHTML_OtherTheme()
    • testGetDashboardHTML

      @Test void testGetDashboardHTML()
    • readHexTextIntoByteBuffer

      private static 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
    • getFakeSystaWebInstance

      private FakeSystaWeb getFakeSystaWebInstance()
      Retrieves the FakeSystaWeb instance from the SystaRESTAPI using reflection.
      Returns:
      The FakeSystaWeb instance.
    • feedDataToFakeSystaWeb

      private void feedDataToFakeSystaWeb​(java.nio.ByteBuffer dataBuffer)
      Feeds the provided ByteBuffer to the FakeSystaWeb instance's processDatagram method.
      Parameters:
      dataBuffer - The ByteBuffer containing the data to be fed.