karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject [karaf] branch master updated: [KARAF-5917]EventLoggerTest is broken for some timezones.
Date Mon, 17 Sep 2018 02:59:54 GMT
This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 37c9328  [KARAF-5917]EventLoggerTest is broken for some timezones.
37c9328 is described below

commit 37c9328bc99cf96f95ff56d3899a640751c30583
Author: Freeman Fang <freeman.fang@gmail.com>
AuthorDate: Mon Sep 17 10:59:45 2018 +0800

    [KARAF-5917]EventLoggerTest is broken for some timezones.
---
 .../java/org/apache/karaf/audit/logger/EventLoggerTest.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/audit/src/test/java/org/apache/karaf/audit/logger/EventLoggerTest.java b/audit/src/test/java/org/apache/karaf/audit/logger/EventLoggerTest.java
index dee4129..a36da25 100644
--- a/audit/src/test/java/org/apache/karaf/audit/logger/EventLoggerTest.java
+++ b/audit/src/test/java/org/apache/karaf/audit/logger/EventLoggerTest.java
@@ -35,6 +35,8 @@ import java.net.Socket;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -216,9 +218,10 @@ public class EventLoggerTest {
         Path path = Files.createTempDirectory("file-logger");
         String file = path.resolve("file.log").toString();
         EventLogger logger = new FileEventLogger(file, "UTF-8", "size(10)", 2, false, Executors.defaultThreadFactory(),
layout);
-
         for (int i = 0; i < 10; i++) {
-            logger.write(new MapEvent(map, 1510902000000L + TimeUnit.HOURS.toMillis(i)));
+            logger.write(new MapEvent(map, Timestamp.valueOf(
+                                           LocalDateTime.of(2017, 11, 17, 7, 0)).getTime()

+                                           + TimeUnit.HOURS.toMillis(i)));
         }
         logger.close();
 
@@ -243,7 +246,9 @@ public class EventLoggerTest {
         EventLogger logger = new FileEventLogger(file, "UTF-8", "size(10)", 2, true, Executors.defaultThreadFactory(),
layout);
 
         for (int i = 0; i < 10; i++) {
-            logger.write(new MapEvent(map, 1510902000000L + TimeUnit.HOURS.toMillis(i)));
+            logger.write(new MapEvent(map, Timestamp.valueOf(
+                                           LocalDateTime.of(2017, 11, 17, 7, 0)).getTime()

+                                           + TimeUnit.HOURS.toMillis(i)));
         }
         logger.close();
 


Mime
View raw message