/hg/icedtea-web: Fixed CreatePluginHeaderTestOk to use default T...

aazores at icedtea.classpath.org aazores at icedtea.classpath.org
Wed Jun 4 19:19:11 UTC 2014


changeset 5216f615240c in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=5216f615240c
author: Lukasz Dracz <ldracz at redhat.com>
date: Wed Jun 04 15:18:50 2014 -0400

	Fixed CreatePluginHeaderTestOk to use default TimeZone, not hardcoded CET

	2014-06-04  Lukasz Dracz  <ldracz at redhat.com>

		Fixed Time Zone difference failure in unit test CreatePluginHeaderTestOk
		* unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java:
		Test suite would check for the time in CET against the user's time value
		converted into their local timezone. Created a Date variable that
		ensures time passed into PluginMessage and the one being checked are
		of the same time zone.


diffstat:

 ChangeLog                                                              |   9 ++++
 tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java |  21 +++++----
 2 files changed, 21 insertions(+), 9 deletions(-)

diffs (70 lines):

diff -r d9ff050f08bb -r 5216f615240c ChangeLog
--- a/ChangeLog	Tue Jun 03 17:21:11 2014 -0400
+++ b/ChangeLog	Wed Jun 04 15:18:50 2014 -0400
@@ -1,3 +1,12 @@
+2014-06-04  Lukasz Dracz  <ldracz at redhat.com>
+
+	Fixed Time Zone difference failure in unit test CreatePluginHeaderTestOk
+	* unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java:
+	Test suite would check for the time in CET against the user's time value
+	converted into their local timezone. Created a Date variable that 
+	ensures time passed into PluginMessage and the one being checked are
+	of the same time zone.
+
 2014-06-03  Andrew Azores  <aazores at redhat.com>
 
 	Added indicator method for if PolicyEditor is currently performing file
diff -r d9ff050f08bb -r 5216f615240c tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java	Tue Jun 03 17:21:11 2014 -0400
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/logging/JavaConsoleTest.java	Wed Jun 04 15:18:50 2014 -0400
@@ -6,30 +6,33 @@
 package net.sourceforge.jnlp.util.logging;
 
 import java.util.Date;
+import java.util.TimeZone;
+
 import net.sourceforge.jnlp.util.logging.headers.PluginMessage;
+
 import org.junit.Assert;
 import org.junit.Test;
 
 
 public class JavaConsoleTest {
 
-
-     String s1 = "plugindebug 1384850630162925 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19 09:43:50 CET 2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1204] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0:   PIPE: plugin read: plugin PluginProxyInfo reference 1 http://www.walter-fendt.de:80";
-     String s2 = "plugindebugX 1384850630162954 [jvanek][ITW-Cplugindebug 1384850630163008 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19 09:43:50 CET 2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1124] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: parts[0]=plugin, parts[1]=PluginProxyInfo, reference, parts[3]=1, parts[4]=http://www.walter-fendt.de:80 -- decoded_url=http://www.walter-fendt.de:80";
-     String s3 = "preinit_pluginerror 1384850630163298 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG][Tue Nov 19 09:43:50 CET 2013][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1134] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: Proxy info: plugin PluginProxyInfo reference 1 DIRECT";
+    private static final String TEST_TIME = "Tue Nov 19 09:43:50 "+TimeZone.getDefault().getDisplayName(false, TimeZone.SHORT)+" 2013";
+    private static final String S1 = "plugindebug 1384850630162925 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG]["+TEST_TIME+"][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1204] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0:   PIPE: plugin read: plugin PluginProxyInfo reference 1 http://www.walter-fendt.de:80";
+    private static final String S2 = "plugindebugX 1384850630162954 [jvanek][ITW-Cplugindebug 1384850630163008 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG]["+TEST_TIME+"][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1124] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: parts[0]=plugin, parts[1]=PluginProxyInfo, reference, parts[3]=1, parts[4]=http://www.walter-fendt.de:80 -- decoded_url=http://www.walter-fendt.de:80";
+    private static final String S3 = "preinit_pluginerror 1384850630163298 [jvanek][ITW-C-PLUGIN][MESSAGE_DEBUG]["+TEST_TIME+"][/home/jvanek/Desktop/icedtea-web/plugin/icedteanp/IcedTeaNPPlugin.cc:1134] ITNPP Thread# 140513434003264, gthread 0x7fcbd531f8c0: Proxy info: plugin PluginProxyInfo reference 1 DIRECT";
 
     @Test
     public void CreatePluginHeaderTestOK() throws Exception{
-        PluginMessage p1 = new PluginMessage(s1);
-        PluginMessage p3 = new PluginMessage(s3);
+        PluginMessage p1 = new PluginMessage(S1);
+        PluginMessage p3 = new PluginMessage(S3);
         Assert.assertFalse(p1.wasError);
         Assert.assertFalse(p3.wasError);
         Assert.assertTrue(p1.header.isC);
         Assert.assertTrue(p3.header.isC);
         Assert.assertEquals(OutputController.Level.MESSAGE_DEBUG,p1.header.level);
         Assert.assertEquals(OutputController.Level.ERROR_ALL,p3.header.level);
-        Assert.assertTrue(p1.header.date.toString().contains("Tue Nov 19 09:43:50") && p1.header.date.toString().contains("2013"));
-        Assert.assertTrue(p3.header.date.toString().contains("Tue Nov 19 09:43:50") && p3.header.date.toString().contains("2013"));
+        Assert.assertTrue(p1.header.date.toString().contains(TEST_TIME) && p1.header.date.toString().contains("2013"));
+        Assert.assertTrue(p3.header.date.toString().contains(TEST_TIME) && p3.header.date.toString().contains("2013"));
         Assert.assertTrue(p1.header.caller.contains("/home/jvanek"));
         Assert.assertTrue(p3.header.caller.contains("/home/jvanek"));
         Assert.assertTrue(p1.header.user.equals("jvanek"));
@@ -44,7 +47,7 @@
     }
     @Test
     public void CreatePluginHeaderTestNotOK()throws Exception{
-        PluginMessage p2 = new PluginMessage(s2);
+        PluginMessage p2 = new PluginMessage(S2);
         Assert.assertTrue(p2.wasError);
         Assert.assertTrue(p2.header.isC);
         Assert.assertEquals(OutputController.Level.WARNING_ALL,p2.header.level);


More information about the distro-pkg-dev mailing list