Package de.freaklamarsch.systarest.tests
Class FakeSTouchTest
java.lang.Object
de.freaklamarsch.systarest.tests.FakeSTouchTest
class FakeSTouchTest
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classFakeSTouchTest.PcapPacket -
Field Summary
Fields Modifier and Type Field Description (package private) DeviceTouchSearch.DeviceTouchDeviceInfodeviceInfo(package private) byte[]localIpAddrBytes(package private) java.util.ArrayList<FakeSTouchTest.PcapPacket>packetData -
Constructor Summary
Constructors Constructor Description FakeSTouchTest() -
Method Summary
Modifier and Type Method Description private FakeSTouchTest.PcapPacketbyteArrayToDatagramPacket(java.util.ArrayList<java.lang.Byte> bytes)(package private) voidfindSystaComfort()private voidinitializeData(java.lang.String testFileName)readspacketDatafrom a pcap dumped into a c array header file.private voidinitializeData(java.lang.String testFileName, int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)readspacketDatafrom a pcap dumped into a c array header file.private voidprintByteArrayAsHex(byte[] bytes)private voidreadPCAPDumpHeaderFileIntoByteBufferArray(java.lang.String pcapDumpHeaderFile)loads pcap dump of the communication flow between the S-Touch app and a compatible device.private voidsaveDisplayAsExcalidraw(FakeSTouch stouch, java.lang.String filename)Save theobjectTreefrom the display of the passedFakeSTouchas excalidraw.png-fileprivate voidsaveDisplayAsPNG(FakeSTouch stouch, java.lang.String filename)Save theobjectTreefrom the display of the passedFakeSTouchas png-fileprivate voidsetDeviceInfoFromPacketData(int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)(package private) voidtestCommunication()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
deviceInfo
DeviceTouchSearch.DeviceTouchDeviceInfo deviceInfo -
packetData
java.util.ArrayList<FakeSTouchTest.PcapPacket> packetData -
localIpAddrBytes
byte[] localIpAddrBytes
-
-
Constructor Details
-
FakeSTouchTest
FakeSTouchTest()
-
-
Method Details
-
initializeData
private void initializeData(java.lang.String testFileName)readspacketDatafrom a pcap dumped into a c array header file. It is assumed that the file starts with the default startup sequence of the S-Touch app searching for a compatible device- Parameters:
testFileName-
-
initializeData
private void initializeData(java.lang.String testFileName, int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)readspacketDatafrom a pcap dumped into a c array header file. The capture file should hold packets from the communication startup sequence and you have to provide the indices of these packets- Parameters:
testFileName-idxDeviceTouchInfoReply- index of the packet holding the reply with the info string about the communication partneridxPortReply- index of the packet holding the reply with the port used for communication by the partneridxPasswordReply- index of the packet holding the reply with the password used for communication by the partner
-
setDeviceInfoFromPacketData
private void setDeviceInfoFromPacketData(int idxDeviceTouchInfoReply, int idxPortReply, int idxPasswordReply)- Parameters:
idxDeviceTouchInfoReply- index of the packet holding the reply with the info string about the communication partneridxPortReply- index of the packet holding the reply with the port used for communication by the partneridxPasswordReply- index of the packet holding the reply with the password used for communication by the partner
-
readPCAPDumpHeaderFileIntoByteBufferArray
private void readPCAPDumpHeaderFileIntoByteBufferArray(java.lang.String pcapDumpHeaderFile)loads pcap dump of the communication flow between the S-Touch app and a compatible device. The dump need to be saved as "C" header file holding the packets as hexText bytes in "C" arrays. A hexText byte is the hexadecimal asci text representing the value of the transmitted byte. The size of the ByteBuffer has to match the Hex Stream in the file. No checks are done.- Parameters:
pcapDumpHeaderFile- path to the file that should be loaded
-
printByteArrayAsHex
private void printByteArrayAsHex(byte[] bytes) -
byteArrayToDatagramPacket
private FakeSTouchTest.PcapPacket byteArrayToDatagramPacket(java.util.ArrayList<java.lang.Byte> bytes) -
findSystaComfort
@Test void findSystaComfort() -
testCommunication
@Test void testCommunication() -
saveDisplayAsExcalidraw
Save theobjectTreefrom the display of the passedFakeSTouchas excalidraw.png-file- Parameters:
stouch-filename-
-
saveDisplayAsPNG
Save theobjectTreefrom the display of the passedFakeSTouchas png-file- Parameters:
stouch-filename-
-