use of com.infiniteautomation.serial.TestSerialPortOutputStream in project ma-modules-public by infiniteautomation.
the class SerialDataSourceTest method setup.
@Before
public void setup() {
this.proxy = new TestSerialPortProxy(new TestSerialPortInputStream(), new TestSerialPortOutputStream());
Common.serialPortManager = new SerialDataSourceSerialPortManager(proxy);
vo = SerialDataSourceTestData.getStandardDataSourceVO();
rt = (SerialDataSourceRT) vo.createDataSourceRT();
testCases.put("Hello World!;", new SerialDataSourceTestCase(SerialDataSourceTestData.getMatchAllPoint(vo), "terminator", ";", 1, new String[] { "Hello World!;" }));
testCases.put("8812;abcf;", new SerialDataSourceTestCase(SerialDataSourceTestData.getMatchAllPoint(vo), "terminator", ";", 2, new String[] { "8812;", "abcf;" }));
testCases.put("", new SerialDataSourceTestCase(SerialDataSourceTestData.getMatchAllPoint(vo), "terminator", ";", 0, new String[] {}));
testCases.put("testStr\n\nabs", new SerialDataSourceTestCase(SerialDataSourceTestData.getNewlineTerminated(vo), "terminator", "\n", 2, new String[] { "testStr", "" }));
testCases.put("ok;", new SerialDataSourceTestCase(SerialDataSourceTestData.getMatchAllPoint(vo), "terminator", ";", 1, new String[] { "ok;" }));
// Clean out the timer's tasks
time = System.currentTimeMillis() - 1000000;
timer.setStartTime(time);
// TODO requiring more mocks for timers testCases.put("Hello World!;", new SerialTestCase("timeout", ";", 1, new String[]{"Hello World!;"}));
}
Aggregations