Mercurial > hg > release > icedtea-web-1.6
changeset 1186:d1b6ca2e899a
* tests/reproducers/custom/TrustedOnlyAttribute/testcases/TrustedOnlyAttributeTest.java: added BeforeClass and AfterClass hunks which adapt USER_DEPLOYMENT_FILE for test's needs.
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Fri, 27 Mar 2015 13:49:10 +0100 |
parents | dedecb2fff07 |
children | b7b28ec53a8b |
files | ChangeLog tests/reproducers/custom/TrustedOnlyAttribute/testcases/TrustedOnlyAttributeTest.java |
diffstat | 2 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Mar 27 13:43:46 2015 +0100 +++ b/ChangeLog Fri Mar 27 13:49:10 2015 +0100 @@ -1,3 +1,9 @@ +2015-03-25 Lukasz Dracz <ldracz@redhat.com> + + * tests/reproducers/custom/TrustedOnlyAttribute/testcases/TrustedOnlyAttributeTest.java: + added BeforeClass and AfterClass hunks which adapt USER_DEPLOYMENT_FILE for + test's needs. + 2015-03-27 Jiri Vanek <jvanek@redhat.com> * Makefile.am: (stamps/generate-docs.stamp) fixed redundant false in version
--- a/tests/reproducers/custom/TrustedOnlyAttribute/testcases/TrustedOnlyAttributeTest.java Fri Mar 27 13:43:46 2015 +0100 +++ b/tests/reproducers/custom/TrustedOnlyAttribute/testcases/TrustedOnlyAttributeTest.java Fri Mar 27 13:49:10 2015 +0100 @@ -45,15 +45,55 @@ import net.sourceforge.jnlp.browsertesting.Browsers; import net.sourceforge.jnlp.closinglisteners.AutoOkClosingListener; +import net.sourceforge.jnlp.config.PathsAndFiles; +import net.sourceforge.jnlp.util.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import java.io.File; +import java.io.IOException; + public class TrustedOnlyAttributeTest extends BrowserTest { private static final String RUNNING_STRING = "TrustedOnlyAttribute applet running"; private static final String CLOSE_STRING = AutoOkClosingListener.MAGICAL_OK_CLOSING_STRING; + private static File deployFile; + private static String attributesCheck; + + @BeforeClass + public static void setupDeploymentProperties() throws IOException { + deployFile = PathsAndFiles.USER_DEPLOYMENT_FILE.getFile(); + String properties = FileUtils.loadFileAsString(deployFile); + + for (String line : properties.split("\n")) { + if (line.contains("deployment.manifest.attribute.check")) { + attributesCheck = line; + properties = properties.replace(line, "deployment.manifest.attributes.check=TRUSTED\n"); + } + } + if (attributesCheck == null) { + properties += "deployment.manifest.attributes.check=TRUSTED\n"; + } + + FileUtils.saveFile(properties, deployFile); + } + + @AfterClass + public static void setbackDeploymentProperties() throws IOException { + String properties = FileUtils.loadFileAsString(deployFile); + if (attributesCheck != null) { + properties = properties.replace("deployment.manifest.attributes.check=TRUSTED\n", attributesCheck); + } else { + properties = properties.replace("deployment.manifest.attributes.check=TRUSTED\n", ""); + } + + FileUtils.saveFile(properties, deployFile); + } + @NeedsDisplay @Test @TestInBrowsers(testIn={Browsers.one})