Java Code Examples for java.time.LocalTime#ofInstant()
The following examples show how to use
java.time.LocalTime#ofInstant() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JSONTest.java From core-ng-project with Apache License 2.0 | 5 votes |
@Test void dateField() { var bean = new TestBean(); bean.instantField = Instant.now(); bean.dateTimeField = LocalDateTime.ofInstant(bean.instantField, ZoneId.systemDefault()); bean.dateField = bean.dateTimeField.toLocalDate(); bean.zonedDateTimeField = ZonedDateTime.ofInstant(bean.instantField, ZoneId.systemDefault()); bean.timeField = LocalTime.ofInstant(bean.instantField, ZoneId.systemDefault()); String json = JSON.toJSON(bean); TestBean parsedBean = JSON.fromJSON(TestBean.class, json); assertThat(parsedBean).usingRecursiveComparison() .withComparatorForType(ChronoZonedDateTime.timeLineOrder(), ZonedDateTime.class) .isEqualTo(bean); }
Example 2
Source File: TCKLocalTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider="instantFactory") public void factory_ofInstant(Instant instant, ZoneId zone, LocalTime expected) { LocalTime test = LocalTime.ofInstant(instant, zone); assertEquals(test, expected); }
Example 3
Source File: TCKLocalTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void factory_ofInstant_nullInstant() { LocalTime.ofInstant((Instant) null, ZONE_PARIS); }
Example 4
Source File: TCKLocalTime.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions=NullPointerException.class) public void factory_ofInstant_nullZone() { LocalTime.ofInstant(Instant.EPOCH, (ZoneId) null); }
Example 5
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testDailyReportWithSinglePointIsTriggeredAndNullName() throws Exception { String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream}, 1, new int[] {0} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(1)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, null, new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE_PER_PIN, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(2); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 5000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily Report is ready"), eq(downloadUrl), eq("Report name: Report<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); String resultCsvString = readStringFromFirstZipEntry(result); String[] split = resultCsvString.split("[,\n]"); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); assertEquals(nowFormatted, split[0]); assertEquals(1.11D, Double.parseDouble(split[1]), 0.0001); AsyncHttpClient httpclient = new DefaultAsyncHttpClient( new DefaultAsyncHttpClientConfig.Builder() .setUserAgent(null) .setKeepAlive(true) .build() ); Future<Response> f = httpclient.prepareGet(downloadUrl).execute(); Response response = f.get(); assertEquals(200, response.getStatusCode()); assertEquals("application/zip", response.getContentType()); httpclient.close(); }
Example 6
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testDailyReportWith24PointsCorrectlyFetched() throws Exception { String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.HOURLY)); long pointNow = System.currentTimeMillis(); long pointNowTruncated = (pointNow / GraphGranularityType.HOURLY.period) * GraphGranularityType.HOURLY.period; pointNowTruncated -= TimeUnit.DAYS.toMillis(1); for (int i = 0; i < 24; i++) { FileUtils.write(pinReportingDataPath10, i, pointNowTruncated + TimeUnit.HOURS.toMillis(i)); } ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream}, 1, new int[] {0} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(1)); //a bit upfront long now = pointNow + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.HOURLY, true, CSV_FILE_PER_DEVICE_PER_PIN, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(2); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3500); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); String resultCsvString = readStringFromFirstZipEntry(result); String[] split = resultCsvString.split("\n"); assertEquals(24, split.length); }
Example 7
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDevicePerPin() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath20, 1.11D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature,yes", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE_PER_PIN, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("MyDevice_0_Temperatureyes.csv", entry.getName()); ZipEntry entry2 = entries.nextElement(); assertNotNull(entry2); assertEquals("MyDevice2withbig_2_Temperatureyes.csv", entry2.getName()); }
Example 8
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDevice() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath20, 1.11D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, null, true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("MyDevice_0.csv", entry.getName()); ZipEntry entry2 = entries.nextElement(); assertNotNull(entry2); assertEquals("MyDevice2withbig_2.csv", entry2.getName()); String resultCsvString = readStringFromFirstZipEntry(result); assertNotNull(resultCsvString); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); assertEquals(resultCsvString, nowFormatted + ",v1,1.11\n"); }
Example 9
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDeviceUtf8() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath20, 1.11D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Мій датастрім", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("MyDevice_0.csv", entry.getName()); ZipEntry entry2 = entries.nextElement(); assertNotNull(entry2); assertEquals("MyDevice2withbig_2.csv", entry2.getName()); String resultCsvString = readStringFromFirstZipEntry(result); assertNotNull(resultCsvString); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); assertEquals(nowFormatted + ",Мій датастрім,1.11\n", resultCsvString); }
Example 10
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDevice2() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); FileUtils.write(pinReportingDataPath20, 1.12D, pointNow); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, null, true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, null, true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("MyDevice_0.csv", entry.getName()); ZipEntry entry2 = entries.nextElement(); assertNotNull(entry2); assertEquals("MyDevice2withbig_2.csv", entry2.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(resultCsvString, nowFormatted + ",v1,1.11\n" + nowFormatted + ",v2,1.12\n"); String resultCsvString2 = readStringFromZipEntry(zipFile, entry2); assertNotNull(resultCsvString2); assertEquals(resultCsvString2, nowFormatted + ",v1,1.13\n" + nowFormatted + ",v2,1.14\n"); }
Example 11
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDeviceUnicode() throws Exception { Device device1 = new Device(2, "Мій девайс", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } long pointNow = System.currentTimeMillis(); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, null, true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, null, true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 3000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("Мійдевайс_2.csv", entry.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(nowFormatted + ",v1,1.13\n" + nowFormatted + ",v2,1.14\n", resultCsvString); }
Example 12
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVPerDevice2DataStreamWithName() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); FileUtils.write(pinReportingDataPath20, 1.12D, pointNow); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, "Humidity", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, CSV_FILE_PER_DEVICE, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 2000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("MyDevice_0.csv", entry.getName()); ZipEntry entry2 = entries.nextElement(); assertNotNull(entry2); assertEquals("MyDevice2withbig_2.csv", entry2.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(resultCsvString, nowFormatted + ",Temperature,1.11\n" + nowFormatted + ",Humidity,1.12\n"); String resultCsvString2 = readStringFromZipEntry(zipFile, entry2); assertNotNull(resultCsvString2); assertEquals(resultCsvString2, nowFormatted + ",Temperature,1.13\n" + nowFormatted + ",Humidity,1.14\n"); }
Example 13
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVMerged2DataStreamWithName() throws Exception { Device device1 = new Device(2, "My Device2 with big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); FileUtils.write(pinReportingDataPath20, 1.12D, pointNow); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, "Humidity", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, MERGED_CSV, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 2000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("DailyReport.csv", entry.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(resultCsvString, nowFormatted + ",Temperature,My Device,1.11\n" + nowFormatted + ",Humidity,My Device,1.12\n" + nowFormatted + ",Temperature,My Device2 with big name,1.13\n" + nowFormatted + ",Humidity,My Device2 with big name,1.14\n"); }
Example 14
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVMerged2DataStreamWithNameCorrectEscaping() throws Exception { Device device1 = new Device(2, "My Device2 with \"big\" name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); FileUtils.write(pinReportingDataPath20, 1.12D, pointNow); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, "Humidity", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, MERGED_CSV, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 2000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("DailyReport.csv", entry.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(resultCsvString, nowFormatted + ",Temperature,My Device,1.11\n" + nowFormatted + ",Humidity,My Device,1.12\n" + nowFormatted + ",Temperature,\"My Device2 with \"\"big\"\" name\",1.13\n" + nowFormatted + ",Humidity,\"My Device2 with \"\"big\"\" name\",1.14\n"); }
Example 15
Source File: ReportingTest.java From blynk-server with GNU General Public License v3.0 | 4 votes |
@Test public void testFinalFileNameCSVMerged2DataStreamWithNameCorrectEscaping2() throws Exception { Device device1 = new Device(2, "My Device2 with, big name", BoardType.ESP8266); clientPair.appClient.createDevice(1, device1); String tempDir = holder.props.getProperty("data.folder"); Path userReportFolder = Paths.get(tempDir, "data", getUserName()); if (Files.notExists(userReportFolder)) { Files.createDirectories(userReportFolder); } Path pinReportingDataPath10 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath20 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 0, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); long pointNow = System.currentTimeMillis(); FileUtils.write(pinReportingDataPath10, 1.11D, pointNow); FileUtils.write(pinReportingDataPath20, 1.12D, pointNow); Path pinReportingDataPath12 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 1, GraphGranularityType.MINUTE)); Path pinReportingDataPath22 = Paths.get(tempDir, "data", getUserName(), ReportingDiskDao.generateFilename(1, 2, PinType.VIRTUAL, (short) 2, GraphGranularityType.MINUTE)); FileUtils.write(pinReportingDataPath12, 1.13D, pointNow); FileUtils.write(pinReportingDataPath22, 1.14D, pointNow); ReportDataStream reportDataStream = new ReportDataStream((short) 1, PinType.VIRTUAL, "Temperature", true); ReportDataStream reportDataStream2 = new ReportDataStream((short) 2, PinType.VIRTUAL, "Humidity", true); ReportSource reportSource = new TileTemplateReportSource( new ReportDataStream[] {reportDataStream, reportDataStream2}, 1, new int[] {0, 2} ); ReportingWidget reportingWidget = new ReportingWidget(); reportingWidget.height = 1; reportingWidget.width = 1; reportingWidget.reportSources = new ReportSource[] { reportSource }; clientPair.appClient.createWidget(1, reportingWidget); clientPair.appClient.verifyResult(ok(2)); //a bit upfront long now = System.currentTimeMillis() + 1000; LocalTime localTime = LocalTime.ofInstant(Instant.ofEpochMilli(now), ZoneId.of("UTC")); localTime = LocalTime.of(localTime.getHour(), localTime.getMinute()); Report report = new Report(1, "DailyReport", new ReportSource[] {reportSource}, new DailyReport(now, ReportDurationType.INFINITE, 0, 0), "[email protected]", GraphGranularityType.MINUTE, true, MERGED_CSV, Format.ISO_SIMPLE, ZoneId.of("UTC"), 0, 0, null); clientPair.appClient.createReport(1, report); report = clientPair.appClient.parseReportFromResponse(3); assertNotNull(report); assertEquals(System.currentTimeMillis(), report.nextReportAt, 5000); String date = LocalDate.now(report.tzName).toString(); String filename = getUserName() + "_Blynk_" + report.id + "_" + date + ".zip"; String downloadUrl = "http://127.0.0.1:18080/" + filename; verify(holder.mailWrapper, timeout(3000)).sendReportEmail(eq("[email protected]"), eq("Your daily DailyReport is ready"), eq(downloadUrl), eq("Report name: DailyReport<br>Period: Daily, at " + localTime)); sleep(200); assertEquals(1, holder.reportScheduler.getCompletedTaskCount()); assertEquals(2, holder.reportScheduler.getTaskCount()); Path result = Paths.get(FileUtils.CSV_DIR, getUserName() + "_" + AppNameUtil.BLYNK + "_" + report.id + "_" + date + ".zip"); assertTrue(Files.exists(result)); ZipFile zipFile = new ZipFile(result.toString()); Enumeration<? extends ZipEntry> entries = zipFile.entries(); assertTrue(entries.hasMoreElements()); ZipEntry entry = entries.nextElement(); assertNotNull(entry); assertEquals("DailyReport.csv", entry.getName()); String nowFormatted = DateTimeFormatter .ofPattern(Format.ISO_SIMPLE.pattern) .withZone(ZoneId.of("UTC")) .format(Instant.ofEpochMilli(pointNow)); String resultCsvString = readStringFromZipEntry(zipFile, entry); assertNotNull(resultCsvString); assertEquals(resultCsvString, nowFormatted + ",Temperature,My Device,1.11\n" + nowFormatted + ",Humidity,My Device,1.12\n" + nowFormatted + ",Temperature,\"My Device2 with, big name\",1.13\n" + nowFormatted + ",Humidity,\"My Device2 with, big name\",1.14\n"); }
Example 16
Source File: DateConverters.java From Java-Coding-Problems with MIT License | 2 votes |
public static LocalTime dateToLocalTime(Date date) { return LocalTime.ofInstant(dateToInstant(date), DEFAULT_TIME_ZONE); }