@Test public void tc003_t1_t2_before_available_data() { long t1 = TestUtils.stringToDate(dateFormat, fileDate0 + " 00:00:00").getTime(); long t2 = TestUtils.stringToDate(dateFormat, fileDate0 + " 00:59:59").getTime(); LogFileReader fr = new LogFileReader(TestUtils.TESTFOLDERPATH, channelTestImpl); List<Record> records = fr.getValues(t1, t2); long expectedRecords = 0; System.out.print(Thread.currentThread().getStackTrace()[1].getMethodName()); boolean result = true; int wrong = 0; int ok = 0; for (int i = 0; records.size() > i; i++) { if (records.get(i).getFlag().equals(Flag.NO_VALUE_RECEIVED_YET)) { ++ok; } else { ++wrong; result = false; } } System.out.print(" records = " + records.size() + " (" + expectedRecords + " expected); "); System.out.println("wrong = " + wrong + ", ok(with Flag 7) = " + ok); assertTrue(result); }
// @Test public void tc007_t1_within_available_data_with_loggingInterval() { boolean result; long t1 = TestUtils.stringToDate(dateFormat, fileDate0 + " 02:59:59").getTime(); // get value looks from 02:59:59 to 3:00:00. before 3:00:00 a value exists LogFileReader fr = new LogFileReader(TestUtils.TESTFOLDERPATH, channelTestImpl); Record record = fr.getValue(t1); if (record != null) { result = true; } else { result = false; } System.out.print(Thread.currentThread().getStackTrace()[1].getMethodName()); System.out.println(" record = " + result); assertTrue(result); }
@Test public void tc006_t1_before_available_data() { long t1 = TestUtils.stringToDate(dateFormat, fileDate0 + " 00:59:00").getTime(); boolean result; LogFileReader fr = new LogFileReader(TestUtils.TESTFOLDERPATH, channelTestImpl); Record record = fr.getValue(t1); if (record == null) { result = true; } else { result = false; } System.out.print(Thread.currentThread().getStackTrace()[1].getMethodName()); System.out.println(" no records = " + result); assertTrue(result); }
@Test public void tc002_t2_after_available_data() { long t1 = TestUtils.stringToDate(dateFormat, fileDate0 + " 01:00:00").getTime(); long t2 = TestUtils.stringToDate(dateFormat, fileDate0 + " 02:00:00").getTime(); LogFileReader fr = new LogFileReader(TestUtils.TESTFOLDERPATH, channelTestImpl); List<Record> records = fr.getValues(t1, t2); long expectedRecords = 361; // boolean result; if (records.size() == expectedRecords) { result = true; } else { result = false; } System.out.print(Thread.currentThread().getStackTrace()[1].getMethodName()); System.out.println(" records = " + records.size() + " (" + expectedRecords + " expected)"); assertTrue(result); }