changeset 1161:70a2fa4989be

Fixed third party tests. * netx/net/sourceforge/jnlp/resources/Messages.properties: (JREversionDontMatch) don't changed to does not. The aposthrophe was causing last variable to not expanding. * netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java: shared string moved to constant of MANIFEST_CHECK_DISABLED_MESSAGE * tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java: adapted to current state * tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java: same
author Jiri Vanek <jvanek@redhat.com>
date Fri, 27 Feb 2015 14:59:53 +0100
parents b053e7638d7f
children 5efce17cc54c
files ChangeLog netx/net/sourceforge/jnlp/resources/Messages.properties netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java
diffstat 5 files changed, 76 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Feb 25 15:40:44 2015 +0100
+++ b/ChangeLog	Fri Feb 27 14:59:53 2015 +0100
@@ -1,3 +1,14 @@
+2015-02-27  Jiri Vanek  <jvanek@redhat.com>
+
+	Fixed third party tests.
+	* netx/net/sourceforge/jnlp/resources/Messages.properties: (JREversionDontMatch)
+	don't changed to does not. The aposthrophe was causing last variable to not expanding.
+	* netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java: shared
+	string moved to constant of MANIFEST_CHECK_DISABLED_MESSAGE
+	* tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java:
+	adapted to current state
+	* tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java: same
+
 2015-02-25  Jiri Vanek  <jvanek@redhat.com>
 
 	* Makefile.am: netx-dist-tests-whitelist mad mandatory and will be removed
--- a/netx/net/sourceforge/jnlp/resources/Messages.properties	Wed Feb 25 15:40:44 2015 +0100
+++ b/netx/net/sourceforge/jnlp/resources/Messages.properties	Fri Feb 27 14:59:53 2015 +0100
@@ -55,7 +55,7 @@
 AboutDialogueTabGPLv2=GPLv2
 
 # version check minidialogue
-JREversionDontMatch=Warning - your JRE - {0} - don't match requested JRE - {1}
+JREversionDontMatch=Warning - your JRE - {0} - does not match requested JRE - {1}
 JREContinueDialogSentence2=Do you wont to continue in running?
 JREContinueDialogSentenceTitle=Incompatible JRE
 
--- a/netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java	Wed Feb 25 15:40:44 2015 +0100
+++ b/netx/net/sourceforge/jnlp/runtime/ManifestAttributesChecker.java	Fri Feb 27 14:59:53 2015 +0100
@@ -65,6 +65,7 @@
     private final JNLPFile file;
     private final SigningState signing;
     private final SecurityDelegate securityDelegate;
+    public static final String MANIFEST_CHECK_DISABLED_MESSAGE = "Manifest attribute checks are disabled.";
 
     public ManifestAttributesChecker(final SecurityDesc security, final JNLPFile file,
             final SigningState signing, final SecurityDelegate securityDelegate) throws LaunchException {
@@ -82,7 +83,7 @@
             checkPermissionsAttribute();
             checkApplicationLibraryAllowableCodebaseAttribute();
         } else {
-            OutputController.getLogger().log(OutputController.Level.WARNING_ALL, "Manifest attribute checks are disabled.");
+            OutputController.getLogger().log(OutputController.Level.WARNING_ALL, MANIFEST_CHECK_DISABLED_MESSAGE);
         }
     }
 
--- a/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java	Wed Feb 25 15:40:44 2015 +0100
+++ b/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java	Fri Feb 27 14:59:53 2015 +0100
@@ -37,8 +37,12 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 import net.sourceforge.jnlp.JNLPFile;
 import net.sourceforge.jnlp.ProcessResult;
+import net.sourceforge.jnlp.runtime.ManifestAttributesChecker;
+import net.sourceforge.jnlp.runtime.Translator;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -65,6 +69,8 @@
         public URL getUrl();
 
         public void evaluate(ProcessResult pr);
+        
+        public List<String> modifyParams(List<String> global);
     }
 
     public static abstract class StringBasedURL implements RemoteApplicationTestcaseSettings {
@@ -72,7 +78,11 @@
         URL u;
 
         public String clean(String s){
-            return s.replaceAll("\\s*" + JNLPFile.TITLE_NOT_FOUND + "\\s*", "").trim();
+            s = s.replace(ManifestAttributesChecker.MANIFEST_CHECK_DISABLED_MESSAGE,"");
+            s = s.replace(JNLPFile.TITLE_NOT_FOUND, "");
+            s = s.replaceAll("Fontconfig warning.*", "");
+            return  s.replaceAll("\\s*" + JNLPFile.TITLE_NOT_FOUND + "\\s*", "").trim();
+            
         }
         @Override
         public URL getUrl() {
@@ -82,6 +92,13 @@
         public StringBasedURL(String r) {
             this.u = createCatchedUrl(r);
         }
+
+        @Override
+        public List<String> modifyParams(List<String> global) {
+            return global;
+        }
+        
+        
     }
 
     public static class FourierTransform extends StringBasedURL {
@@ -110,6 +127,14 @@
             Assert.assertTrue(clean(pr.stderr).length() == 0 || pr.stderr.contains("Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed"));
 
         }
+
+        @Override
+        public List<String> modifyParams(List<String> global) {
+            List l = new ArrayList(global);
+            l.add("-J-Dhttps.protocols=TLSv1,SSLv3,SSLv2Hello");
+            return l;
+        }
+        
     }
 
     public static class GnattProject extends StringBasedURL {
@@ -135,8 +160,9 @@
 
         @Override
         public void evaluate(ProcessResult pr) {
-            Assert.assertTrue(pr.stdout.length() == 0);
-            Assert.assertTrue(pr.stderr.length() == 0);
+            //some debug coords are appearing
+            Assert.assertTrue(pr.stdout.toLowerCase().contains("geogebra"));
+            Assert.assertFalse(pr.stderr.toLowerCase().contains("exception"));
 
         }
     }
@@ -168,8 +194,37 @@
 
         }
     }
+     
+     public abstract static class NearlyNoOutputsOnWrongJRE extends NearlyNoOutputs {
 
-    public static class Arbores extends NearlyNoOutputs {
+        public NearlyNoOutputsOnWrongJRE(String r) {
+            super(r);
+        }
+
+        
+        
+        @Override
+        public void evaluate(ProcessResult pr) {
+            Assert.assertTrue(stdoutEmpty, removeJreVersionWarning(clean(pr.stdout)).length() == 0);
+            Assert.assertTrue(stderrEmpty, removeJreVersionWarning(clean(pr.stderr)).length() == 0);
+
+        }
+
+    }
+
+    private static final String pattern = ".*" + Translator.R("JREversionDontMatch", ".*", ".*") + ".*";
+     
+
+    private static String removeJreVersionWarning(String clean) {
+        return clean.replaceAll(pattern, "");
+    }
+
+     @Test
+     public void testJREversionDontMatchRemoval(){
+         Assert.assertTrue(removeJreVersionWarning("Warning - your JRE - 1.8 - do not match requested JRE - {0}").isEmpty());
+     }
+
+    public static class Arbores extends NearlyNoOutputsOnWrongJRE {
 
         public Arbores() {
             super("http://www.arbores.ca/AnnuityCalc.jnlp");
@@ -197,7 +252,7 @@
         }
     }
 
-    public static class ArboresDeposit extends NearlyNoOutputs {
+    public static class ArboresDeposit extends NearlyNoOutputsOnWrongJRE {
 
         public ArboresDeposit() throws MalformedURLException {
             super("http://www.arbores.ca/Deposit.jnlp");
--- a/tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java	Wed Feb 25 15:40:44 2015 +0100
+++ b/tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java	Fri Feb 27 14:59:53 2015 +0100
@@ -1,4 +1,4 @@
-/* RemoteApplicationTests.java
+/* 
  Copyright (C) 2011 Red Hat, Inc.
 
  This file is part of IcedTea.
@@ -40,7 +40,6 @@
 import java.util.List;
 import net.sourceforge.jnlp.ProcessResult;
 import net.sourceforge.jnlp.ServerAccess;
-import net.sourceforge.jnlp.annotations.KnownToFail;
 import net.sourceforge.jnlp.annotations.NeedsDisplay;
 import net.sourceforge.jnlp.annotations.Remote;
 import org.junit.Test;
@@ -106,7 +105,7 @@
     @NeedsDisplay
     public void orawebCernChRemoteTest() throws Exception {
         RemoteApplicationSettings.RemoteApplicationTestcaseSettings settings = new RemoteApplicationSettings.OrawebCernCh();
-        ProcessResult pr = server.executeJavawsUponUrl(ll, settings.getUrl());
+        ProcessResult pr = server.executeJavawsUponUrl(settings.modifyParams(ll), settings.getUrl());
         settings.evaluate(pr);
     }