From d71e609b1279077474135364ed4bb223e068d0bd Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Mon, 2 Jul 2012 15:08:21 +0200 Subject: Refactored reproducers directry structure --- ChangeLog | 53 + Makefile.am | 32 +- tests/jnlp_tests/README | 32 - .../resources/AppletFolderInArchiveTag.html | 42 - .../srcs/AppletFolderInArchiveTag.java | 58 - .../custom/AppletFolderInArchiveTag/srcs/Makefile | 18 - .../testcases/AppletFolderInArchiveTagTests.java | 61 - .../AccessClassInPackageSignedJAVAXJNLP.jnlp | 57 - .../resources/AccessClassInPackageSignedNETSF.jnlp | 57 - .../resources/AccessClassInPackageSignedSELF.jnlp | 57 - .../AccessClassInPackageSignedSUNSEC.jnlp | 57 - .../srcs/AccessClassInPackageSigned.java | 44 - .../resources/AppletTestSigned.html | 46 - .../resources/AppletTestSigned.jnlp | 63 - .../AppletTestSigned/srcs/AppletTestSigned.java | 82 - .../testcases/AppletTestSignedTests.java | 94 -- .../resources/CacheReproducer1.jnlp | 17 - .../resources/CacheReproducer1_1.jnlp | 17 - .../resources/CacheReproducer2.jnlp | 17 - .../resources/CacheReproducer2_1.jnlp | 17 - .../CacheReproducer/srcs/CacheReproducer.java | 47 - .../testcases/CacheReproducerTest.java | 478 ------ ...ssloaderWithDownloadedResource-applet-hack.jnlp | 62 - ...assloaderWithDownloadedResource-applet-new.jnlp | 62 - ...rnalClassloaderWithDownloadedResource-hack.html | 48 - ...rnalClassloaderWithDownloadedResource-hack.jnlp | 57 - ...ernalClassloaderWithDownloadedResource-new.html | 48 - ...ernalClassloaderWithDownloadedResource-new.jnlp | 57 - .../InternalClassloaderWithDownloadedResource.java | 164 -- ...ernalClassloaderWithDownloadedResourceTest.java | 140 -- .../signed/MissingJar/resources/MissingJar.jnlp | 21 - .../signed/MissingJar/resources/MissingJar2.jnlp | 19 - .../signed/MissingJar/resources/MissingJar3.jnlp | 19 - .../signed/MissingJar/resources/MissingJar4.jnlp | 21 - .../signed/MissingJar/srcs/MissingJar.java | 42 - .../MissingJar/testcases/MissingJarTest.java | 84 - .../resources/ReadPropertiesBySignedHack.jnlp | 19 - .../srcs/ReadPropertiesBySignedHack.java | 63 - .../testcases/ReadPropertiesBySignedHackTest.java | 65 - .../resources/ReadPropertiesSigned1.jnlp | 15 - .../resources/ReadPropertiesSigned2.jnlp | 18 - .../srcs/ReadPropertiesSigned.java | 45 - .../testcases/ReadPropertiesSignedTest.java | 91 - .../resources/SignedJnlpApplication1.jnlp | 62 - .../resources/SignedJnlpApplication2.jnlp | 65 - .../resources/SignedJnlpApplication3.jnlp | 61 - .../srcs/JNLP-INF/APPLICATION.jnlp | 62 - .../srcs/SignedJnlpApplication.java | 43 - .../testcases/SignedJnlpApplicationTest.java | 77 - .../resources/SignedJnlpCaseTestOne1.jnlp | 62 - .../resources/SignedJnlpCaseTestOne2.jnlp | 62 - .../srcs/JNLP-INF/aPpLiCaTioN.jnlp | 62 - .../SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java | 43 - .../testcases/SignedJnlpCaseOneTest.java | 65 - .../resources/SignedJnlpCaseTestTwo1.jnlp | 62 - .../resources/SignedJnlpCaseTestTwo2.jnlp | 62 - .../srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp | 62 - .../SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java | 43 - .../testcases/SignedJnlpCaseTwoTest.java | 65 - .../resources/SignedJnlpTemplate1.jnlp | 66 - .../resources/SignedJnlpTemplate2.jnlp | 64 - .../resources/SignedJnlpTemplate3.jnlp | 71 - .../srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp | 62 - .../srcs/SignedJnlpTemplate.java | 43 - .../testcases/SignedJnlpTemplateTest.java | 77 - .../resources/SimpletestSigned1.jnlp | 53 - .../SimpletestSigned1/srcs/SimpletestSigned1.java | 43 - ...05\241\304\215\305\231\305\276 too signed.jnlp" | 61 - .../Spaces can be everywhere1 signed.jnlp | 53 - .../Spaces can be everywhere2 signed.jnlp | 53 - .../resources/SpacesCanBeEverywhere1signed.jnlp | 53 - .../resources/spaces applet Tests signed.html | 42 - .../srcs/SpacesCanBeEverywhereSigned.java | 76 - .../SpacesCanBeEverywhereTestsSigned.java | 245 --- .../resources/AccessClassInPackageJAVAXJNLP.jnlp | 54 - .../resources/AccessClassInPackageNETSF.jnlp | 54 - .../resources/AccessClassInPackageSELF.jnlp | 54 - .../resources/AccessClassInPackageSUNSEC.jnlp | 54 - .../srcs/AccessClassInPackage.java | 44 - .../testcases/AccessClassInPackageTest.java | 168 -- .../AddShutdownHook/resources/AddShutdownHook.jnlp | 13 - .../AddShutdownHook/srcs/AddShutdownHook.java | 48 - .../testcases/AddShutdownHookTest.java | 58 - .../AllStackTraces/resources/AllStackTraces.jnlp | 13 - .../simple/AllStackTraces/srcs/AllStackTraces.java | 42 - .../testcases/AllStackTracesTest.java | 61 - .../resources/AppletBaseURLTest.html | 48 - .../resources/AppletBaseURLTest.jnlp | 58 - .../resources/AppletJNLPHrefBaseURLTest.html | 46 - .../AppletBaseURLTest/srcs/AppletBaseURL.java | 64 - .../testcases/AppletBaseURLTest.java | 89 - .../resources/AppletReadsInvalidJar.html | 42 - .../resources/AppletReadsInvalidJar.jnlp | 62 - .../resources/NOT_A_VALID_JAR.jar | 0 .../simple/AppletReadsInvalidJar/srcs/Valid.java | 58 - .../testcases/AppletReadsInvalidJarTests.java | 69 - .../resources/appletTakesLastParam.html | 44 - .../resources/appletTakesLastParam.jnlp | 63 - .../srcs/AppletTakesLastParam.java | 63 - .../testcases/AppletTakesLastParamTests.java | 68 - .../simple/AppletTest/resources/AppletTest.jnlp | 63 - .../AppletTest/resources/appletAutoTests.html | 44 - .../AppletTest/resources/appletAutoTests2.html | 44 - .../AppletTest/resources/appletViewTest.html | 52 - .../simple/AppletTest/srcs/AppletTest.java | 82 - .../AppletTest/testcases/AppletTestTests.java | 141 -- .../resources/CheckPluginServices.html | 46 - .../CheckServices/resources/CheckServices.jnlp | 57 - .../simple/CheckServices/srcs/CheckServices.java | 109 -- .../testcases/CheckServicesTests.java | 88 - .../resources/CreateClassLoader.jnlp | 13 - .../CreateClassLoader/srcs/CreateClassLoader.java | 46 - .../testcases/CreateClassLoaderTest.java | 58 - .../resources/InformationParser.jnlp | 47 - .../resources/TitleParser.jnlp | 52 - .../resources/TitleVendorParser.jnlp | 51 - .../resources/VendorParser.jnlp | 52 - .../InformationTitleVendorParserTest.java | 77 - .../resources/ManifestedJar-1main2mainAppDesc.jnlp | 53 - .../ManifestedJar-1main2mainNoAppDesc.jnlp | 54 - .../ManifestedJar-1main2nothingNoAppDesc.jnlp | 54 - .../resources/ManifestedJar-1mainHaveAppDesc.jnlp | 54 - .../resources/ManifestedJar-1mainNoAppDesc.jnlp | 53 - .../resources/ManifestedJar-1noAppDesc.jnlp | 52 - .../resources/ManifestedJar-1noAppDescAtAll.jnlp | 49 - .../ManifestedJar-1nothing2nothingAppDesc.jnlp | 54 - .../ManifestedJar-1nothing2nothingNoAppDesc.jnlp | 54 - .../ManifestedJar1/srcs/META-INF/MANIFEST.MF | 3 - .../simple/ManifestedJar1/srcs/ManifestedJar1.java | 45 - .../testcases/ManifestedJar1Test.java | 217 --- .../ManifestedJar2/srcs/META-INF/MANIFEST.MF | 3 - .../simple/ManifestedJar2/srcs/ManifestedJar2.java | 45 - .../ReadEnvironment/resources/ReadEnvironment.jnlp | 13 - .../ReadEnvironment/srcs/ReadEnvironment.java | 44 - .../testcases/ReadEnvironmentTest.java | 58 - .../ReadProperties/resources/ReadProperties1.jnlp | 17 - .../ReadProperties/resources/ReadProperties2.jnlp | 15 - .../simple/ReadProperties/srcs/ReadProperties.java | 45 - .../testcases/ReadPropertiesTest.java | 71 - .../RedirectStreams/resources/RedirectStreams.jnlp | 13 - .../RedirectStreams/srcs/RedirectStreams.java | 44 - .../testcases/RedirectStreamsTest.java | 57 - .../resources/ReplaceSecurityManager.jnlp | 13 - .../srcs/ReplaceSecurityManager.java | 43 - .../testcases/ReplaceSecurityManagerTest.java | 57 - .../resources/SetContextClassLoader.jnlp | 13 - .../srcs/SetContextClassLoader.java | 44 - .../testcases/SetContextClassLoaderTest.java | 57 - ...4\233\305\241\304\215\305\231\305\276 too.jnlp" | 61 - .../resources/Spaces can be everywhere1.jnlp | 53 - .../resources/Spaces can be everywhere2.jnlp | 53 - .../resources/SpacesCanBeEverywhere1.jnlp | 53 - .../resources/spaces applet Tests.html | 42 - .../srcs/SpacesCanBeEverywhere.java | 76 - .../testcases/SpacesCanBeEverywhereTests.java | 244 --- .../resources/UnsignedJnlpApplication1.jnlp | 54 - .../resources/UnsignedJnlpApplication2.jnlp | 56 - .../resources/UnsignedJnlpApplication3.jnlp | 57 - .../srcs/JNLP-INF/APPLICATION.jnlp | 62 - .../srcs/UnsignedJnlpApplication.java | 43 - .../testcases/UnsignedJnlpApplicationTest.java | 68 - .../resources/UnsignedJnlpTemplate1.jnlp | 54 - .../resources/UnsignedJnlpTemplate2.jnlp | 56 - .../resources/UnsignedJnlpTemplate3.jnlp | 57 - .../srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp | 62 - .../srcs/UnsignedJnlpTemplate.java | 43 - .../testcases/UnsignedJnlpTemplateTest.java | 68 - .../deadlocktest/resources/deadlocktest.jnlp | 53 - .../deadlocktest/resources/deadlocktest_1.jnlp | 53 - .../simple/deadlocktest/srcs/DeadlockTest.java | 58 - .../deadlocktest/testcases/DeadLockTestTest.java | 267 --- .../simple/simpletest1/resources/simpletest1.jnlp | 53 - .../resources/simpletestCustomSplash.jnlp | 55 - .../simpletest1/resources/simpletestMegaSlow.jnlp | 53 - .../simpletest1/resources/simpletestSlow.jnlp | 53 - .../simpletestSlowBrokenCustomSplash.jnlp | 54 - .../resources/simpletestSlowSlowCustomSplash.jnlp | 54 - .../simple/simpletest1/srcs/SimpleTest1.java | 43 - .../simpletest1/testcases/SimpleTest1Test.java | 61 - .../simple/simpletest2/resources/simpletest2.jnlp | 53 - .../simple/simpletest2/srcs/SimpleTest2.java | 44 - .../simpletest2/testcases/SimpleTest2Test.java | 62 - .../sourceforge/jnlp/ContentReaderListener.java | 8 - .../net/sourceforge/jnlp/ResourcesTest.java | 389 ----- .../net/sourceforge/jnlp/ServerAccess.java | 1764 -------------------- .../net/sourceforge/jnlp/annotations/Bug.java | 32 - .../sourceforge/jnlp/annotations/KnownToFail.java | 24 - .../sourceforge/jnlp/annotations/NeedsDisplay.java | 18 - .../jnlp/annotations/TestInBrowsers.java | 18 - .../sourceforge/jnlp/browsertesting/Browser.java | 19 - .../jnlp/browsertesting/BrowserFactory.java | 189 --- .../jnlp/browsertesting/BrowserTest.java | 23 - .../jnlp/browsertesting/BrowserTestRunner.java | 148 -- .../sourceforge/jnlp/browsertesting/Browsers.java | 46 - .../jnlp/browsertesting/browsers/Chrome.java | 15 - .../jnlp/browsertesting/browsers/Chromium.java | 15 - .../jnlp/browsertesting/browsers/Epiphany.java | 18 - .../jnlp/browsertesting/browsers/Firefox.java | 29 - .../jnlp/browsertesting/browsers/LinuxBrowser.java | 60 - .../jnlp/browsertesting/browsers/Midory.java | 18 - .../browsers/MozillaFamilyLinuxBrowser.java | 29 - .../jnlp/browsertesting/browsers/Opera.java | 37 - tests/reproducers/README | 32 + .../resources/AppletFolderInArchiveTag.html | 42 + .../srcs/AppletFolderInArchiveTag.java | 58 + .../custom/AppletFolderInArchiveTag/srcs/Makefile | 18 + .../testcases/AppletFolderInArchiveTagTests.java | 61 + .../AccessClassInPackageSignedJAVAXJNLP.jnlp | 57 + .../resources/AccessClassInPackageSignedNETSF.jnlp | 57 + .../resources/AccessClassInPackageSignedSELF.jnlp | 57 + .../AccessClassInPackageSignedSUNSEC.jnlp | 57 + .../srcs/AccessClassInPackageSigned.java | 44 + .../resources/AppletTestSigned.html | 46 + .../resources/AppletTestSigned.jnlp | 63 + .../AppletTestSigned/srcs/AppletTestSigned.java | 82 + .../testcases/AppletTestSignedTests.java | 94 ++ .../resources/CacheReproducer1.jnlp | 17 + .../resources/CacheReproducer1_1.jnlp | 17 + .../resources/CacheReproducer2.jnlp | 17 + .../resources/CacheReproducer2_1.jnlp | 17 + .../CacheReproducer/srcs/CacheReproducer.java | 47 + .../testcases/CacheReproducerTest.java | 478 ++++++ ...ssloaderWithDownloadedResource-applet-hack.jnlp | 62 + ...assloaderWithDownloadedResource-applet-new.jnlp | 62 + ...rnalClassloaderWithDownloadedResource-hack.html | 48 + ...rnalClassloaderWithDownloadedResource-hack.jnlp | 57 + ...ernalClassloaderWithDownloadedResource-new.html | 48 + ...ernalClassloaderWithDownloadedResource-new.jnlp | 57 + .../InternalClassloaderWithDownloadedResource.java | 164 ++ ...ernalClassloaderWithDownloadedResourceTest.java | 140 ++ .../signed/MissingJar/resources/MissingJar.jnlp | 21 + .../signed/MissingJar/resources/MissingJar2.jnlp | 19 + .../signed/MissingJar/resources/MissingJar3.jnlp | 19 + .../signed/MissingJar/resources/MissingJar4.jnlp | 21 + .../signed/MissingJar/srcs/MissingJar.java | 42 + .../MissingJar/testcases/MissingJarTest.java | 84 + .../resources/ReadPropertiesBySignedHack.jnlp | 19 + .../srcs/ReadPropertiesBySignedHack.java | 63 + .../testcases/ReadPropertiesBySignedHackTest.java | 65 + .../resources/ReadPropertiesSigned1.jnlp | 15 + .../resources/ReadPropertiesSigned2.jnlp | 18 + .../srcs/ReadPropertiesSigned.java | 45 + .../testcases/ReadPropertiesSignedTest.java | 91 + .../resources/SignedJnlpApplication1.jnlp | 62 + .../resources/SignedJnlpApplication2.jnlp | 65 + .../resources/SignedJnlpApplication3.jnlp | 61 + .../srcs/JNLP-INF/APPLICATION.jnlp | 62 + .../srcs/SignedJnlpApplication.java | 43 + .../testcases/SignedJnlpApplicationTest.java | 77 + .../resources/SignedJnlpCaseTestOne1.jnlp | 62 + .../resources/SignedJnlpCaseTestOne2.jnlp | 62 + .../srcs/JNLP-INF/aPpLiCaTioN.jnlp | 62 + .../SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java | 43 + .../testcases/SignedJnlpCaseOneTest.java | 65 + .../resources/SignedJnlpCaseTestTwo1.jnlp | 62 + .../resources/SignedJnlpCaseTestTwo2.jnlp | 62 + .../srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp | 62 + .../SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java | 43 + .../testcases/SignedJnlpCaseTwoTest.java | 65 + .../resources/SignedJnlpTemplate1.jnlp | 66 + .../resources/SignedJnlpTemplate2.jnlp | 64 + .../resources/SignedJnlpTemplate3.jnlp | 71 + .../srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp | 62 + .../srcs/SignedJnlpTemplate.java | 43 + .../testcases/SignedJnlpTemplateTest.java | 77 + .../resources/SimpletestSigned1.jnlp | 53 + .../SimpletestSigned1/srcs/SimpletestSigned1.java | 43 + ...05\241\304\215\305\231\305\276 too signed.jnlp" | 61 + .../Spaces can be everywhere1 signed.jnlp | 53 + .../Spaces can be everywhere2 signed.jnlp | 53 + .../resources/SpacesCanBeEverywhere1signed.jnlp | 53 + .../resources/spaces applet Tests signed.html | 42 + .../srcs/SpacesCanBeEverywhereSigned.java | 76 + .../SpacesCanBeEverywhereTestsSigned.java | 245 +++ .../resources/AccessClassInPackageJAVAXJNLP.jnlp | 54 + .../resources/AccessClassInPackageNETSF.jnlp | 54 + .../resources/AccessClassInPackageSELF.jnlp | 54 + .../resources/AccessClassInPackageSUNSEC.jnlp | 54 + .../srcs/AccessClassInPackage.java | 44 + .../testcases/AccessClassInPackageTest.java | 168 ++ .../AddShutdownHook/resources/AddShutdownHook.jnlp | 13 + .../AddShutdownHook/srcs/AddShutdownHook.java | 48 + .../testcases/AddShutdownHookTest.java | 58 + .../AllStackTraces/resources/AllStackTraces.jnlp | 13 + .../simple/AllStackTraces/srcs/AllStackTraces.java | 42 + .../testcases/AllStackTracesTest.java | 61 + .../resources/AppletBaseURLTest.html | 48 + .../resources/AppletBaseURLTest.jnlp | 58 + .../resources/AppletJNLPHrefBaseURLTest.html | 46 + .../AppletBaseURLTest/srcs/AppletBaseURL.java | 64 + .../testcases/AppletBaseURLTest.java | 89 + .../resources/AppletReadsInvalidJar.html | 42 + .../resources/AppletReadsInvalidJar.jnlp | 62 + .../resources/NOT_A_VALID_JAR.jar | 0 .../simple/AppletReadsInvalidJar/srcs/Valid.java | 58 + .../testcases/AppletReadsInvalidJarTests.java | 69 + .../resources/appletTakesLastParam.html | 44 + .../resources/appletTakesLastParam.jnlp | 63 + .../srcs/AppletTakesLastParam.java | 63 + .../testcases/AppletTakesLastParamTests.java | 68 + .../simple/AppletTest/resources/AppletTest.jnlp | 63 + .../AppletTest/resources/appletAutoTests.html | 44 + .../AppletTest/resources/appletAutoTests2.html | 44 + .../AppletTest/resources/appletViewTest.html | 52 + .../simple/AppletTest/srcs/AppletTest.java | 82 + .../AppletTest/testcases/AppletTestTests.java | 141 ++ .../resources/CheckPluginServices.html | 46 + .../CheckServices/resources/CheckServices.jnlp | 57 + .../simple/CheckServices/srcs/CheckServices.java | 109 ++ .../testcases/CheckServicesTests.java | 88 + .../resources/CreateClassLoader.jnlp | 13 + .../CreateClassLoader/srcs/CreateClassLoader.java | 46 + .../testcases/CreateClassLoaderTest.java | 58 + .../resources/InformationParser.jnlp | 47 + .../resources/TitleParser.jnlp | 52 + .../resources/TitleVendorParser.jnlp | 51 + .../resources/VendorParser.jnlp | 52 + .../InformationTitleVendorParserTest.java | 77 + .../resources/ManifestedJar-1main2mainAppDesc.jnlp | 53 + .../ManifestedJar-1main2mainNoAppDesc.jnlp | 54 + .../ManifestedJar-1main2nothingNoAppDesc.jnlp | 54 + .../resources/ManifestedJar-1mainHaveAppDesc.jnlp | 54 + .../resources/ManifestedJar-1mainNoAppDesc.jnlp | 53 + .../resources/ManifestedJar-1noAppDesc.jnlp | 52 + .../resources/ManifestedJar-1noAppDescAtAll.jnlp | 49 + .../ManifestedJar-1nothing2nothingAppDesc.jnlp | 54 + .../ManifestedJar-1nothing2nothingNoAppDesc.jnlp | 54 + .../ManifestedJar1/srcs/META-INF/MANIFEST.MF | 3 + .../simple/ManifestedJar1/srcs/ManifestedJar1.java | 45 + .../testcases/ManifestedJar1Test.java | 217 +++ .../ManifestedJar2/srcs/META-INF/MANIFEST.MF | 3 + .../simple/ManifestedJar2/srcs/ManifestedJar2.java | 45 + .../ReadEnvironment/resources/ReadEnvironment.jnlp | 13 + .../ReadEnvironment/srcs/ReadEnvironment.java | 44 + .../testcases/ReadEnvironmentTest.java | 58 + .../ReadProperties/resources/ReadProperties1.jnlp | 17 + .../ReadProperties/resources/ReadProperties2.jnlp | 15 + .../simple/ReadProperties/srcs/ReadProperties.java | 45 + .../testcases/ReadPropertiesTest.java | 71 + .../RedirectStreams/resources/RedirectStreams.jnlp | 13 + .../RedirectStreams/srcs/RedirectStreams.java | 44 + .../testcases/RedirectStreamsTest.java | 57 + .../resources/ReplaceSecurityManager.jnlp | 13 + .../srcs/ReplaceSecurityManager.java | 43 + .../testcases/ReplaceSecurityManagerTest.java | 57 + .../resources/SetContextClassLoader.jnlp | 13 + .../srcs/SetContextClassLoader.java | 44 + .../testcases/SetContextClassLoaderTest.java | 57 + ...4\233\305\241\304\215\305\231\305\276 too.jnlp" | 61 + .../resources/Spaces can be everywhere1.jnlp | 53 + .../resources/Spaces can be everywhere2.jnlp | 53 + .../resources/SpacesCanBeEverywhere1.jnlp | 53 + .../resources/spaces applet Tests.html | 42 + .../srcs/SpacesCanBeEverywhere.java | 76 + .../testcases/SpacesCanBeEverywhereTests.java | 244 +++ .../resources/UnsignedJnlpApplication1.jnlp | 54 + .../resources/UnsignedJnlpApplication2.jnlp | 56 + .../resources/UnsignedJnlpApplication3.jnlp | 57 + .../srcs/JNLP-INF/APPLICATION.jnlp | 62 + .../srcs/UnsignedJnlpApplication.java | 43 + .../testcases/UnsignedJnlpApplicationTest.java | 68 + .../resources/UnsignedJnlpTemplate1.jnlp | 54 + .../resources/UnsignedJnlpTemplate2.jnlp | 56 + .../resources/UnsignedJnlpTemplate3.jnlp | 57 + .../srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp | 62 + .../srcs/UnsignedJnlpTemplate.java | 43 + .../testcases/UnsignedJnlpTemplateTest.java | 68 + .../deadlocktest/resources/deadlocktest.jnlp | 53 + .../deadlocktest/resources/deadlocktest_1.jnlp | 53 + .../simple/deadlocktest/srcs/DeadlockTest.java | 58 + .../deadlocktest/testcases/DeadLockTestTest.java | 267 +++ .../simple/simpletest1/resources/simpletest1.jnlp | 53 + .../resources/simpletestCustomSplash.jnlp | 55 + .../simpletest1/resources/simpletestMegaSlow.jnlp | 53 + .../simpletest1/resources/simpletestSlow.jnlp | 53 + .../simpletestSlowBrokenCustomSplash.jnlp | 54 + .../resources/simpletestSlowSlowCustomSplash.jnlp | 54 + .../simple/simpletest1/srcs/SimpleTest1.java | 43 + .../simpletest1/testcases/SimpleTest1Test.java | 61 + .../simple/simpletest2/resources/simpletest2.jnlp | 53 + .../simple/simpletest2/srcs/SimpleTest2.java | 44 + .../simpletest2/testcases/SimpleTest2Test.java | 62 + .../net/sourceforge/jnlp/ResourcesTest.java | 379 +++++ .../net/sourceforge/jnlp/ServerAccessTest.java | 233 +++ .../net/sourceforge/jnlp/ContentReader.java | 133 ++ .../sourceforge/jnlp/ContentReaderListener.java | 45 + .../net/sourceforge/jnlp/LogItem.java | 71 + .../net/sourceforge/jnlp/LoggingBottleneck.java | 215 +++ .../net/sourceforge/jnlp/ProcessAssasin.java | 159 ++ .../net/sourceforge/jnlp/ProcessResult.java | 69 + .../net/sourceforge/jnlp/ResourcesTest.java | 389 +++++ .../net/sourceforge/jnlp/ServerAccess.java | 828 +++++++++ .../net/sourceforge/jnlp/ServerLauncher.java | 120 ++ .../net/sourceforge/jnlp/TestsLogs.java | 85 + .../net/sourceforge/jnlp/ThreadedProcess.java | 140 ++ .../net/sourceforge/jnlp/TinyHttpdImpl.java | 174 ++ .../net/sourceforge/jnlp/annotations/Bug.java | 32 + .../sourceforge/jnlp/annotations/KnownToFail.java | 24 + .../sourceforge/jnlp/annotations/NeedsDisplay.java | 18 + .../jnlp/annotations/TestInBrowsers.java | 18 + .../sourceforge/jnlp/browsertesting/Browser.java | 19 + .../jnlp/browsertesting/BrowserFactory.java | 189 +++ .../jnlp/browsertesting/BrowserTest.java | 23 + .../jnlp/browsertesting/BrowserTestRunner.java | 148 ++ .../sourceforge/jnlp/browsertesting/Browsers.java | 46 + .../jnlp/browsertesting/browsers/Chrome.java | 15 + .../jnlp/browsertesting/browsers/Chromium.java | 15 + .../jnlp/browsertesting/browsers/Epiphany.java | 18 + .../jnlp/browsertesting/browsers/Firefox.java | 29 + .../jnlp/browsertesting/browsers/LinuxBrowser.java | 60 + .../jnlp/browsertesting/browsers/Midory.java | 18 + .../browsers/MozillaFamilyLinuxBrowser.java | 29 + .../jnlp/browsertesting/browsers/Opera.java | 37 + 413 files changed, 14628 insertions(+), 13678 deletions(-) delete mode 100644 tests/jnlp_tests/README delete mode 100644 tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html delete mode 100644 tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java delete mode 100644 tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile delete mode 100644 tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java delete mode 100644 tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp delete mode 100644 tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp delete mode 100644 tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp delete mode 100644 tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp delete mode 100644 tests/jnlp_tests/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java delete mode 100644 tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.html delete mode 100644 tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.jnlp delete mode 100644 tests/jnlp_tests/signed/AppletTestSigned/srcs/AppletTestSigned.java delete mode 100644 tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1.jnlp delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2.jnlp delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/srcs/CacheReproducer.java delete mode 100644 tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java delete mode 100644 tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java delete mode 100644 tests/jnlp_tests/signed/MissingJar/resources/MissingJar.jnlp delete mode 100644 tests/jnlp_tests/signed/MissingJar/resources/MissingJar2.jnlp delete mode 100644 tests/jnlp_tests/signed/MissingJar/resources/MissingJar3.jnlp delete mode 100644 tests/jnlp_tests/signed/MissingJar/resources/MissingJar4.jnlp delete mode 100644 tests/jnlp_tests/signed/MissingJar/srcs/MissingJar.java delete mode 100644 tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java delete mode 100644 tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java delete mode 100644 tests/jnlp_tests/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java delete mode 100644 tests/jnlp_tests/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp delete mode 100644 tests/jnlp_tests/signed/SimpletestSigned1/srcs/SimpletestSigned1.java delete mode 100644 "tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java delete mode 100644 tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/srcs/AccessClassInPackage.java delete mode 100644 tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java delete mode 100644 tests/jnlp_tests/simple/AddShutdownHook/resources/AddShutdownHook.jnlp delete mode 100644 tests/jnlp_tests/simple/AddShutdownHook/srcs/AddShutdownHook.java delete mode 100644 tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java delete mode 100644 tests/jnlp_tests/simple/AllStackTraces/resources/AllStackTraces.jnlp delete mode 100644 tests/jnlp_tests/simple/AllStackTraces/srcs/AllStackTraces.java delete mode 100644 tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java delete mode 100644 tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html delete mode 100644 tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp delete mode 100644 tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html delete mode 100644 tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java delete mode 100644 tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java delete mode 100644 tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html delete mode 100644 tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp delete mode 100644 tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar delete mode 100644 tests/jnlp_tests/simple/AppletReadsInvalidJar/srcs/Valid.java delete mode 100644 tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java delete mode 100644 tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.html delete mode 100644 tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp delete mode 100644 tests/jnlp_tests/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java delete mode 100644 tests/jnlp_tests/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java delete mode 100644 tests/jnlp_tests/simple/AppletTest/resources/AppletTest.jnlp delete mode 100644 tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html delete mode 100644 tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests2.html delete mode 100644 tests/jnlp_tests/simple/AppletTest/resources/appletViewTest.html delete mode 100644 tests/jnlp_tests/simple/AppletTest/srcs/AppletTest.java delete mode 100644 tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java delete mode 100644 tests/jnlp_tests/simple/CheckServices/resources/CheckPluginServices.html delete mode 100644 tests/jnlp_tests/simple/CheckServices/resources/CheckServices.jnlp delete mode 100644 tests/jnlp_tests/simple/CheckServices/srcs/CheckServices.java delete mode 100644 tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java delete mode 100644 tests/jnlp_tests/simple/CreateClassLoader/resources/CreateClassLoader.jnlp delete mode 100644 tests/jnlp_tests/simple/CreateClassLoader/srcs/CreateClassLoader.java delete mode 100644 tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java delete mode 100644 tests/jnlp_tests/simple/InformationTitleVendorParser/resources/InformationParser.jnlp delete mode 100644 tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleParser.jnlp delete mode 100644 tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp delete mode 100644 tests/jnlp_tests/simple/InformationTitleVendorParser/resources/VendorParser.jnlp delete mode 100644 tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/srcs/ManifestedJar1.java delete mode 100644 tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java delete mode 100644 tests/jnlp_tests/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF delete mode 100644 tests/jnlp_tests/simple/ManifestedJar2/srcs/ManifestedJar2.java delete mode 100644 tests/jnlp_tests/simple/ReadEnvironment/resources/ReadEnvironment.jnlp delete mode 100644 tests/jnlp_tests/simple/ReadEnvironment/srcs/ReadEnvironment.java delete mode 100644 tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java delete mode 100644 tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties1.jnlp delete mode 100644 tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties2.jnlp delete mode 100644 tests/jnlp_tests/simple/ReadProperties/srcs/ReadProperties.java delete mode 100644 tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java delete mode 100644 tests/jnlp_tests/simple/RedirectStreams/resources/RedirectStreams.jnlp delete mode 100644 tests/jnlp_tests/simple/RedirectStreams/srcs/RedirectStreams.java delete mode 100644 tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java delete mode 100644 tests/jnlp_tests/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp delete mode 100644 tests/jnlp_tests/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java delete mode 100644 tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java delete mode 100644 tests/jnlp_tests/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp delete mode 100644 tests/jnlp_tests/simple/SetContextClassLoader/srcs/SetContextClassLoader.java delete mode 100644 tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java delete mode 100644 "tests/jnlp_tests/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/resources/spaces applet Tests.html delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java delete mode 100644 tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java delete mode 100644 tests/jnlp_tests/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java delete mode 100644 tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest.jnlp delete mode 100644 tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest_1.jnlp delete mode 100644 tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java delete mode 100644 tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletest1.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletestCustomSplash.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletestMegaSlow.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletestSlow.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest1/srcs/SimpleTest1.java delete mode 100644 tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java delete mode 100644 tests/jnlp_tests/simple/simpletest2/resources/simpletest2.jnlp delete mode 100644 tests/jnlp_tests/simple/simpletest2/srcs/SimpleTest2.java delete mode 100644 tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ContentReaderListener.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/KnownToFail.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/TestInBrowsers.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browser.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserFactory.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTest.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browsers.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Midory.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java delete mode 100644 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Opera.java create mode 100644 tests/reproducers/README create mode 100644 tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html create mode 100644 tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java create mode 100644 tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile create mode 100644 tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java create mode 100644 tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp create mode 100644 tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp create mode 100644 tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp create mode 100644 tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp create mode 100644 tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java create mode 100644 tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html create mode 100644 tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp create mode 100644 tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java create mode 100644 tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java create mode 100644 tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp create mode 100644 tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp create mode 100644 tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp create mode 100644 tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp create mode 100644 tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java create mode 100644 tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java create mode 100644 tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java create mode 100644 tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp create mode 100644 tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp create mode 100644 tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp create mode 100644 tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp create mode 100644 tests/reproducers/signed/MissingJar/srcs/MissingJar.java create mode 100644 tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java create mode 100644 tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp create mode 100644 tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java create mode 100644 tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java create mode 100644 tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp create mode 100644 tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp create mode 100644 tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java create mode 100644 tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java create mode 100644 tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java create mode 100644 tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java create mode 100644 tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java create mode 100644 tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java create mode 100644 tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp create mode 100644 tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java create mode 100644 "tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java create mode 100644 tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java create mode 100644 tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp create mode 100644 tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp create mode 100644 tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp create mode 100644 tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp create mode 100644 tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java create mode 100644 tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java create mode 100644 tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp create mode 100644 tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java create mode 100644 tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java create mode 100644 tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp create mode 100644 tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java create mode 100644 tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java create mode 100644 tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html create mode 100644 tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp create mode 100644 tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html create mode 100644 tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java create mode 100644 tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java create mode 100644 tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html create mode 100644 tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp create mode 100644 tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar create mode 100644 tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java create mode 100644 tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java create mode 100644 tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html create mode 100644 tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp create mode 100644 tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java create mode 100644 tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java create mode 100644 tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp create mode 100644 tests/reproducers/simple/AppletTest/resources/appletAutoTests.html create mode 100644 tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html create mode 100644 tests/reproducers/simple/AppletTest/resources/appletViewTest.html create mode 100644 tests/reproducers/simple/AppletTest/srcs/AppletTest.java create mode 100644 tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java create mode 100644 tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html create mode 100644 tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp create mode 100644 tests/reproducers/simple/CheckServices/srcs/CheckServices.java create mode 100644 tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java create mode 100644 tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp create mode 100644 tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java create mode 100644 tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java create mode 100644 tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp create mode 100644 tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp create mode 100644 tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp create mode 100644 tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp create mode 100644 tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp create mode 100644 tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF create mode 100644 tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java create mode 100644 tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java create mode 100644 tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF create mode 100644 tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java create mode 100644 tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp create mode 100644 tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java create mode 100644 tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java create mode 100644 tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp create mode 100644 tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp create mode 100644 tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java create mode 100644 tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java create mode 100644 tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp create mode 100644 tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java create mode 100644 tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java create mode 100644 tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp create mode 100644 tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java create mode 100644 tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java create mode 100644 tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp create mode 100644 tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java create mode 100644 tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java create mode 100644 "tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" create mode 100644 tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp create mode 100644 tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp create mode 100644 tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp create mode 100644 tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html create mode 100644 tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java create mode 100644 tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java create mode 100644 tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java create mode 100644 tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java create mode 100644 tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp create mode 100644 tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp create mode 100644 tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java create mode 100644 tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp create mode 100644 tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp create mode 100644 tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java create mode 100644 tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java create mode 100644 tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp create mode 100644 tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java create mode 100644 tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java create mode 100644 tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java create mode 100644 tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ContentReader.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ContentReaderListener.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/LogItem.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ProcessResult.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ResourcesTest.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/TestsLogs.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/annotations/Bug.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/annotations/NeedsDisplay.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/annotations/TestInBrowsers.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browser.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserFactory.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTest.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browsers.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Midory.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java create mode 100644 tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Opera.java diff --git a/ChangeLog b/ChangeLog index 58b6358..d3cd34a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,56 @@ +2012-07-02 Jiri Vanek + + Makefile adapted to recent (three changelog items) refactoring + * Makefile.am: (JNLP_TESTS_ENGINE_SRCDIR) now points correctly to + test-extensions. (JNLP_TESTS_ENGINE_TESTS_SRCDIR) new variable for + test-extensions-tests. (JNLP_TESTS_SRCDIR) now points to reproducers. + (JNLP_TESTS_ENGINE_TESTS_DIR) new variable for built + JNLP_TESTS_ENGINE_TESTS_SRCDIR + (netx-dist-tests-tests-source-files.txt) new target for list of + content of JNLP_TESTS_ENGINE_TESTS_SRCDIR. + (stamps/netx-dist-tests-tests-compile.stamp) new target for compiling + netx-dist-tests-tests-source-files.txt + (netx-dist-tests-source-files.tx) now depends on + stamps/netx-dist-tests-tests-compile.stamp + ($(REPRODUCERS_CLASS_NAMES)) target is now working in JNLP_TESTS_ENGINE_TESTS_DIR + instead of JNLP_TESTS_ENGINE_DIR + (stamps/run-netx-dist-tests.stamp): added JNLP_TESTS_ENGINE_TESTS_DIR to classpath + (stamps/run-unit-test-code-coverage.stamp), (stamps/run-reproducers-test-code-coverage.stamp) + added JNLP_TESTS_ENGINE_TESTS_DIR to classpath and + JNLP_TESTS_ENGINE_TESTS_SRCDIR to sources path + +2012-07-02 Jiri Vanek + + All tests from test-extensions extracted to test-extensions-tests. + All inner classes in test-extensions extracted as outer classes + * tests/test-extensions/net/sourceforge/jnlp/ResourcesTest.java: + moved to test-extensions-tests + * tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java: + new file, copied from test-extensions + * tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java: + all tests from original ServerAccess.java + * tests/test-extensions/net/sourceforge/jnlp/ContentReader.java: + * tests/test-extensions/net/sourceforge/jnlp/LogItem.java: + * tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java: + * tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java: + * tests/test-extensions/net/sourceforge/jnlp/ProcessResult.java: + * tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java: + * tests/test-extensions/net/sourceforge/jnlp/TestsLogs.java: + * tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java: + * tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java: + new files, extracted classes from ServerAccess + * tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java: + extracted tests and inner classes + + +2012-07-02 Jiri Vanek + + hg move tests/netx/jnlp_testsengine/ tests/test-extensions + +2012-07-02 Jiri Vanek + + hg move tests/jnlp_tests/ tests/reproducers + 2012-06-29 Jiri Vanek Fixed resource tests and Browsers.none behavior diff --git a/Makefile.am b/Makefile.am index aa6ddaa..3e0208d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,9 +17,12 @@ export NETX_UNIT_TEST_DIR=$(TESTS_DIR)/netx/unit export JUNIT_RUNNER_DIR=$(TESTS_DIR)/junit-runner export JUNIT_RUNNER_SRCDIR=$(TESTS_SRCDIR)/junit-runner -export JNLP_TESTS_ENGINE_SRCDIR=$(TESTS_SRCDIR)/netx/jnlp_testsengine -export JNLP_TESTS_SRCDIR=$(TESTS_SRCDIR)/jnlp_tests -export JNLP_TESTS_ENGINE_DIR=$(TESTS_DIR)/netx/jnlp_testsengine + +export JNLP_TESTS_ENGINE_SRCDIR=$(TESTS_SRCDIR)/test-extensions +export JNLP_TESTS_ENGINE_TESTS_SRCDIR=$(TESTS_SRCDIR)/test-extensions-tests +export JNLP_TESTS_SRCDIR=$(TESTS_SRCDIR)/reproducers +export JNLP_TESTS_ENGINE_DIR=$(TESTS_DIR)/jnlp_testsengine +export JNLP_TESTS_ENGINE_TESTS_DIR=$(TESTS_DIR)/netx/jnlp_testsengine_tests export JNLP_TESTS_SERVER_DEPLOYDIR=$(TESTS_DIR)/jnlp_test_server export JNLP_TESTS_DIR=$(TESTS_DIR)/jnlp_tests export PRIVATE_KEYSTORE_NAME=teststore.ks @@ -649,8 +652,20 @@ stamps/netx-dist-tests-compile.stamp: stamps/netx.stamp \ mkdir -p stamps && \ touch $@ +netx-dist-tests-tests-source-files.txt: + find $(JNLP_TESTS_ENGINE_TESTS_SRCDIR) -name '*.java' | sort > $@ + +stamps/netx-dist-tests-tests-compile.stamp: stamps/junit-jnlp-dist-dirs netx-dist-tests-tests-source-files.txt stamps/netx-dist-tests-compile.stamp + mkdir -p $(JNLP_TESTS_ENGINE_TESTS_DIR); + $(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \ + -d $(JNLP_TESTS_ENGINE_TESTS_DIR) \ + -classpath $(JUNIT_JAR):$(NETX_DIR)/lib/classes.jar:$(JNLP_TESTS_ENGINE_DIR) \ + @netx-dist-tests-tests-source-files.txt && \ + mkdir -p stamps && \ + touch $@ + stamps/netx-dist-tests-compile-testcases.stamp: stamps/netx.stamp stamps/junit-jnlp-dist-dirs \ - netx-dist-tests-source-files.txt stamps/netx-dist-tests-compile.stamp + netx-dist-tests-source-files.txt stamps/netx-dist-tests-compile.stamp stamps/netx-dist-tests-tests-compile.stamp types=($(ALL_REPRODUCERS)); \ for which in "$${types[@]}" ; do \ . $(abs_top_srcdir)/NEW_LINE_IFS ; \ @@ -658,7 +673,7 @@ stamps/netx-dist-tests-compile-testcases.stamp: stamps/netx.stamp stamps/junit-j IFS="$$IFS_BACKUP" ; \ for dir in "$${simpleReproducers[@]}" ; do \ $(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \ - -d $(JNLP_TESTS_ENGINE_DIR) \ + -d $(JNLP_TESTS_ENGINE_TESTS_DIR) \ -classpath $(JUNIT_JAR):$(NETX_DIR)/lib/classes.jar:$(JNLP_TESTS_ENGINE_DIR) \ "$(JNLP_TESTS_SRCDIR)/$$which/$$dir/testcases/"* ; \ done ; \ @@ -681,7 +696,7 @@ stamps/netx-dist-tests-copy-resources.stamp: stamps/junit-jnlp-dist-dirs $(REPRODUCERS_CLASS_NAMES): $(REPRODUCERS_CLASS_WHITELIST) whiteListed=`cat $(REPRODUCERS_CLASS_WHITELIST)`; \ - cd $(JNLP_TESTS_ENGINE_DIR) ; \ + cd $(JNLP_TESTS_ENGINE_TESTS_DIR) ; \ class_names= ; \ for test in `find -type f` ; do \ class_name=`echo $$test | sed -e 's|\.class$$||' -e 's|^\./||'` ; \ @@ -710,7 +725,7 @@ stamps/run-netx-dist-tests.stamp: stamps/netx-dist.stamp extra-lib/about.jar sta $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME) $(REPRODUCERS_CLASS_NAMES) stamps/process-custom-reproducers.stamp cd $(JNLP_TESTS_ENGINE_DIR) ; \ class_names=`cat $(REPRODUCERS_CLASS_NAMES)` ; \ - CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):. \ + CLASSPATH=$(NETX_DIR)/lib/classes.jar:$(JUNIT_JAR):$(JUNIT_RUNNER_JAR):.:$(JNLP_TESTS_ENGINE_TESTS_DIR) \ $(BOOT_DIR)/bin/java $(REPRODUCERS_DPARAMETERS) \ -Xbootclasspath:$(RUNTIME) CommandLine $$class_names if WITH_XSLTPROC @@ -991,6 +1006,7 @@ if WITH_EMMA -cp $(BOOT_DIR)/jre/lib/resources.jar \ -cp $(RHINO_RUNTIME) \ -cp . \ + -cp $(JNLP_TESTS_ENGINE_TESTS_DIR) \ -ix "-org.junit.*" \ -ix "-junit.*" \ CommandLine $$class_names ; \ @@ -1007,6 +1023,7 @@ if WITH_EMMA -sp $(NETX_UNIT_TEST_SRCDIR) \ -sp $(JUNIT_RUNNER_SRCDIR) \ -sp $(JNLP_TESTS_ENGINE_SRCDIR) \ + -sp $(JNLP_TESTS_ENGINE_TESTS_SRCDIR) \ -r html \ -r xml \ "$${testcases_srcs[@]}" ; \ @@ -1053,6 +1070,7 @@ if WITH_EMMA -sp $(NETX_UNIT_TEST_SRCDIR) \ -sp $(JUNIT_RUNNER_SRCDIR) \ -sp $(JNLP_TESTS_ENGINE_SRCDIR) \ + -sp $(JNLP_TESTS_ENGINE_TESTS_SRCDIR) \ "$${testcases_srcs[@]}" \ -r html \ -r xml ; diff --git a/tests/jnlp_tests/README b/tests/jnlp_tests/README deleted file mode 100644 index a582318..0000000 --- a/tests/jnlp_tests/README +++ /dev/null @@ -1,32 +0,0 @@ -Each file in directory simple must follows hierarchy conventions and is compiled/jared - automatically into server's working directory and content of resources likewise. - The name of jnlp is independent, and there can be even more jnlps for each future jar. -Directories are honored in srcs and in resources, but not in testcases. -Directories in signed handle their content in similar way as simple's content is handled, - but in addition final jars are signed with simple testkey. -Files in custom directory have to care about compilation/packaging and deploying of srcs - directory themselves. This can affect also testcase and resources, but testcases and - resources are still automatically prepared like they are in the other test types. -There are three reproducers – simpletest1, simpletest2 and deadlocktest, which tests - test’s suite itself and serve as examples of behaviour. - -Directory "signed" is listed in Makefile.am. You can specify as much to-be-signed -directories as you want. And jars in each of those signed directories will be -signed by their's own unique key (number of signed directories == number of certificates). -Do not forget to add each this directory into list n Makefile.am - -If the name of a folder in simple/signed is composed of dots, then its contents - are deployed from under a directory structure such that each part evaluates to - a folder. For example, my.dir.reproducer/ will be deployed as jnlp_test_server/my/dir/reproducer.jar. - -Inside custom directory are expected directories which are handling themselves. - The only strictly necessary file is custom/reproducerName/srcs/Makefile. Upon - all custom/*/srcs are then launched make prepare-reproducer and during cleaning make - clean-reproducer. Those targets are run after all simple and signed reproducers are - prepared, so they can reuse components of the simple and signed reproducers, eg - certificates or dependencies. to keep this custom makefiles as simple as possible. - Some comment in makefile or readme file is recommended for each custom reproducer - to tell dependencies and what it does. Some readme (or comment in classes) is good - advice for any reproducer anyway;) -Because of automake only small set of variables from icedtea-web Makefile is - available for custom makefiles, but feel free to export others if needed. diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html deleted file mode 100644 index 88b8d99..0000000 --- a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html +++ /dev/null @@ -1,42 +0,0 @@ - - -

-

- - diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java deleted file mode 100644 index 0440500..0000000 --- a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java +++ /dev/null @@ -1,58 +0,0 @@ -import java.applet.Applet; - -/* -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class AppletFolderInArchiveTag extends Applet { - - private static class Killer extends Thread { - @Override - public void run() { - try { - int n = 2000; - Thread.sleep(n); - System.exit(0); - } catch (Exception ex) { - } - } - } - - @Override - public void init() { - new Killer().start(); - System.out.println("This was ran from a folder specified in the archive tag."); - } -} diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile deleted file mode 100644 index aa7f7fe..0000000 --- a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/srcs/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TESTNAME=AppletFolderInArchiveTag -ARCHIVE_TEST_FOLDER=archive_tag_folder_test -JAVAC_CLASSPATH=$(JNLP_TESTS_ENGINE_DIR):$(NETX_DIR)/lib/classes.jar -DEPLOY_SUBDIR=$(JNLP_TESTS_SERVER_DEPLOYDIR)/$(ARCHIVE_TEST_FOLDER) -INDEX_HTML_BODY="

Required to recognize folder structure

" - -prepare-reproducer: - echo PREPARING REPRODUCER $(TESTNAME) - mkdir -p $(DEPLOY_SUBDIR) - echo INDEX_HTML_BODY > $(DEPLOY_SUBDIR)/index.html - $(EXPORTED_JAVAC) -classpath $(JAVAC_CLASSPATH) -d $(DEPLOY_SUBDIR) $(TESTNAME).java - echo PREPARED REPRODUCER $(TESTNAME) - -clean-reproducer: - echo CLEANING REPRODUCER $(TESTNAME) - rm -rf $(DEPLOY_SUBDIR) - echo CLEANED REPRODUCER $(TESTNAME) - diff --git a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java b/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java deleted file mode 100644 index 63e8d7c..0000000 --- a/tests/jnlp_tests/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/* AppletFolderInArchiveTagTests.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; - -import org.junit.Assert; -import org.junit.Test; - -public class AppletFolderInArchiveTagTests extends BrowserTest{ - - - @NeedsDisplay - @Test - @TestInBrowsers(testIn={Browsers.all}) - @Bug(id="PR1011") - public void testClassInAppletFolder() throws Exception { - ProcessResult pr = server.executeBrowser("/AppletFolderInArchiveTag.html"); - - String s0 = "This was ran from a folder specified in the archive tag."; - Assert.assertTrue("Expected '"+s0+"', stdout was: " + pr.stdout, pr.stdout.contains(s0)); - } -} \ No newline at end of file diff --git a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp b/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp deleted file mode 100644 index d75a83b..0000000 --- a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Test accessClassInPackage signed - IcedTea - - testing access to some javax.jnlp.* package by signed app - - - - - - javax.jnlp.ServiceManager - - - - - diff --git a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp b/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp deleted file mode 100644 index c6b066b..0000000 --- a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Test accessClassInPackage by signed app - IcedTea - - testing access to net.sourceforge.* package by signed app - - - - - - net.sourceforge.jnlp.Parser - - - - - diff --git a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp b/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp deleted file mode 100644 index b7d1ff5..0000000 --- a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Test accessClassInPackage by signed app - IcedTea - - testing aaccess to package's internal class by signed app - - - - - - AccessClassInPackageSigned - - - - - diff --git a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp b/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp deleted file mode 100644 index ae4a19e..0000000 --- a/tests/jnlp_tests/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - Test accessClassInPackage by signed app - IcedTea - - testing access to sun.security.* package by signed app - - - - - - sun.security.internal.spec.TlsKeyMaterialSpec - - - - - diff --git a/tests/jnlp_tests/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java b/tests/jnlp_tests/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java deleted file mode 100644 index 63c681d..0000000 --- a/tests/jnlp_tests/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java +++ /dev/null @@ -1,44 +0,0 @@ -/* AccessClassInPackage.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class AccessClassInPackageSigned { - - public static void main(String[] args) throws Exception{ - Class.forName(args[0]); - System.out.println("Class was obtained: "+ args[0]); - } -} diff --git a/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.html b/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.html deleted file mode 100644 index 6c6ac48..0000000 --- a/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.html +++ /dev/null @@ -1,46 +0,0 @@ - - -

- - - - -

- - diff --git a/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.jnlp b/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.jnlp deleted file mode 100644 index 2045818..0000000 --- a/tests/jnlp_tests/signed/AppletTestSigned/resources/AppletTestSigned.jnlp +++ /dev/null @@ -1,63 +0,0 @@ - - - - - SignedAppletTest - IcedTea - - SignedAppletTest - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/AppletTestSigned/srcs/AppletTestSigned.java b/tests/jnlp_tests/signed/AppletTestSigned/srcs/AppletTestSigned.java deleted file mode 100644 index 1d475a5..0000000 --- a/tests/jnlp_tests/signed/AppletTestSigned/srcs/AppletTestSigned.java +++ /dev/null @@ -1,82 +0,0 @@ -/* AppletTestSigned.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.applet.Applet; - -public class AppletTestSigned extends Applet { - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("AppletTestSigned killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - System.out.println("AppletTestSigned was initialised"); - killer = new Killer(); - } - - @Override - public void start() { - System.out.println("AppletTestSigned was started"); - System.out.println(getParameter("key1")); - System.out.println(getParameter("key2")); - killer.start(); - System.out.println("killer was started"); - } - - @Override - public void stop() { - System.out.println("AppletTestSigned was stopped"); - } - - @Override - public void destroy() { - System.out.println("AppletTestSigned will be destroyed"); - } -} diff --git a/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java b/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java deleted file mode 100644 index d3d87ba..0000000 --- a/tests/jnlp_tests/signed/AppletTestSigned/testcases/AppletTestSignedTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/* AppletTestSignedTests.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; - -import org.junit.Test; - -public class AppletTestSignedTests extends BrowserTest { - - private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); - - @Test - public void AppletTestSignedTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/AppletTestSigned.jnlp"); - evaluateSignedApplet(pr); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - private void evaluateSignedApplet(ProcessResult pr) { - String s3 = "AppletTestSigned was initialised"; - Assert.assertTrue("AppletTestSigned stdout should contain " + s3 + " but didn't", pr.stdout.contains(s3)); - String s0 = "AppletTestSigned was started"; - Assert.assertTrue("AppletTestSigned stdout should contain " + s0 + " but didn't", pr.stdout.contains(s0)); - String s1 = "value1"; - Assert.assertTrue("AppletTestSigned stdout should contain " + s1 + " but didn't", pr.stdout.contains(s1)); - String s2 = "value2"; - Assert.assertTrue("AppletTestSigned stdout should contain " + s2 + " but didn't", pr.stdout.contains(s2)); - String s4 = "AppletTestSigned was stopped"; - Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s4 + " but did", pr.stdout.contains(s4)); - String s5 = "AppletTestSigned will be destroyed"; - Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s5 + " but did", pr.stdout.contains(s5)); - String ss = "xception"; - Assert.assertFalse("AppletTestSigned stderr should not contain " + ss + " but did", pr.stderr.contains(ss)); - String s7 = "AppletTestSigned killing himself after 2000 ms of life"; - Assert.assertTrue("AppletTestSigned stdout should contain " + s7 + " but didn't", pr.stdout.contains(s7)); - } - - @Test - @TestInBrowsers(testIn = {Browsers.all}) - public void AppletTestSignedFirefoxTest() throws Exception { - ServerAccess.PROCESS_TIMEOUT = 30 * 1000; - try { - ServerAccess.ProcessResult pr = server.executeBrowser("/AppletTestSigned.html"); - evaluateSignedApplet(pr); - Assert.assertTrue(pr.wasTerminated); - //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null - } finally { - ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal - } - } -} diff --git a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1.jnlp b/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1.jnlp deleted file mode 100644 index 87bfde4..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar - IcedTea - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp b/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp deleted file mode 100644 index dba2a65..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar - IcedTea - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2.jnlp b/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2.jnlp deleted file mode 100644 index a588211..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar - IcedTea - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp b/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp deleted file mode 100644 index 97745a7..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar - IcedTea - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/CacheReproducer/srcs/CacheReproducer.java b/tests/jnlp_tests/signed/CacheReproducer/srcs/CacheReproducer.java deleted file mode 100644 index e0813fa..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/srcs/CacheReproducer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* CacheReproducer.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.lang.reflect.*; - -public class CacheReproducer{ - - public static void main(String[] args) throws Exception{ - Class c1= Class.forName("SimpletestSigned1"); - Method m1=c1.getDeclaredMethod("main",args.getClass()); - m1.invoke((Object) null, (Object)args); - } -} diff --git a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java b/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java deleted file mode 100644 index a8a2859..0000000 --- a/tests/jnlp_tests/signed/CacheReproducer/testcases/CacheReproducerTest.java +++ /dev/null @@ -1,478 +0,0 @@ -/* CacheReproducerTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.annotations.KnownToFail; -import org.junit.AfterClass; -import org.junit.Assert; - -import org.junit.Test; - -public class CacheReproducerTest { - - private static final ServerAccess server = new ServerAccess(); - private static final List clear = Arrays.asList(new String[]{server.getJavawsLocation(), "-Xclearcache", ServerAccess.HEADLES_OPTION}); - private static final List trustedVerboses = Arrays.asList(new String[]{"-Xtrustall", ServerAccess.HEADLES_OPTION,"-verbose"}); - private static final List verbosed = Arrays.asList(new String[]{"-verbose", ServerAccess.HEADLES_OPTION}); - private static final String home = System.getProperty("user.home"); - private static final String name = System.getProperty("user.name"); - private static final String tmp = System.getProperty("java.io.tmpdir"); - private static final File icedteaDir = new File(home + "/" + ".icedtea"); - private static final File icedteaCache = new File(icedteaDir, "cache"); - private static final File icedteaCacheFile = new File(icedteaCache, "recently_used"); - private static final File netxLock = new File(tmp + "/" + name + "/netx/locks/netx_running"); - private static final String lre = "LruCacheException"; - private static final String ioobe = "IndexOutOfBoundsException"; - private static final String corruptRegex = "\\d{13}"; - private static final Pattern corruptPatern = Pattern.compile(corruptRegex); - private static final String corruptString = "156dsf1562kd5"; - - String testS = "#netx file\n" - + "#Mon Dec 12 16:20:46 CET 2011\n" - + "1323703236508,0=/home/xp13/.icedtea/cache/0/http/localhost/ReadPropertiesBySignedHack.jnlp\n" - + "1323703243086,2=/home/xp14/.icedtea/cache/2/http/localhost/ReadProperties.jar\n" - + "1323703243082,1=/home/xp15/.icedtea/cache/1/http/localhost/ReadPropertiesBySignedHack.jar"; - - @Test - public void cacheIsWorkingTest() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - } - - @Test - public void cacheIsWorkingTestSigned() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1Signed()); - assertCacheIsNotEmpty(); - } - - private class ParallelSimpleTestRunner extends Thread { - public boolean b=false; - @Override - public void run() { - try { - - ServerAccess.ProcessResult pr = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr); - b=true; - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - }; - - @Test - @KnownToFail - public void startParallelInstancesUponBrokenCache() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache1(); - ParallelSimpleTestRunner t1=new ParallelSimpleTestRunner(); - ParallelSimpleTestRunner t2=new ParallelSimpleTestRunner(); - ParallelSimpleTestRunner t3=new ParallelSimpleTestRunner(); - t1.start(); - t2.start(); - t3.start(); - int c=0; - while(true){ - c++; - Thread.sleep(100); - if (c>600) throw new Error("threads have not died in time"); - if (!t1.isAlive() && !t2.isAlive() && !t3.isAlive()) break; - } - Thread.sleep(1000); - Assert.assertTrue(t1.b); - Assert.assertTrue(t2.b); - Assert.assertTrue(t3.b); - } - - - private void assertCacheIsNotEmpty() { - Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should exist some any run", icedteaCache.exists()); - Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should exist some any run", icedteaCacheFile.exists()); - Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > 0); - } - - /** - * This is breaking integer numbers in first part of cache file item - * @throws Exception - */ - @Test - public void coruptAndRunCache1() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache1(); - ProcessResult pr = runSimpleTest1(); - assertLruExceptionAppeared(pr); - evaluateSimpleTest1OkCache(pr); - clearAndEvaluateCache(); - ProcessResult pr2 = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr2); - assertLruExceptionNOTappeared(pr2); - } - - /** - * This is breaking integer numbers in first part of cache file item - * @throws Exception - */ - @Test - public void coruptAndRunCache2() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache1(); - ProcessResult pr = runSimpleTest1(); - assertLruExceptionAppeared(pr); - evaluateSimpleTest1OkCache(pr); - ProcessResult pr3 = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr3); - assertLruExceptionNOTappeared(pr3); - clearAndEvaluateCache(); - ProcessResult pr2 = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr2); - assertLruExceptionNOTappeared(pr2); - } - - /** - * This is breaking paths in second part of cache file item - * @throws Exception - */ - @Test - public void coruptAndRunCache3() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache3(); - ProcessResult pr = runSimpleTest1(); - assertAoobNOTappeared(pr); - assertLruExceptionAppeared(pr); - evaluateSimpleTest1OkCache(pr); - ProcessResult pr3 = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr3); - assertLruExceptionNOTappeared(pr3); - clearAndEvaluateCache(); - ProcessResult pr2 = runSimpleTest1(); - evaluateSimpleTest1OkCache(pr2); - assertLruExceptionNOTappeared(pr2); - } - - private void assertAoobNOTappeared(ProcessResult pr2) { - Assert.assertFalse("serr should NOT contain " + ioobe, pr2.stderr.contains(ioobe)); - } - - private void assertLruExceptionNOTappeared(ProcessResult pr2) { - Assert.assertFalse("serr should NOT contain " + lre, pr2.stderr.contains(lre)); - } - - private void assertLruExceptionAppeared(ProcessResult pr) { - Assert.assertTrue("serr should contain " + lre, pr.stderr.contains(lre)); - } - - @Test - public void coruptAndRunCache1Signed() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache1(); - ProcessResult pr = runSimpleTest1Signed(); - assertLruExceptionAppeared(pr); - evaluateSimpleTest1OkCache(pr); - clearAndEvaluateCache(); - ProcessResult pr2 = runSimpleTest1Signed(); - evaluateSimpleTest1OkCache(pr2); - assertLruExceptionNOTappeared(pr2); - } - - @Test - public void coruptAndRunCache2Signed() throws Exception { - clearAndEvaluateCache(); - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - breakCache1(); - ProcessResult pr = runSimpleTest1Signed(); - assertLruExceptionAppeared(pr); - evaluateSimpleTest1OkCache(pr); - ProcessResult pr3 = runSimpleTest1Signed(); - evaluateSimpleTest1OkCache(pr3); - assertLruExceptionNOTappeared(pr3); - clearAndEvaluateCache(); - ProcessResult pr2 = runSimpleTest1Signed(); - evaluateSimpleTest1OkCache(pr2); - assertLruExceptionNOTappeared(pr2); - } - - @Test - public void clearCacheUnsucessfully() throws Exception { - evaluateSimpleTest1OkCache(runSimpleTest1()); - assertCacheIsNotEmpty(); - ProcessResult pr; - Thread t = new Thread(new Runnable() { - - @Override - public void run() { - try { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(verbosed, "/deadlocktest.jnlp"); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - }); - t.start(); - Thread.sleep(1000); - pr = tryToClearcache(); - String q = "Can not clear cache at this time"; - Assert.assertTrue("Stderr should contain " + q + ", but did not.", pr.stderr.contains(q)); - assertCacheIsNotEmpty(); - } - - - //next four tests are designed to ensure, that corrupted cache will not break already loaded cached files - public static final String CR1 = "CacheReproducer1"; - public static final String CR2 = "CacheReproducer2"; - public static final String CR11 = "CacheReproducer1_1"; - public static final String CR21 = "CacheReproducer2_1"; - - public void testsBody(String id, int breaker) throws Exception { - clearAndEvaluateCache(); - ProcessResult pr1 = runSimpleTestSigned(id); - assertLruExceptionNOTappeared(pr1); - evaluateSimpleTest1OkCache(pr1); - if (breaker < 0) { - breakCache1(); - } else { - breakCache2(breaker); - } - ProcessResult pr2 = runSimpleTestSigned(id); - assertLruExceptionAppeared(pr2); - evaluateSimpleTest1OkCache(pr2); - } - - @Test - public void testAlreadyLoadedCached1() throws Exception { - testsBody(CR1, 1); - testsBody(CR1, 2); - testsBody(CR1, -1); - } - - @Test - public void testAlreadyLoadedCached2() throws Exception { - testsBody(CR2, 1); - testsBody(CR2, 2); - testsBody(CR2, -1); - } - - @Test - public void testAlreadyLoadedCached11() throws Exception { - testsBody(CR11, 1); - testsBody(CR11, 2); - testsBody(CR11, -1); - } - - @Test - public void testAlreadyLoadedCached21() throws Exception { - testsBody(CR21, 1); - testsBody(CR21, 2); - testsBody(CR21, -1); - } - - @AfterClass - public static void clearCache() throws Exception { - clearAndEvaluateCache(); - } - - private static void clearAndEvaluateCache() throws Exception { - clearAndEvaluateCache(true); - } - - private static void clearAndEvaluateCache(boolean force) throws Exception { - if (force) { - if (netxLock.isFile()) { - boolean b = netxLock.delete(); - junit.framework.Assert.assertTrue(b); - } - - } - tryToClearcache(); - Assert.assertFalse("icedtea cache " + icedteaCache.getAbsolutePath() + " should not exist after clearing", icedteaCache.exists()); - } - - private static String loadFile(File f) throws FileNotFoundException, UnsupportedEncodingException, IOException { - BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(icedteaCacheFile), "UTF-8")); - StringBuilder sb = new StringBuilder(); - while (true) { - String s = r.readLine(); - if (s == null) { - break; - } - sb.append(s).append("\n"); - - } - return sb.toString(); - } - - private static String loadCacheFile() throws IOException { - return loadFile(icedteaCacheFile); - } - - @Test - public void assertBreakers1AreWorking() { - String s=testS; - String sp[] = s.split("\n"); - String ss[] = breakAll(s).split("\n"); - for (int i = 0; i < 2; i++) { - Assert.assertEquals(sp[i], ss[i]); - - } - for (int i = 2; i < ss.length; i++) { - Assert.assertNotSame(sp[i], ss[i]); - - } - String sb = breakOne(s, 0); - junit.framework.Assert.assertEquals(s, sb); - for (int x = 1; x <= 3; x++) { - String[] sx = breakOne(s, x).split("\n"); - for (int i = 0; i < sx.length; i++) { - if (i == x + 1) { - Assert.assertNotSame(sp[i], sx[i]); - } else { - Assert.assertEquals(sp[i], sx[i]); - } - - } - } - String sbb = breakOne(s, 4); - Assert.assertEquals(s, sbb); - } - - private static String breakAll(String s) { - return s.replaceAll(corruptRegex, corruptString); - } - - private static String breakOne(String s, int i) { - Matcher m1 = corruptPatern.matcher(s); - int x = 0; - while (m1.find()) { - x++; - String r = (m1.group(0)); - if (x == i) { - return s.replace(r, corruptString); - } - } - return s; - } - - @Test - public void assertBreakers2AreWorking() { - String s=testS; - String sp[] = s.split("\n"); - String ss[] = breakPaths (s).split("\n"); - for (int i = 0; i < 2; i++) { - Assert.assertEquals(sp[i], ss[i]); - - } - for (int i = 2; i < ss.length; i++) { - Assert.assertNotSame(sp[i], ss[i]); - - } - } - - private static String breakPaths(String s) { - return s.replaceAll(home+".*", "/ho"); - } - - private static void breakCache1() throws IOException { - String s = loadCacheFile(); - s = breakAll(s); - ServerAccess.saveFile(s, icedteaCacheFile); - } - - private static void breakCache2(int i) throws FileNotFoundException, UnsupportedEncodingException, IOException { - String s = loadCacheFile(); - s = breakOne(s, i); - ServerAccess.saveFile(s, icedteaCacheFile); - } - - private static void breakCache3() throws IOException { - String s = loadCacheFile(); - s = breakPaths(s); - ServerAccess.saveFile(s, icedteaCacheFile); - } - - private static ServerAccess.ProcessResult runSimpleTest1() throws Exception { - return runSimpleTest1(verbosed, "simpletest1"); - } - - private static ServerAccess.ProcessResult runSimpleTest1(List args, String s) throws Exception { - ServerAccess.ProcessResult pr2 = server.executeJavawsHeadless(args, "/" + s + ".jnlp"); - return pr2; - } - - private static ServerAccess.ProcessResult runSimpleTest1Signed() throws Exception { - return runSimpleTestSigned("SimpletestSigned1"); - } - - private static ServerAccess.ProcessResult runSimpleTestSigned(String id) throws Exception { - return runSimpleTest1(trustedVerboses, id); - } - - private static void evaluateSimpleTest1OkCache(ServerAccess.ProcessResult pr2) throws Exception { - String s = "Good simple javaws exapmle"; - Assert.assertTrue("test stdout should contain " + s + " but didn't", pr2.stdout.contains(s)); - Assert.assertFalse(pr2.wasTerminated); - Assert.assertEquals((Integer) 0, pr2.returnValue); - } - - private static ProcessResult tryToClearcache() throws Exception { - ServerAccess.ProcessResult pr1 = ServerAccess.executeProcess(clear); - return pr1; - } -} diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp deleted file mode 100644 index 44d9025..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - InternalClassloaderWithDownloadedResource-applet-hack - IcedTea - - InternalClassloaderWithDownloadedResource-applet-hack - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp deleted file mode 100644 index 882461c..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - InternalClassloaderWithDownloadedResource-applet-new - IcedTea - - InternalClassloaderWithDownloadedResource-applet-new - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html deleted file mode 100644 index 7373bbd..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - -

- - - -

- - diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp deleted file mode 100644 index 911cc81..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - InternalClassloaderWithDownloadedResource-hack - IcedTea - - InternalClassloaderWithDownloadedResource-hack - - - - - - - - hack - - - - - \ No newline at end of file diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html deleted file mode 100644 index 4d0c401..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - -

- - - -

- - diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp deleted file mode 100644 index 5a3050e..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - InternalClassloaderWithDownloadedResource-new - IcedTea - - InternalClassloaderWithDownloadedResource-new - - - - - - - - new - - - - - \ No newline at end of file diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java deleted file mode 100644 index 96cfcdf..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java +++ /dev/null @@ -1,164 +0,0 @@ -/* InternalClassloaderWithDownloadedResource.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.applet.Applet; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; - -public class InternalClassloaderWithDownloadedResource extends Applet { - - public static void main(String[] args) throws Exception { - int port = 44321; //debug default - String sPort = System.getProperty("serveraccess.port"); - if (sPort != null) { - port = new Integer(sPort); - } - if (args.length != 1) { - throw new IllegalArgumentException("exactly one argument expected"); - } - resolveArgument(args[0], port); - - } - - private static void downlaodAndExecuteForeignMethod(int port, int classlaoder) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { - URL url = new URL("http://localhost:" + port + "/SimpletestSigned1.jar"); - URLClassLoader ucl = null; - if (classlaoder == 1) { - ucl = (URLClassLoader) InternalClassloaderWithDownloadedResource.class.getClassLoader(); - System.out.println("Downloading " + url.toString()); - Method privateStringMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); - privateStringMethod.setAccessible(true); - privateStringMethod.invoke(ucl, url); - } else if (classlaoder == 2) { - ucl = new URLClassLoader(new URL[]{url}); - } else { - throw new IllegalArgumentException("just 1 or 2 classlaoder id expected"); - } - executeForeignMethod(port, ucl); - } - - private static void executeForeignMethod(int port, URLClassLoader loader) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { - String className = "SimpletestSigned1"; - Class cls = loader.loadClass(className); - Method m = cls.getMethod("main", new Class[]{new String[0].getClass()}); - System.out.println("executing " + className + "'s main"); - m.invoke(null, (Object) new String[0]); - } - - private static void resolveArgument(String s, int port) throws Exception { - if (s == null) { - throw new IllegalArgumentException("arg was null"); - } else if (s.equalsIgnoreCase("hack")) { - downlaodAndExecuteForeignMethod(port, 1); - } else if (s.equalsIgnoreCase("new")) { - downlaodAndExecuteForeignMethod(port, 2); - } else { - throw new IllegalArgumentException("hack or new expected as argument"); - } - } - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - System.out.println("applet was initialised"); - killer = new Killer(); - } - - @Override - public void start() { - System.out.println("applet was started"); - killer.start(); - int port = 44321; //debug default - try { - File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); - if (portsFile.exists()) { - String sPort = null; - BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(portsFile), "utf-8")); - try { - sPort = br.readLine(); - } finally { - br.close(); - } - if (sPort != null) { - port = new Integer(sPort.trim()); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - try { - resolveArgument(getParameter("arg"), port); - } catch (Exception ex) { - ex.printStackTrace(); - throw new RuntimeException(ex); - } - System.out.println("killer was started"); - } - - @Override - public void stop() { - System.out.println("applet was stopped"); - } - - @Override - public void destroy() { - System.out.println("applet will be destroyed"); - } -} diff --git a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java b/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java deleted file mode 100644 index 54cb203..0000000 --- a/tests/jnlp_tests/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* InternalClassloaderWithDownloadedResourceTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -@Bug(id = {"RH816592","PR858"}) -public class InternalClassloaderWithDownloadedResourceTest extends BrowserTest { - - private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-verbose", "-Xtrustall", "-J-Dserveraccess.port=" + server.getPort()})); - private static final File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); - - @Before - public void setUp() { - try { - ServerAccess.logOutputReprint("Writeing " + server.getPort() + " to " + portsFile.getAbsolutePath()); - ServerAccess.saveFile("" + server.getPort(), portsFile); - ServerAccess.logOutputReprint("done"); - } catch (Exception ex) { - ServerAccess.logException(ex); - } - } - - @After - public void tearDown() { - ServerAccess.logOutputReprint("Deleting " + portsFile.getAbsolutePath()); - boolean b = portsFile.delete(); - ServerAccess.logOutputReprint("Deletion state (should be true) is " + b); - } - - @Test - @Bug(id = {"RH816592","PR858"}) - public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplication() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-new.jnlp"); - evaluate(pr); - Assert.assertFalse("should not be terminated but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - private void evaluate(ProcessResult pr) { - String ss = "Good simple javaws exapmle"; - Assert.assertTrue("Stdout should contains " + ss + " but didn't", pr.stdout.contains(ss)); - String s = "xception"; - Assert.assertFalse("Stderr should not contains " + s + " but did", pr.stderr.contains(s)); - } - - @Test - @Bug(id = {"RH816592","PR858"}) - public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplet() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-new.jnlp"); - evaluate(pr); - Assert.assertFalse("should not be terminated but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Test - @Bug(id = {"RH816592","PR858"}) - @NeedsDisplay - @TestInBrowsers(testIn={Browsers.all}) - public void launchInternalClassloaderWithDownloadedResourceAsHtmlApplet() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-new.html"); - evaluate(pr); - Assert.assertTrue("should be terminated but was not", pr.wasTerminated); - } - - @Test - @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) - public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplicationHack() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-hack.jnlp"); - evaluate(pr); - Assert.assertFalse("should not be terminated but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Test - @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) - public void launchInternalClassloaderWithDownloadedResourceAsJnlpAppletHack() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-hack.jnlp"); - evaluate(pr); - Assert.assertFalse("should not be terminated but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Test - @NeedsDisplay - @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) - @TestInBrowsers(testIn={Browsers.all}) - public void launchInternalClassloaderWithDownloadedResourceAsHtmlAppletHack() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-hack.html"); - evaluate(pr); - Assert.assertTrue("should be terminated but was not", pr.wasTerminated); - } -} diff --git a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar.jnlp b/tests/jnlp_tests/signed/MissingJar/resources/MissingJar.jnlp deleted file mode 100644 index ed761ca..0000000 --- a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar.jnlp +++ /dev/null @@ -1,21 +0,0 @@ - - - - test MissingJar - IcedTea - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar2.jnlp b/tests/jnlp_tests/signed/MissingJar/resources/MissingJar2.jnlp deleted file mode 100644 index 4a32d78..0000000 --- a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar2.jnlp +++ /dev/null @@ -1,19 +0,0 @@ - - - - test MissingJar - IcedTea - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar3.jnlp b/tests/jnlp_tests/signed/MissingJar/resources/MissingJar3.jnlp deleted file mode 100644 index b2b6007..0000000 --- a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar3.jnlp +++ /dev/null @@ -1,19 +0,0 @@ - - - - test MissingJar - IcedTea - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar4.jnlp b/tests/jnlp_tests/signed/MissingJar/resources/MissingJar4.jnlp deleted file mode 100644 index 60a53c0..0000000 --- a/tests/jnlp_tests/signed/MissingJar/resources/MissingJar4.jnlp +++ /dev/null @@ -1,21 +0,0 @@ - - - - test MissingJar - IcedTea - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/MissingJar/srcs/MissingJar.java b/tests/jnlp_tests/signed/MissingJar/srcs/MissingJar.java deleted file mode 100644 index a2b2794..0000000 --- a/tests/jnlp_tests/signed/MissingJar/srcs/MissingJar.java +++ /dev/null @@ -1,42 +0,0 @@ -/* MissingJar.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class MissingJar { - public static void main(String[] args) { - System.out.println("only fixed classloader can initialize this app"); - } -} diff --git a/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java b/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java deleted file mode 100644 index dc8bb77..0000000 --- a/tests/jnlp_tests/signed/MissingJar/testcases/MissingJarTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* MissingJar.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import org.junit.Assert; - -import org.junit.Test; - -public class MissingJarTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); - - private void evaluateResult(ProcessResult pr) { - String c = "only fixed classloader can initialize this app"; - Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did ", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Test - public void MissingJarTest1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar.jnlp"); - evaluateResult(pr); - } - - @Test - public void MissingJarTest2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar2.jnlp"); - evaluateResult(pr); - } - - @Test - public void MissingJarTest3() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar3.jnlp"); - evaluateResult(pr); - } - - @Test - public void MissingJarTest4() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar4.jnlp"); - evaluateResult(pr); - } -} diff --git a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp b/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp deleted file mode 100644 index f4e1223..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp +++ /dev/null @@ -1,19 +0,0 @@ - - - - read properties using System.getenv() - IcedTea - - - - - - - user.name - - - - - diff --git a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java b/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java deleted file mode 100644 index cea64af..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java +++ /dev/null @@ -1,63 +0,0 @@ -/* ReadPropertiesSigned.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -import java.lang.reflect.*; - -public class ReadPropertiesBySignedHack { - - /** - *some system property is expected as arg[0], eg user.name or user.home - */ - public static void main(String[] args) throws Throwable { - //security manager is not protecting us from accessing classes from - //net.sourceforge.jnlp.runtime via reflection - Class c2= Class.forName("net.sourceforge.jnlp.runtime.JNLPRuntime"); - Field f2 = c2.getDeclaredField("trustAll"); - f2.setAccessible(true); - f2.setBoolean(null, true); - Method m2=c2.getDeclaredMethod("setTrustAll",Boolean.TYPE); - m2.setAccessible(true); - m2.invoke((Object) null, true ); - //but security manager is guarding us against lunching unsigned code - //from signed archvive even if Xtrustall is on. - Class c1= Class.forName("ReadProperties"); - Method m1=c1.getDeclaredMethod("main",args.getClass()); - m1.invoke((Object) null, (Object)args); - } - - - -} diff --git a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java b/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java deleted file mode 100644 index 8f9455d..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* ReadPropertiesSignedTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class ReadPropertiesBySignedHackTest { - - private static ServerAccess server = new ServerAccess(); - private final List l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); - - - @Test - public void ReadPropertiesBySignedHackWithjoutXtrustAll() throws Exception { - //no request for permissions - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesBySignedHack.jnlp"); - String s="java.lang.SecurityException: class \"ReadProperties\"'s signer information does not match signer information of other classes in the same package"; - Assert.assertTrue("Stderr should contains "+s+" but did not",pr.stderr.contains(s)); - String ss="ClassNotFoundException"; - Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( - Assert.assertFalse("should not be terminated but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - } diff --git a/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp b/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp deleted file mode 100644 index a1adab8..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp +++ /dev/null @@ -1,15 +0,0 @@ - - - - read properties using System.getenv() - IcedTea - - - - - - user.name - - diff --git a/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp b/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp deleted file mode 100644 index db338df..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp +++ /dev/null @@ -1,18 +0,0 @@ - - - - read properties using System.getenv() - IcedTea - - - - - - user.name - - - - - diff --git a/tests/jnlp_tests/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java b/tests/jnlp_tests/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java deleted file mode 100644 index 60f53cb..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java +++ /dev/null @@ -1,45 +0,0 @@ -/* ReadPropertiesSigned.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class ReadPropertiesSigned { - - /** - *some system property is expected as arg[0], eg user.name or user.home - */ - public static void main(String[] args) { - System.out.println(System.getProperty(args[0])); - } -} diff --git a/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java b/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java deleted file mode 100644 index 6b389e3..0000000 --- a/tests/jnlp_tests/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* ReadPropertiesSignedTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class ReadPropertiesSignedTest { - - private static ServerAccess server = new ServerAccess(); - private final List l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); - - String accessMatcher = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; - - @Test - public void ReadSignedPropertiesWithoutPermissionsWithXtrustAll() throws Exception { - //no request for permissions - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned1.jnlp"); - Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); - String ss="ClassNotFoundException"; - Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( - Assert.assertFalse("should not be terminated but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - @Test - public void ReadSignedPropertiesWithPermissionsWithXtrustAll() throws Exception { - //request for allpermissions - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned2.jnlp"); - Assert.assertFalse("Stderr should NOT match "+accessMatcher+" but did",pr.stderr.matches(accessMatcher)); - String ss="ClassNotFoundException"; - Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertTrue("stdout lenght should be >= but was "+pr.stdout.length(),pr.stdout.length()>=4); // /home/user or /root or eanything else :( - Assert.assertFalse("should not be terminated but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - @Test - public void EnsureXtrustallNotAffectingUnsignedBehaviour() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadProperties1.jnlp"); - Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); - String ss="ClassNotFoundException"; - Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertFalse("stdout lenght should not be >2 but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("should not be terminated but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - ServerAccess.ProcessResult pr2=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); - Assert.assertEquals(pr.stderr, pr2.stderr); - Assert.assertEquals(pr.stdout, pr2.stdout); - - } - } diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp b/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp deleted file mode 100644 index 5285cd9..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpApplication - IcedTea - - SignedJnlpApplication - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp b/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp deleted file mode 100644 index a86d0c2..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp +++ /dev/null @@ -1,65 +0,0 @@ - - - - - SignedJnlpApplication - IcedTea - - SignedJnlpApplication - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp b/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp deleted file mode 100644 index 0c7cc1f..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp +++ /dev/null @@ -1,61 +0,0 @@ - - - - - SignedJnlpApplication - IcedTea - - SignedJnlpApplication - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp deleted file mode 100644 index 5285cd9..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpApplication - IcedTea - - SignedJnlpApplication - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java b/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java deleted file mode 100644 index 1f16697..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SignedJnlpApplication.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SignedJnlpApplication { - - public static void main(String[] args) { - System.out.println("Running signed application in main"); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java b/tests/jnlp_tests/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java deleted file mode 100644 index fb4e9ff..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* SignedJnlpApplicationTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class SignedJnlpApplicationTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + - "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + - "launching JNLP File"; - - @Test - public void launchingFileMatchesSignedApplication1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication1.jnlp"); - String s = "Running signed application in main"; - Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); - } - - /** - * Using a different value of name within the 'property' element in the launching JNLP file - */ - @Test - public void launchingFileDoesNotMatchSignedApplication1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication2.jnlp"); - Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); - } - - /** - * Missing 'property' child element within 'resource' in the launching JNLP file - */ - @Test - public void launchingFileDoesNotMatchSignedApplication2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication3.jnlp"); - Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); - } -} \ No newline at end of file diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp deleted file mode 100644 index 3a5651e..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest - IcedTea - - SignedJnlpCaseTest - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp deleted file mode 100644 index 18c0943..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest 2 - IcedTea - - SignedJnlpCaseTest 2 - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp deleted file mode 100644 index 3a5651e..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest - IcedTea - - SignedJnlpCaseTest - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java b/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java deleted file mode 100644 index 993fe6d..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SignedJnlpCase.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SignedJnlpCase { - - public static void main(String[] args) { - System.out.println("Running signed application in main"); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java b/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java deleted file mode 100644 index d410790..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* SignedJnlpCaseOneTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class SignedJnlpCaseOneTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - - @Test - public void launchingFileMatchesSigned() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne1.jnlp"); - String s = "Running signed application in main"; - Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); - } - - @Test - public void launchingFileDoesNotMatchSigned() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne2.jnlp"); - String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + - "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + - "launching JNLP File"; - Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp deleted file mode 100644 index 23fcacb..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest - IcedTea - - SignedJnlpCaseTest - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp deleted file mode 100644 index e97a126..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest 2 - IcedTea - - SignedJnlpCaseTest 2 - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp b/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp deleted file mode 100644 index ed34ac9..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - SignedJnlpCaseTest - IcedTea - - SignedJnlpCaseTest - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java b/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java deleted file mode 100644 index 993fe6d..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SignedJnlpCase.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SignedJnlpCase { - - public static void main(String[] args) { - System.out.println("Running signed application in main"); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java b/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java deleted file mode 100644 index 2869552..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* SignedJnlpCaseTwoTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class SignedJnlpCaseTwoTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - - @Test - public void launchingFileMatchesSigned() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo1.jnlp"); - String s = "Running signed application in main"; - Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); - } - - @Test - public void launchingFileDoesNotMatchSigned() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo2.jnlp"); - String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + - "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + - "launching JNLP File"; - Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp b/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp deleted file mode 100644 index 782c465..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp +++ /dev/null @@ -1,66 +0,0 @@ - - - - - SignedJnlpTemplate - IcedTea - - SignedJnlpTemplate - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp b/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp deleted file mode 100644 index d43f834..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp +++ /dev/null @@ -1,64 +0,0 @@ - - - - - SignedJnlpTemplate - IcedTea - - SignedJnlpTemplate - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp b/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp deleted file mode 100644 index c47a74d..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp +++ /dev/null @@ -1,71 +0,0 @@ - - - - - SignedJnlpTemplate - IcedTea - - SignedJnlpTemplate - - - - - IcedTea-Web - IcedTea - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp deleted file mode 100644 index 8936031..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - * - IcedTea - - * - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java b/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java deleted file mode 100644 index 9a94182..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SignedJnlpTemplate.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SignedJnlpTemplate { - - public static void main(String[] args) { - System.out.println("Running signed application in main"); - } -} diff --git a/tests/jnlp_tests/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java b/tests/jnlp_tests/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java deleted file mode 100644 index 5f2dd78..0000000 --- a/tests/jnlp_tests/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* SignedJnlpTemplateTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class SignedJnlpTemplateTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + - "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + - "launching JNLP File"; - - @Test - public void launchingFileMatchesSignedTemplate1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate1.jnlp"); - String s = "Running signed application in main"; - Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); - } - - /** - * Missing 'j2se' child within the 'resource' element in the launching JNLP file - */ - @Test - public void launchingFileDoesNotMatchSignedTemplate2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate2.jnlp"); - Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); - } - - /** - * Added an extra "information" element to the launching JNLP file * - */ - @Test - public void launchingFileDoesNotMatchSignedTemplate3() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate3.jnlp"); - Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); - } -} \ No newline at end of file diff --git a/tests/jnlp_tests/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp b/tests/jnlp_tests/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp deleted file mode 100644 index 177dcaa..0000000 --- a/tests/jnlp_tests/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/signed/SimpletestSigned1/srcs/SimpletestSigned1.java b/tests/jnlp_tests/signed/SimpletestSigned1/srcs/SimpletestSigned1.java deleted file mode 100644 index b0a30a9..0000000 --- a/tests/jnlp_tests/signed/SimpletestSigned1/srcs/SimpletestSigned1.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SimpletestSigned1.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SimpletestSigned1{ - - public static void main(String[] args){ - System.out.println("Good simple javaws exapmle"); - } -} diff --git "a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" "b/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" deleted file mode 100644 index ba5cbc3..0000000 --- "a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Spaces can be everywhere test with few more chars for encoding signed - IcedTea - - AppletTest - - - - - - - - - - - - diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp b/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp deleted file mode 100644 index e73043c..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Spaces can be everywhere1 signed - IcedTea - - Spaces can be everywhere1 signed - - - - - - - - - diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp b/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp deleted file mode 100644 index 872fb8c..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Spaces can be everywhere2 - IcedTea - - Spaces can be everywhere2 signed - - - - - - - - - diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp b/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp deleted file mode 100644 index 801a62b..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Spaces can be everywhere signed - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html b/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html deleted file mode 100644 index 32e60b4..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html +++ /dev/null @@ -1,42 +0,0 @@ - - -

-

- - diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java b/tests/jnlp_tests/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java deleted file mode 100644 index 25d28cf..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java +++ /dev/null @@ -1,76 +0,0 @@ - -import java.applet.Applet; - -/* SpacesCanBeEverywhereSigned.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SpacesCanBeEverywhereSigned extends Applet{ - - public static void main(String[] args){ - System.out.println("Signed spaces can be everywhere.jsr was launched correctly"); - } - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - killer = new Killer(); - } - - @Override - public void start() { - main(null); - killer.start(); - System.out.println("killer was started"); - } - - -} diff --git a/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java b/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java deleted file mode 100644 index f33b203..0000000 --- a/tests/jnlp_tests/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java +++ /dev/null @@ -1,245 +0,0 @@ -/* SpacesCanBeEverywhereTestsSigned.java -Copyright (C) 20121 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.ArrayList; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; - -import org.junit.Test; - -@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"}) -public class SpacesCanBeEverywhereTestsSigned extends BrowserTest { - - - @Bug(id="PR811") - @Test - @NeedsDisplay - public void SpacesCanBeEverywhereLocalAppletTestsJnlp2Signed() throws Exception { - List commands=new ArrayList(1); - commands.add(server.getJavawsLocation()); - commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too signed.jnlp"); - /* Change of dir is cousing the Exception bellow - * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - * No X11 DISPLAY variable was set, but this program performed an operation which requires it. - * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) - * at java.awt.Window.(Window.java:476) - * at java.awt.Frame.(Frame.java:419) - * at java.awt.Frame.(Frame.java:384) - * at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1754) - * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831) - * at javax.swing.JWindow.(JWindow.java:185) - * at javax.swing.JWindow.(JWindow.java:137) - * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.(JNLPSecurityManager.java:121) - * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202) - * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177) - * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) - * at java.security.AccessController.doPrivileged(Native Method) - * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) - * - * Thats why there is absolute path to the file. - * - * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing - - * it is in headless mode. This can be considered as bug, but because it is - * only on ocal files, and probably only from test run - it can be ignored - */ - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - @NeedsDisplay - public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2Signed() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too%20signed.jnlp"); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); - } - - @Bug(id="PR811") - @Test - @NeedsDisplay - @TestInBrowsers(testIn = {Browsers.one}) - public void SpacesCanBeEverywhereRemoteAppletTestsHtml2Signed() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests+signed.html"); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); - } - - - @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"}) - @Test - public void SpacesCanBeEverywhereRemoteTests1Signed() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1%20signed.jnlp"); - String s = "Good simple javaws exapmle"; - Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2Signed() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp"); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test=20"); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test%3D20"); - - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests3Signed() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1signed.jnlp"); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests1Signed() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("Spaces can be everywhere1.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s = "Good simple javaws exapmle"; - Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests2Signed() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("Spaces can be everywhere2 signed.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests4Signed() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add(server.getDir()+"/Spaces can be everywhere2 signed.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests3Signed() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("SpacesCanBeEverywhere1signed.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s="Signed spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp b/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp deleted file mode 100644 index cea0a6c..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Test accessClassInPackage - IcedTea - - testing access to some javax.jnlp.* package - - - - - - javax.jnlp.ServiceManager - - diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp b/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp deleted file mode 100644 index f8413e6..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Test accessClassInPackage - IcedTea - - testing access to net.sourceforge.* package - - - - - - net.sourceforge.jnlp.Parser - - diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp b/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp deleted file mode 100644 index 4af8c04..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Test accessClassInPackage - IcedTea - - testing aaccess to package's internal class - - - - - - AccessClassInPackage - - diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp b/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp deleted file mode 100644 index 8f3c06a..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Test accessClassInPackage - IcedTea - - testing access to sun.security.* package - - - - - - sun.security.internal.spec.TlsKeyMaterialSpec - - diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/srcs/AccessClassInPackage.java b/tests/jnlp_tests/simple/AccessClassInPackage/srcs/AccessClassInPackage.java deleted file mode 100644 index 7164006..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/srcs/AccessClassInPackage.java +++ /dev/null @@ -1,44 +0,0 @@ -/* AccessClassInPackage.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class AccessClassInPackage { - - public static void main(String[] args) throws Exception{ - Class.forName(args[0]); - System.out.println("Class was obtained: "+ args[0]); - } -} diff --git a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java b/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java deleted file mode 100644 index e9952ff..0000000 --- a/tests/jnlp_tests/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java +++ /dev/null @@ -1,168 +0,0 @@ -/* AccessClassInPackageTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import org.junit.Assert; - -import org.junit.Test; - -public class AccessClassInPackageTest { - - private static ServerAccess server = new ServerAccess(); - private String[] files = { - "AccessClassInPackageJAVAXJNLP.jnlp", - "AccessClassInPackageSELF.jnlp", - "AccessClassInPackageNETSF.jnlp", - "AccessClassInPackageSUNSEC.jnlp" - }; - private String[] filesSigned = { - "AccessClassInPackageSignedJAVAXJNLP.jnlp", - "AccessClassInPackageSignedSELF.jnlp", - "AccessClassInPackageSignedNETSF.jnlp", - "AccessClassInPackageSignedSUNSEC.jnlp" - }; - private String[] badExceptions = { - "accessClassInPackage.javax.jnlp.ServiceManager", - "accessClassInPackage.AccessClassInPackage", - "accessClassInPackage.net.sourceforge.jnlp", - "accessClassInPackage.sun.security.internal.spec" - }; - private String[] pass = { - "javax.jnlp.ServiceManager", - "AccessClassInPackage", - "net.sourceforge.jnlp.Parser", - "sun.security.internal.spec.TlsKeyMaterialSpec" - }; - private static final List xta = Arrays.asList(new String[]{"-Xtrustall"}); - - private void testShouldFail(ServerAccess.ProcessResult pr, String s) { - String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; - Assert.assertTrue("stderr should match `" + c + "`, but didn't ", pr.stderr.matches(c)); - } - - private void testShouldNOTFail(ServerAccess.ProcessResult pr, String s) { - String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; - Assert.assertFalse("stderr should NOT match `" + c + "`, but did ", pr.stderr.matches(c)); - } - - private void commonPitfall(ProcessResult pr) { - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("AccessClassInPackageTestLunch1 should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - private void testShouldPass(ServerAccess.ProcessResult pr, String s) { - String c = "Class was obtained: " + s; - Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); - } - - private void testShouldNOTPass(ServerAccess.ProcessResult pr, String s) { - String c = "Class was obtained: " + s; - Assert.assertFalse("stdout should not contains `" + c + "`, but did ", pr.stdout.contains(c)); - } - - @Test - public void AccessClassInPackageJAVAXJNLP() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]); - commonPitfall(pr); - testShouldPass(pr, pass[0]); - testShouldNOTFail(pr, badExceptions[0]); - } - - @Test - public void AccessClassInPackageSELF() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]); - commonPitfall(pr); - testShouldPass(pr, pass[1]); - testShouldNOTFail(pr, badExceptions[1]); - } - - @Test - public void AccessClassInPackageNETSF() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]); - commonPitfall(pr); - testShouldFail(pr, badExceptions[2]); - testShouldNOTPass(pr, pass[2]); - } - - @Test - public void AccessClassInPackageSUNSEC() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]); - commonPitfall(pr); - commonPitfall(pr); - testShouldFail(pr, badExceptions[3]); - testShouldNOTPass(pr, pass[3]); - } - - //now signed vaiants - @Test - public void AccessClassInPackageSignedJAVAXJNLP() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]); - commonPitfall(pr); - testShouldPass(pr, pass[0]); - testShouldNOTFail(pr, badExceptions[0]); - } - - @Test - public void AccessClassInPackageSignedSELF() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]); - commonPitfall(pr); - testShouldPass(pr, pass[1]); - testShouldNOTFail(pr, badExceptions[1]); - } - - @Test - public void AccessClassInPackageSignedNETSF() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]); - commonPitfall(pr); - testShouldPass(pr, pass[2]); - testShouldNOTFail(pr, badExceptions[2]); - } - - @Test - public void AccessClassInPackageSignedSUNSEC() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]); - commonPitfall(pr); - testShouldPass(pr, pass[3]); - testShouldNOTFail(pr, badExceptions[3]); - } - -} diff --git a/tests/jnlp_tests/simple/AddShutdownHook/resources/AddShutdownHook.jnlp b/tests/jnlp_tests/simple/AddShutdownHook/resources/AddShutdownHook.jnlp deleted file mode 100644 index 42272ff..0000000 --- a/tests/jnlp_tests/simple/AddShutdownHook/resources/AddShutdownHook.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - test adding shutdown hooks - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/AddShutdownHook/srcs/AddShutdownHook.java b/tests/jnlp_tests/simple/AddShutdownHook/srcs/AddShutdownHook.java deleted file mode 100644 index 2b731eb..0000000 --- a/tests/jnlp_tests/simple/AddShutdownHook/srcs/AddShutdownHook.java +++ /dev/null @@ -1,48 +0,0 @@ -/* AddShutdownHook.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class AddShutdownHook { - public static void main(String[] args) { - - Runtime.getRuntime().addShutdownHook(new Thread() { - public void run() { - // no op - } - }); - - } -} diff --git a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java deleted file mode 100644 index 165276a..0000000 --- a/tests/jnlp_tests/simple/AddShutdownHook/testcases/AddShutdownHookTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* AddShutdownHookTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class AddShutdownHookTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void AddShutdownHookTestLunch1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; - Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/AllStackTraces/resources/AllStackTraces.jnlp b/tests/jnlp_tests/simple/AllStackTraces/resources/AllStackTraces.jnlp deleted file mode 100644 index be6b3f3..0000000 --- a/tests/jnlp_tests/simple/AllStackTraces/resources/AllStackTraces.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - Test Thread.getAllStackTraces - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/AllStackTraces/srcs/AllStackTraces.java b/tests/jnlp_tests/simple/AllStackTraces/srcs/AllStackTraces.java deleted file mode 100644 index f871b9c..0000000 --- a/tests/jnlp_tests/simple/AllStackTraces/srcs/AllStackTraces.java +++ /dev/null @@ -1,42 +0,0 @@ -/* AllStackTraces.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class AllStackTraces { - public static void main(String[] args) { - Thread.getAllStackTraces(); - } -} diff --git a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java deleted file mode 100644 index 0372f4c..0000000 --- a/tests/jnlp_tests/simple/AllStackTraces/testcases/AllStackTracesTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* AllStackTracesTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class AllStackTracesTest { - - private static ServerAccess server = new ServerAccess(); - - - - @Test - public void AllStackTracesTest1() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); - String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*"; - Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did ",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - } diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html deleted file mode 100644 index 9cc0fe1..0000000 --- a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp deleted file mode 100644 index 4902f25..0000000 --- a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp +++ /dev/null @@ -1,58 +0,0 @@ - - - - - AppletBaseURL - IcedTea - - AppletBaseURL - - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html deleted file mode 100644 index 752a767..0000000 --- a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java b/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java deleted file mode 100644 index 8234e3c..0000000 --- a/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java +++ /dev/null @@ -1,64 +0,0 @@ -/* AppletBaseURL.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.applet.Applet; -public class AppletBaseURL extends Applet { - - private class Killer extends Thread { - - public int n = 1000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Aplet killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - System.out.println("Document base is " + getDocumentBase() + " for this applet"); - System.out.println("Codebase is " + getCodeBase() + " for this applet"); - killer = new Killer(); - killer.start(); - } -} diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java b/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java deleted file mode 100644 index ec14cfa..0000000 --- a/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* AppletBaseURLTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; - -import org.junit.Assert; -import org.junit.Test; - -public class AppletBaseURLTest extends BrowserTest{ - - private void evaluateApplet(ProcessResult pr, String baseName) { - String s8 = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*"; - Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8)); - String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*"; - Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9)); - String ss = "xception"; - Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss)); - } - - @NeedsDisplay - @Test - public void AppletWebstartBaseURLTest() throws Exception { - ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp"); - evaluateApplet(pr, ""); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR855") - @NeedsDisplay - @Test - @TestInBrowsers(testIn={Browsers.one}) - public void AppletInFirefoxTest() throws Exception { - ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html"); - pr.process.destroy(); - evaluateApplet(pr, "AppletBaseURLTest.html"); - Assert.assertTrue(pr.wasTerminated); - } - - @Bug(id="PR855") - @NeedsDisplay - @Test - @TestInBrowsers(testIn={Browsers.one}) - public void AppletWithJNLPHrefTest() throws Exception { - ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html"); - pr.process.destroy(); - evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html"); - Assert.assertTrue(pr.wasTerminated); - } -} diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html b/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html deleted file mode 100644 index aed49b8..0000000 --- a/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html +++ /dev/null @@ -1,42 +0,0 @@ - - -

-

- - diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp b/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp deleted file mode 100644 index 6a2325d..0000000 --- a/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - AppletReadsInvalidJar - IcedTea - - AppletTest - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar b/tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar deleted file mode 100644 index e69de29..0000000 diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/srcs/Valid.java b/tests/jnlp_tests/simple/AppletReadsInvalidJar/srcs/Valid.java deleted file mode 100644 index 9b0bcd6..0000000 --- a/tests/jnlp_tests/simple/AppletReadsInvalidJar/srcs/Valid.java +++ /dev/null @@ -1,58 +0,0 @@ -import java.applet.Applet; - -/* -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class Valid extends Applet { - - private static class Killer extends Thread { - @Override - public void run() { - try { - int n = 2000; - Thread.sleep(n); - System.exit(0); - } catch (Exception ex) { - } - } - } - - @Override - public void init() { - new Killer().start(); - System.out.println("Program Executed Correctly."); - } -} diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java b/tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java deleted file mode 100644 index 11b0bb0..0000000 --- a/tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java +++ /dev/null @@ -1,69 +0,0 @@ -/* AppletReadsInvalidJarTests.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import org.junit.Assert; - -import org.junit.Test; - -public class AppletReadsInvalidJarTests extends BrowserTest{ - - - static final String CORRECT_EXECUTION = "Program Executed Correctly."; - static final String JNLP_EXPECTED_EXCEPTION = "ZipException"; - - /*This SHOULD NOT execute the applet!*/ - @Test - public void AppletJNLPTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp"); - - Assert.assertFalse("AppletReadsInvalidJar stdout should NOT contain '" + CORRECT_EXECUTION + "', but did (applet should not have ran!).", pr.stdout.contains(CORRECT_EXECUTION)); - Assert.assertTrue("AppletReadsInvalidJar stderr should contain 'ZipException', but did not.", pr.stderr.contains(JNLP_EXPECTED_EXCEPTION)); - } - - /*This SHOULD execute the applet!*/ - @Test - @TestInBrowsers(testIn={Browsers.one}) - public void AppletInFirefoxTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html"); - - Assert.assertTrue("AppletReadsInvalidJar stdout should contain '" + CORRECT_EXECUTION + "' but did not.", pr.stdout.contains(CORRECT_EXECUTION)); - } -} diff --git a/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.html b/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.html deleted file mode 100644 index fcd9454..0000000 --- a/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.html +++ /dev/null @@ -1,44 +0,0 @@ - - -

- - -

- - diff --git a/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp b/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp deleted file mode 100644 index 76ea69f..0000000 --- a/tests/jnlp_tests/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp +++ /dev/null @@ -1,63 +0,0 @@ - - - - - AppletTakesLastParam - IcedTea - - AppletTakesLastParam - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java b/tests/jnlp_tests/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java deleted file mode 100644 index 9d2b44d..0000000 --- a/tests/jnlp_tests/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java +++ /dev/null @@ -1,63 +0,0 @@ - -import java.applet.Applet; - -/* AppletTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class AppletTakesLastParam extends Applet { - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing itself after " + n + " ms"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer = new Killer(); - - @Override - public void init() { - System.out.println(getParameter("param")); - killer.start(); - } -} diff --git a/tests/jnlp_tests/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java b/tests/jnlp_tests/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java deleted file mode 100644 index 206f6de..0000000 --- a/tests/jnlp_tests/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java +++ /dev/null @@ -1,68 +0,0 @@ -/* AppletTestTests.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; - -import org.junit.Test; - -public class AppletTakesLastParamTests extends BrowserTest { - - @Test - public void AppletTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavaws(null, "/appletTakesLastParam.jnlp"); - evaluateApplet(pr); - } - - private void evaluateApplet(ProcessResult pr) { - String s0 = "value1"; - Assert.assertTrue("AppletTakesLastParam stdout should not contain " + s0 + " but did.", !pr.stdout.contains(s0)); - String s1 = "value2"; - Assert.assertTrue("AppletTakesLastParam stdout should contain " + s1 + " but did not.", pr.stdout.contains(s1)); - } - - @Test - @TestInBrowsers(testIn = {Browsers.one}) - public void AppletInFirefoxTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html"); - evaluateApplet(pr); - } -} diff --git a/tests/jnlp_tests/simple/AppletTest/resources/AppletTest.jnlp b/tests/jnlp_tests/simple/AppletTest/resources/AppletTest.jnlp deleted file mode 100644 index 1b27e8f..0000000 --- a/tests/jnlp_tests/simple/AppletTest/resources/AppletTest.jnlp +++ /dev/null @@ -1,63 +0,0 @@ - - - - - AppletTest - IcedTea - - AppletTest - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html b/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html deleted file mode 100644 index a2613d9..0000000 --- a/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests.html +++ /dev/null @@ -1,44 +0,0 @@ - - -

- - -

- - diff --git a/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests2.html b/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests2.html deleted file mode 100644 index a5c370c..0000000 --- a/tests/jnlp_tests/simple/AppletTest/resources/appletAutoTests2.html +++ /dev/null @@ -1,44 +0,0 @@ - - -

- - -

- - diff --git a/tests/jnlp_tests/simple/AppletTest/resources/appletViewTest.html b/tests/jnlp_tests/simple/AppletTest/resources/appletViewTest.html deleted file mode 100644 index 0b489c8..0000000 --- a/tests/jnlp_tests/simple/AppletTest/resources/appletViewTest.html +++ /dev/null @@ -1,52 +0,0 @@ - - -ok applet - -

ok applet

-

- -

-

ok applet

-

bad applet

-

- -

-

bad applet

- - diff --git a/tests/jnlp_tests/simple/AppletTest/srcs/AppletTest.java b/tests/jnlp_tests/simple/AppletTest/srcs/AppletTest.java deleted file mode 100644 index bac629a..0000000 --- a/tests/jnlp_tests/simple/AppletTest/srcs/AppletTest.java +++ /dev/null @@ -1,82 +0,0 @@ - -import java.applet.Applet; - -/* AppletTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class AppletTest extends Applet { - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Aplet killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - System.out.println("applet was initialised"); - killer = new Killer(); - } - - @Override - public void start() { - System.out.println("applet was started"); - System.out.println(getParameter("key1")); - System.out.println(getParameter("key2")); - killer.start(); - System.out.println("killer was started"); - } - - @Override - public void stop() { - System.out.println("applet was stopped"); - } - - @Override - public void destroy() { - System.out.println("applet will be destroyed"); - } -} diff --git a/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java b/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java deleted file mode 100644 index 9fd662d..0000000 --- a/tests/jnlp_tests/simple/AppletTest/testcases/AppletTestTests.java +++ /dev/null @@ -1,141 +0,0 @@ -/* AppletTestTests.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; - -import org.junit.Test; - -public class AppletTestTests extends BrowserTest { - - @Test - @TestInBrowsers(testIn = {Browsers.googleChrome}) - @NeedsDisplay - public void doubleChrome() throws Exception { - server.PROCESS_TIMEOUT = 30 * 1000; - try { - //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); - //just verify loging is recording browser - ServerAccess.ProcessResult pr1 = server.executeBrowser("/appletAutoTests.html"); - if (pr1.process == null) { - Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so " - + ServerAccess.UNSET_BROWSER - + " should be in exception, but exception was " - + pr1.deadlyException.getMessage(), - pr1.deadlyException.getMessage().contains(ServerAccess.UNSET_BROWSER)); - return; - } - evaluateApplet(pr1); - Assert.assertTrue(pr1.wasTerminated); - //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); - // just verify loging is recording browser - ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); - evaluateApplet(pr); - Assert.assertTrue(pr.wasTerminated); - } finally { - server.PROCESS_TIMEOUT = 20 * 1000; //back to normal - } - } - - @Test - @NeedsDisplay - public void AppletTest() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp"); - evaluateApplet(pr); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - private void evaluateApplet(ProcessResult pr) { - String s3 = "applet was initialised"; - Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3)); - String s0 = "applet was started"; - Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0)); - String s1 = "value1"; - Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1)); - String s2 = "value2"; - Assert.assertTrue("AppletTest stdout should contains " + s2 + " bud didn't", pr.stdout.contains(s2)); - String s4 = "applet was stopped"; - Assert.assertFalse("AppletTest stdout shouldn't contains " + s4 + " bud did", pr.stdout.contains(s4)); - String s5 = "applet will be destroyed"; - Assert.assertFalse("AppletTest stdout shouldn't contains " + s5 + " bud did", pr.stdout.contains(s5)); - String ss = "xception"; - Assert.assertFalse("AppletTest stderr should not contains " + ss + " but did", pr.stderr.contains(ss)); - String s7 = "Aplet killing himself after 2000 ms of life"; - Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7)); - } - - @Test - @TestInBrowsers(testIn = {Browsers.all}) - @NeedsDisplay - public void AppletInBrowserTest() throws Exception { - //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); - //just verify loging is recordingb rowser - ServerAccess.PROCESS_TIMEOUT = 30 * 1000; - try { - ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests2.html"); - evaluateApplet(pr); - Assert.assertTrue(pr.wasTerminated); - //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null - } finally { - ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal - } - } - - @TestInBrowsers(testIn = {Browsers.all}) - @NeedsDisplay - public void AppletInBrowserTestXslowX() throws Exception { - //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); - //just verify loging is recording browser - ServerAccess.PROCESS_TIMEOUT = 30 * 1000; - try { - ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); - pr.process.destroy(); - evaluateApplet(pr); - Assert.assertTrue(pr.wasTerminated); - //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null - } finally { - ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal - } - } -} diff --git a/tests/jnlp_tests/simple/CheckServices/resources/CheckPluginServices.html b/tests/jnlp_tests/simple/CheckServices/resources/CheckPluginServices.html deleted file mode 100644 index 0cdb0b7..0000000 --- a/tests/jnlp_tests/simple/CheckServices/resources/CheckPluginServices.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/CheckServices/resources/CheckServices.jnlp b/tests/jnlp_tests/simple/CheckServices/resources/CheckServices.jnlp deleted file mode 100644 index 22419b5..0000000 --- a/tests/jnlp_tests/simple/CheckServices/resources/CheckServices.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - CheckServices - IcedTea - - CheckServices - - - - - - - - diff --git a/tests/jnlp_tests/simple/CheckServices/srcs/CheckServices.java b/tests/jnlp_tests/simple/CheckServices/srcs/CheckServices.java deleted file mode 100644 index df5205a..0000000 --- a/tests/jnlp_tests/simple/CheckServices/srcs/CheckServices.java +++ /dev/null @@ -1,109 +0,0 @@ -/* CheckServices.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import javax.jnlp.ServiceManager; -import javax.jnlp.BasicService; -import java.applet.Applet; - -public class CheckServices extends Applet { - - public CheckServices() { - System.out.println("Applet constructor reached."); - checkSetup("constructor"); - } - - public void checkSetup(String method) { - try { - BasicService basicService = - (BasicService)ServiceManager.lookup("javax.jnlp.BasicService"); - // getCodeBase() will return null if ServiceManager does not - // have access to ApplicationInstance. - String codebase = basicService.getCodeBase().toString(); - System.out.println("Codebase for applet was found in " + method - + ": " + codebase); - } catch (NullPointerException npe) { - System.err.println("Exception occurred with null codebase in " + method); - npe.printStackTrace(); - } catch (Exception ex) { - System.err.println("Exception occurred (probably with ServiceManager)."); - ex.printStackTrace(); - } - } - - @Override - public void init() { - System.out.println("Applet is initializing."); - checkSetup("init()"); - } - - @Override - public void start() { - System.out.println("Applet is starting."); - checkSetup("start()"); - // FIXME: Instead of killing the thread, use the AWT robot to close - // the applet window, signaling the event that runs stop/destroy. - System.out.println("Killer thread is starting."); - Thread killer = new Thread() { - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing itself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - }; - killer.start(); - } - - /* FIXME: Check ServiceManagaer is setup once stop/destroy can be called. - @Override - public void stop() { - System.out.println("Applet is stopping."); - checkSetup("stop()"); - } - - @Override - public void destroy() { - System.out.println("Applet is destorying itself."); - checkSetup("destroy()"); - } - */ -} diff --git a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java b/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java deleted file mode 100644 index a36e394..0000000 --- a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/* CheckServicesTests.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; - -import org.junit.Assert; -import org.junit.Test; - -@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017153.html") -public class CheckServicesTests extends BrowserTest{ - - public void evaluateApplet(ProcessResult pr) { - String s0 = "Codebase for applet was found in constructor"; - Assert.assertTrue("CheckServices stdout should contain `" + s0 + "' but didn't.", pr.stdout.contains(s0)); - String s1 = "Codebase for applet was found in init()"; - Assert.assertTrue("CheckServices stdout should contain `" + s1 + "' but didn't.", pr.stdout.contains(s1)); - String s2 = "Codebase for applet was found in start()"; - Assert.assertTrue("CheckServices stdout should contain `" + s2 + "' but didn't.", pr.stdout.contains(s2)); - /* FIXME: Once the awt robot can close the applet window (i.e. send - * a stop event), stdout should be checked for these asserts. - String s3 = "Codebase for applet was found in stop()"; - Assert.assertTrue("CheckServices stdout should contain `" + s3 + "' but didn't.", pr.stdout.contains(s3)); - String s4 = "Codebase for applet was found in destroy()"; - Assert.assertTrue("CheckServices stdout should contain `" + s4 + "' but didn't.", pr.stdout.contains(s4)); - */ - String s5 = "Exception occurred with null codebase in"; - Assert.assertFalse("CheckServices stderr should not contain `" + s5 + "' but did.", pr.stdout.contains(s5)); - String s6 = "Applet killing itself after 2000 ms of life"; - Assert.assertTrue("CheckServices stdout should contain `" + s6 + "' but didn't.", pr.stdout.contains(s6)); - } - - @Test - @NeedsDisplay - public void CheckWebstartServices() throws Exception { - ProcessResult pr = server.executeJavaws(null, "/CheckServices.jnlp"); - evaluateApplet(pr); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - @Test - @NeedsDisplay - @TestInBrowsers(testIn={Browsers.one}) - public void CheckPluginJNLPHServices() throws Exception { - ProcessResult pr = server.executeBrowser(null, "/CheckPluginServices.html"); - evaluateApplet(pr); - Assert.assertTrue(pr.wasTerminated); - } -} diff --git a/tests/jnlp_tests/simple/CreateClassLoader/resources/CreateClassLoader.jnlp b/tests/jnlp_tests/simple/CreateClassLoader/resources/CreateClassLoader.jnlp deleted file mode 100644 index 6804bcd..0000000 --- a/tests/jnlp_tests/simple/CreateClassLoader/resources/CreateClassLoader.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - set context classloader - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/CreateClassLoader/srcs/CreateClassLoader.java b/tests/jnlp_tests/simple/CreateClassLoader/srcs/CreateClassLoader.java deleted file mode 100644 index e33299e..0000000 --- a/tests/jnlp_tests/simple/CreateClassLoader/srcs/CreateClassLoader.java +++ /dev/null @@ -1,46 +0,0 @@ -/* CreateClassLoader.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.net.URL; -import java.net.URLClassLoader; - -public class CreateClassLoader { - public static void main(String[] args) throws Exception { - URLClassLoader ucl = new URLClassLoader(new URL[0]); - - } -} diff --git a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java deleted file mode 100644 index 46b7300..0000000 --- a/tests/jnlp_tests/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* CreateClassLoaderTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class CreateClassLoaderTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void CreateClassLoaderLunch1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*"; - Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/InformationParser.jnlp b/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/InformationParser.jnlp deleted file mode 100644 index aabd685..0000000 --- a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/InformationParser.jnlp +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleParser.jnlp b/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleParser.jnlp deleted file mode 100644 index fad50cc..0000000 --- a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleParser.jnlp +++ /dev/null @@ -1,52 +0,0 @@ - - - - - IcedTea - - Title tag missing - - - - - - - - - diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp b/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp deleted file mode 100644 index f3159b9..0000000 --- a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - Title/Vendor tags missing - - - - - - - - - diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/VendorParser.jnlp b/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/VendorParser.jnlp deleted file mode 100644 index 5a76e1e..0000000 --- a/tests/jnlp_tests/simple/InformationTitleVendorParser/resources/VendorParser.jnlp +++ /dev/null @@ -1,52 +0,0 @@ - - - - - VendorParser - - Vendor tag missing - - - - - - - - - diff --git a/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java b/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java deleted file mode 100644 index b760441..0000000 --- a/tests/jnlp_tests/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* InformationTitleVendorParserTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class InformationTitleVendorParserTest { - - private static ServerAccess server = new ServerAccess(); - - public void runTest(String jnlpName, String exceptionMessage) throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/" + jnlpName + ".jnlp"); - String s1 = "Good simple javaws exapmle"; - Assert.assertFalse("test" + jnlpName + " stdout should not contain " + s1 + " but did.", pr.stdout.contains(s1)); - // Looking for "Could not read or parse the JNLP file. (${DESCRIPTION})" - String s2 = "(?s).*Could not read or parse the JNLP file.{0,5}" + exceptionMessage + "(?s).*"; - Assert.assertTrue("testForTitle stderr should match " + s2 + " but did not.", pr.stderr.matches(s2)); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - @Test - public void testInformationeParser() throws Exception { - runTest("InformationParser", "No information section defined"); - } - - @Test - public void testTitleParser() throws Exception { - runTest("TitleParser", "The title section has not been defined in the JNLP file."); - } - @Test - public void testVendorParser() throws Exception { - runTest("VendorParser", "The vendor section has not been defined in the JNLP file."); - } - - @Test - public void testTitleVendorParser() throws Exception { - // Note that the title message missing causes an immediate exception, regardless of Vendor. - runTest("TitleVendorParser", "The title section has not been defined in the JNLP file."); - } -} diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp deleted file mode 100644 index 32e4fbb..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Test Thread.getAllStackTraces - IcedTea - - testing jar with manin class in manifest. Invalid xml exception should go out - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp deleted file mode 100644 index 0e91484..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - ManifestedJar-1main2mainNoAppDesc.jnlp - IcedTea - - testing jar with manin class in manifest, hello from manifestedjar1 should go out - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp deleted file mode 100644 index ee8a3bf..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - ManifestedJar-1main2nothingNoAppDesc - IcedTea - - testing jar with manin class in manifest, hello from manifestedjar2 should be printed - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp deleted file mode 100644 index 5faf1e0..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - "ManifestedJar-1mainHaveAppDesc.jnlp - IcedTea - - testing jar with manin class in manifest, hello from manifestedjar2 should be printed - - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp deleted file mode 100644 index 1aaed4a..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - ManifestedJar-1mainNoAppDesc.jnlp - IcedTea - - testing jar with manin class in manifest, hello from manifestedjar should be printed - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp deleted file mode 100644 index 4a6c7a9..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp +++ /dev/null @@ -1,52 +0,0 @@ - - - - - ManifestedJar-1noAppDesc - IcedTea - - testing jar with manin class in manifest, hello from manifestedjar1 shold be printed - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp deleted file mode 100644 index 54ed21a..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp +++ /dev/null @@ -1,49 +0,0 @@ - - - - - ManifestedJar-1noAppDescAtAll - IcedTea - - testing jar with manin class in manifest, exception during launching, no application specified - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp deleted file mode 100644 index 2d60dcd..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - ManifestedJar-1nothing2nothingAppDesc - IcedTea - - testing jar with manin class in manifest. Hello from manifestedjar2 should be printed - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp b/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp deleted file mode 100644 index 476d34b..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - ManifestedJar-1nothing2nothingNoAppDesc - IcedTea - - testing jar with manin class in manifest. Hello from manifestedjar1 should be printed - - - - - - - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF b/tests/jnlp_tests/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF deleted file mode 100644 index badcd09..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: ManifestedJar1 - diff --git a/tests/jnlp_tests/simple/ManifestedJar1/srcs/ManifestedJar1.java b/tests/jnlp_tests/simple/ManifestedJar1/srcs/ManifestedJar1.java deleted file mode 100644 index a7cfb9b..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/srcs/ManifestedJar1.java +++ /dev/null @@ -1,45 +0,0 @@ -/* AllStackTraces.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class ManifestedJar1 { - public static void main(String[] args) { - hello1(); - } - public static void hello1() { - System.out.println("Hello from ManifestedJar1"); - } -} diff --git a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java b/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java deleted file mode 100644 index 47baa6f..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java +++ /dev/null @@ -1,217 +0,0 @@ -/* ManifestedJar1Test.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.annotations.Bug; -import org.junit.Assert; - -import org.junit.Test; - -@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017435.html") -public class ManifestedJar1Test { - - private static ServerAccess server = new ServerAccess(); - private static final String nonLunchableMessage = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Not a launchable JNLP file. File must be a JNLP application, applet, or installer type."; - //actually this on eis never printed as stderr will not recieve this message in headless mode :( - private static final String twoMainException = "net.sourceforge.jnlp.ParseException: Invalid XML document syntax"; - - private void assertManifestedJar1(String id, ServerAccess.ProcessResult q) { - String s = "Hello from ManifestedJar1"; - Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); - } - - private void assertManifestedJar2(String id, ServerAccess.ProcessResult q) { - String s = "Hello from ManifestedJar2"; - Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); - } - - private void assertNotManifestedJar1(String id, ServerAccess.ProcessResult q) { - String s = "Hello from ManifestedJar1"; - Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); - } - private void assertAppError(String id, ServerAccess.ProcessResult q) { - Assert.assertTrue(id + " stderr should contains `" + nonLunchableMessage + "`, but didnn't ", q.stderr.contains(nonLunchableMessage)); - } - - private void assertNotManifestedJar2(String id, ServerAccess.ProcessResult q) { - String s = "Hello from ManifestedJar2"; - Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); - } - - private void assertNotDead(String id, ServerAccess.ProcessResult pr) { - String cc = "ClassNotFoundException"; - Assert.assertFalse(id + " stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse(id + " should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Test - /** - * if two jars with manifest specified, none is main and no main class, then first one is loaded - */ - public void manifestedJar1nothing2nothingNoAppDesc() throws Exception { - String id = "ManifestedJar-1nothing2nothingNoAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar1(id, pr); - assertNotDead(id, pr); - } - - /** - *if one jar with manifest, is not main, and no main class then is lunched - * - */ - @Test - public void manifestedJar1noAppDesc() throws Exception { - String id = "ManifestedJar-1noAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar1(id, pr); - assertNotDead(id, pr); - } - - /** - *if one jar with manifest, but not marked as main and no main class then is lunched - * - */ - @Test - public void manifestedJar1mainNoAppDesc() throws Exception { - String id = "ManifestedJar-1mainNoAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar1(id, pr); - assertNotDead(id, pr); - } - - /** - *if one jar with manifest, marked as main and no main class then is lunched - * - */ - @Test - public void ManifestedJar1mainHaveAppDesc() throws Exception { - String id = "ManifestedJar-1mainHaveAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar2(id, pr); - assertNotDead(id, pr); - } - - /** - * - * Two jars, both with manifest, First is main, but specified mainclass belongs to second one, then second one should be lunched - */ - @Test - public void ManifestedJar1main2nothingNoAppDesc() throws Exception { - String id = "ManifestedJar-1main2nothingNoAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar2(id, pr); - assertNotDead(id, pr); - } - - /** - * - * Two jars, both with manifest, seconds is main, no mainclass, then the one marked as main is lunched - */ - @Test - public void manifestedJar1main2nothingNoAppDesc() throws Exception { - String id = "ManifestedJar-1main2nothingNoAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar2(id, pr); - assertNotDead(id, pr); - } - - /** - * - * Two jars, both with manifest, sboth with main tag, no app desc - * - * thisis passing, SUSPICIOUS, but to lunch at least something is better then to lunch nothing at all. - * althoug it maybe SHOULD throw twoMainException - */ - @Test - public void manifestedJar1main2mainNoAppDesc() throws Exception { - String id = "ManifestedJar-1main2mainNoAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertManifestedJar1(id, pr); - assertNotDead(id, pr); - } - - /** - * - * Two jars, both with manifest, sboth with main tag, have app desc - * - * corectly failing with twoMainException - */ - @Test - public void manifestedJar1main2mainAppDesc() throws Exception { - String id = "ManifestedJar-1main2mainAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertNotManifestedJar1(id, pr); - assertNotManifestedJar2(id, pr); - assertNotDead(id, pr); - } - - /** - * - * Two jars, both with manifest, sboth with main tag, have app desc - * - * corectly failing - */ - @Test - public void manifestedJar1noAppDescAtAll() throws Exception { - String id = "ManifestedJar-1noAppDescAtAll"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertNotManifestedJar1(id, pr); - assertNotManifestedJar2(id, pr); - assertAppError(id, pr); - assertNotDead(id, pr); - } - - - - /** - * - * Two jars, both with manifest, non with main tag, have app desc - * - * this jnlp is NOT lunched, twoMainException thrown - ok - * - */ - @Test - public void manifestedJar1nothing2nothingAppDesc() throws Exception { - String id = "ManifestedJar-1nothing2nothingAppDesc"; - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); - assertNotManifestedJar2(id, pr); - assertNotManifestedJar1(id, pr); - assertNotDead(id, pr); - } - -} diff --git a/tests/jnlp_tests/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF b/tests/jnlp_tests/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF deleted file mode 100644 index d11e8a5..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: ManifestedJar2 - diff --git a/tests/jnlp_tests/simple/ManifestedJar2/srcs/ManifestedJar2.java b/tests/jnlp_tests/simple/ManifestedJar2/srcs/ManifestedJar2.java deleted file mode 100644 index 3682209..0000000 --- a/tests/jnlp_tests/simple/ManifestedJar2/srcs/ManifestedJar2.java +++ /dev/null @@ -1,45 +0,0 @@ -/* AllStackTraces.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class ManifestedJar2 { - public static void main(String[] args) { - hello2(); - } - public static void hello2() { - System.out.println("Hello from ManifestedJar2"); - } -} diff --git a/tests/jnlp_tests/simple/ReadEnvironment/resources/ReadEnvironment.jnlp b/tests/jnlp_tests/simple/ReadEnvironment/resources/ReadEnvironment.jnlp deleted file mode 100644 index dd3bce4..0000000 --- a/tests/jnlp_tests/simple/ReadEnvironment/resources/ReadEnvironment.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - ReadEnvironment using System.getenv() - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/ReadEnvironment/srcs/ReadEnvironment.java b/tests/jnlp_tests/simple/ReadEnvironment/srcs/ReadEnvironment.java deleted file mode 100644 index a426803..0000000 --- a/tests/jnlp_tests/simple/ReadEnvironment/srcs/ReadEnvironment.java +++ /dev/null @@ -1,44 +0,0 @@ -/* ReadEnvironment.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class ReadEnvironment { - public static void main(String[] args) { - - System.getenv("USER"); - - } -} diff --git a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java deleted file mode 100644 index 5d82da4..0000000 --- a/tests/jnlp_tests/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* ReadEnvironmentTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class ReadEnvironmentTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void ReadEnvironmentLunch1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*"; - Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties1.jnlp b/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties1.jnlp deleted file mode 100644 index 54873c2..0000000 --- a/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties1.jnlp +++ /dev/null @@ -1,17 +0,0 @@ - - - - read properties using System.getenv() - IcedTea - - - - - - user.name - - - - diff --git a/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties2.jnlp b/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties2.jnlp deleted file mode 100644 index f4e5418..0000000 --- a/tests/jnlp_tests/simple/ReadProperties/resources/ReadProperties2.jnlp +++ /dev/null @@ -1,15 +0,0 @@ - - - - read properties using System.getenv() - IcedTea - - - - - - user.home - - diff --git a/tests/jnlp_tests/simple/ReadProperties/srcs/ReadProperties.java b/tests/jnlp_tests/simple/ReadProperties/srcs/ReadProperties.java deleted file mode 100644 index f031369..0000000 --- a/tests/jnlp_tests/simple/ReadProperties/srcs/ReadProperties.java +++ /dev/null @@ -1,45 +0,0 @@ -/* ReadProperties.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class ReadProperties { - -/** -*some system property is expected as arg[0], eg user.name or user.home -*/ - public static void main(String[] args) { - System.out.println(System.getProperty(args[0])); - } -} diff --git a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java deleted file mode 100644 index dfe9590..0000000 --- a/tests/jnlp_tests/simple/ReadProperties/testcases/ReadPropertiesTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* ReadPropertiesTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class ReadPropertiesTest { - - private static ServerAccess server = new ServerAccess(); - - - @Test - public void ReadPropertiesLunch1() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; - Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - @Test - public void ReadPropertiesLunch2() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*"; - Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - } diff --git a/tests/jnlp_tests/simple/RedirectStreams/resources/RedirectStreams.jnlp b/tests/jnlp_tests/simple/RedirectStreams/resources/RedirectStreams.jnlp deleted file mode 100644 index ca26613..0000000 --- a/tests/jnlp_tests/simple/RedirectStreams/resources/RedirectStreams.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - redirect stdin/stdout streams - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/RedirectStreams/srcs/RedirectStreams.java b/tests/jnlp_tests/simple/RedirectStreams/srcs/RedirectStreams.java deleted file mode 100644 index 2130168..0000000 --- a/tests/jnlp_tests/simple/RedirectStreams/srcs/RedirectStreams.java +++ /dev/null @@ -1,44 +0,0 @@ -/* RedirectStreams.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.io.StringBufferInputStream; - -public class RedirectStreams { - public static void main(String[] args) { - System.setIn(new StringBufferInputStream("TEST")); - } -} diff --git a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java deleted file mode 100644 index 1d745c7..0000000 --- a/tests/jnlp_tests/simple/RedirectStreams/testcases/RedirectStreamsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* RedirectStreamsTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class RedirectStreamsTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void RedirectStreamsTest1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*"; - Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp b/tests/jnlp_tests/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp deleted file mode 100644 index 4f153bf..0000000 --- a/tests/jnlp_tests/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - Test replacing security manager - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java b/tests/jnlp_tests/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java deleted file mode 100644 index e00cd5a..0000000 --- a/tests/jnlp_tests/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java +++ /dev/null @@ -1,43 +0,0 @@ -/* ReplaceSecurityManager.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -public class ReplaceSecurityManager { - public static void main(String[] args) throws Exception{ - - System.setSecurityManager(null); - - } -} diff --git a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java deleted file mode 100644 index 73bbd9d..0000000 --- a/tests/jnlp_tests/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* ReplaceSecurityManagerTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class ReplaceSecurityManagerTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void ReplaceSecurityManagerLunch1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*"; - Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp b/tests/jnlp_tests/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp deleted file mode 100644 index 996bb88..0000000 --- a/tests/jnlp_tests/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp +++ /dev/null @@ -1,13 +0,0 @@ - - - - set context classloader - IcedTea - - - - - - diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/srcs/SetContextClassLoader.java b/tests/jnlp_tests/simple/SetContextClassLoader/srcs/SetContextClassLoader.java deleted file mode 100644 index 5c5b215..0000000 --- a/tests/jnlp_tests/simple/SetContextClassLoader/srcs/SetContextClassLoader.java +++ /dev/null @@ -1,44 +0,0 @@ -/* SetContextClassLoader.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SetContextClassLoader { - public static void main(String[] args) throws Exception{ - - Thread.currentThread().setContextClassLoader(null); - - } -} diff --git a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java deleted file mode 100644 index f45aedb..0000000 --- a/tests/jnlp_tests/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* SetContextClassLoaderTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class SetContextClassLoaderTest { - - private static ServerAccess server = new ServerAccess(); - - @Test - public void SetContextClassLoader1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); - String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*"; - Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); - String cc="ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); - Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); - Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git "a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" "b/tests/jnlp_tests/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" deleted file mode 100644 index 9856676..0000000 --- "a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" +++ /dev/null @@ -1,61 +0,0 @@ - - - - - Spaces can be everywhere test with few more chars for encoding - IcedTea - - AppletTest - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp b/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp deleted file mode 100644 index 245b01d..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Spaces can be everywhere1 - IcedTea - - Spaces can be everywhere1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp b/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp deleted file mode 100644 index 274add7..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Spaces can be everywhere2 - IcedTea - - Spaces can be everywhere2 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp b/tests/jnlp_tests/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp deleted file mode 100644 index 22b77b0..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/spaces applet Tests.html b/tests/jnlp_tests/simple/Spaces can be everywhere/resources/spaces applet Tests.html deleted file mode 100644 index 74b7554..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/resources/spaces applet Tests.html +++ /dev/null @@ -1,42 +0,0 @@ - - -

-

- - diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java b/tests/jnlp_tests/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java deleted file mode 100644 index e65544b..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java +++ /dev/null @@ -1,76 +0,0 @@ - -import java.applet.Applet; - -/* SpacesCanBeEverywhere.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SpacesCanBeEverywhere extends Applet{ - - public static void main(String[] args){ - System.out.println("Spaces can be everywhere.jsr was launched correctly"); - } - - private class Killer extends Thread { - - public int n = 2000; - - @Override - public void run() { - try { - Thread.sleep(n); - System.out.println("Applet killing himself after " + n + " ms of life"); - System.exit(0); - } catch (Exception ex) { - } - } - } - private Killer killer; - - @Override - public void init() { - killer = new Killer(); - } - - @Override - public void start() { - main(null); - killer.start(); - System.out.println("killer was started"); - } - - -} diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java b/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java deleted file mode 100644 index cb2a98f..0000000 --- a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java +++ /dev/null @@ -1,244 +0,0 @@ -/* SpacesCanBeEverywhereTests.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.ArrayList; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.annotations.Bug; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; -import org.junit.Test; - -@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"}) -public class SpacesCanBeEverywhereTests extends BrowserTest { - - - @Bug(id="PR811") - @Test - @NeedsDisplay - public void SpacesCanBeEverywhereLocalAppletTestsJnlp2() throws Exception { - List commands=new ArrayList(1); - commands.add(server.getJavawsLocation()); - commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too.jnlp"); - /* Change of dir is cousing the Exception bellow - * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - * No X11 DISPLAY variable was set, but this program performed an operation which requires it. - * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) - * at java.awt.Window.(Window.java:476) - * at java.awt.Frame.(Frame.java:419) - * at java.awt.Frame.(Frame.java:384) - * at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1754) - * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831) - * at javax.swing.JWindow.(JWindow.java:185) - * at javax.swing.JWindow.(JWindow.java:137) - * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.(JNLPSecurityManager.java:121) - * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202) - * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177) - * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) - * at java.security.AccessController.doPrivileged(Native Method) - * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) - * - * Thats why there is absolute path to the file. - * - * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing - - * it is in headless mode. This can be considered as bug, but because it is - * only on ocal files, and probably only from test run - it can be ignored - */ - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - @NeedsDisplay - public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); - } - - @Bug(id="PR811") - @Test - @NeedsDisplay - @TestInBrowsers(testIn = {Browsers.all}) - public void SpacesCanBeEverywhereRemoteAppletTestsHtml2() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "xception"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); - } - - - @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"}) - @Test - public void SpacesCanBeEverywhereRemoteTests1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp"); - String s = "Good simple javaws exapmle"; - Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2_withQuery1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests2_withQuery2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR811") - @Test - public void SpacesCanBeEverywhereRemoteTests3() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp"); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests1() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("Spaces can be everywhere1.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s = "Good simple javaws exapmle"; - Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests2() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("Spaces can be everywhere2.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests4() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add(server.getDir()+"/Spaces can be everywhere2.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } - - @Bug(id="PR804") - @Test - public void SpacesCanBeEverywhereLocalTests3() throws Exception { - List commands=new ArrayList(4); - commands.add(server.getJavawsLocation()); - commands.add(ServerAccess.HEADLES_OPTION); - commands.add("SpacesCanBeEverywhere1.jnlp"); - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); - String s="Spaces can be everywhere.jsr was launched correctly"; - Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); - String cc = "ClassNotFoundException"; - Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); - Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); - Assert.assertEquals((Integer) 0, pr.returnValue); - } -} diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp deleted file mode 100644 index 979058d..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - UnsignedJnlpApplication - IcedTea - - UnsignedJnlpApplication - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp deleted file mode 100644 index 84f7539..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp +++ /dev/null @@ -1,56 +0,0 @@ - - - - - UnsignedJnlpApplication - IcedTea - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp deleted file mode 100644 index d5e6584..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - DIFFERENTJnlpApplicationNAME - IcedTea - - UnsignedJnlpApplication - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp deleted file mode 100644 index e4a3722..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - UnsignedJnlpApplication - IcedTea - - UnsignedJnlpApplication - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java b/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java deleted file mode 100644 index f4afa4f..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java +++ /dev/null @@ -1,43 +0,0 @@ -/* UnsignedJnlpApplication.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class UnsignedJnlpApplication { - - public static void main(String[] args) { - System.out.println("Running unsigned application in main"); - } -} diff --git a/tests/jnlp_tests/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java b/tests/jnlp_tests/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java deleted file mode 100644 index e48509d..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* UnsignedJnlpApplicationTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class UnsignedJnlpApplicationTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - private final String outputString = "Running unsigned application in main"; - - @Test - public void jnlpFileIsUnchecked1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } - - @Test - public void jnlpFileIsUnchecked2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } - - @Test - public void jnlpFileIsUnchecked3() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } -} diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp deleted file mode 100644 index 077c5dc..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - UnsignedJnlpTemplate - IcedTea - - UnsignedJnlpTemplate - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp deleted file mode 100644 index f665a93..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp +++ /dev/null @@ -1,56 +0,0 @@ - - - - - UnsignedJnlpTemplate - IcedTea - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp deleted file mode 100644 index abbd085..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp +++ /dev/null @@ -1,57 +0,0 @@ - - - - - DIFFERENTJnlpTemplateNAME - IcedTea - - UnsignedJnlpTemplate - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp deleted file mode 100644 index 5a9dce0..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp +++ /dev/null @@ -1,62 +0,0 @@ - - - - - UnsignedJnlpTemplate - IcedTea - - UnsignedJnlpTemplate - - - - - - - - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java deleted file mode 100644 index 3883c22..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java +++ /dev/null @@ -1,43 +0,0 @@ -/* UnsignedJnlpTemplate.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class UnsignedJnlpTemplate { - - public static void main(String[] args) { - System.out.println("Running unsigned application in main"); - } -} diff --git a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java b/tests/jnlp_tests/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java deleted file mode 100644 index b2aec62..0000000 --- a/tests/jnlp_tests/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* UnsignedJnlpTemplateTest.java -Copyright (C) 2012 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; -import org.junit.Test; - -public class UnsignedJnlpTemplateTest { - - private static ServerAccess server = new ServerAccess(); - private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); - private final String outputString = "Running unsigned application in main"; - - @Test - public void jnlpTemplateIsUnchecked1() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } - - @Test - public void jnlpTemplateIsUnchecked2() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } - - @Test - public void jnlpTemplateIsUnchecked3() throws Exception { - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp"); - Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); - } -} \ No newline at end of file diff --git a/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest.jnlp b/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest.jnlp deleted file mode 100644 index f45c475..0000000 --- a/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest_1.jnlp b/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest_1.jnlp deleted file mode 100644 index bf7e82c..0000000 --- a/tests/jnlp_tests/simple/deadlocktest/resources/deadlocktest_1.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java b/tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java deleted file mode 100644 index 4d348b0..0000000 --- a/tests/jnlp_tests/simple/deadlocktest/srcs/DeadlockTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* DeadlockTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class DeadlockTest { - - private static final int DEADLOCK_TEST_TIME_OF_LIFE=30000; - - public static void main(String[] args) throws Exception { - long startTime = System.nanoTime() / 1000000l; - System.out.println("Deadlock test started"); - int i=0; - while (true) { - long now = System.nanoTime() / 1000000l; - Thread.sleep(3500); - i++; - System.out.println(i+" Deadlock sleeping"); - if (now - startTime > DEADLOCK_TEST_TIME_OF_LIFE) { - System.out.println("This process is hanging more then "+DEADLOCK_TEST_TIME_OF_LIFE/1000+"s. Should be killed"); - System.out.flush(); - System.exit(5); - } - } - } -} diff --git a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java b/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java deleted file mode 100644 index b2e0a48..0000000 --- a/tests/jnlp_tests/simple/deadlocktest/testcases/DeadLockTestTest.java +++ /dev/null @@ -1,267 +0,0 @@ -/* DeadLockTestTest.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import java.util.ArrayList; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.ServerAccess.ProcessResult; -import org.junit.Assert; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.junit.BeforeClass; - -import org.junit.Test; - -public class DeadLockTestTest { - - private static ServerAccess server = new ServerAccess(); - private static String deadlocktest_1 = "/deadlocktest_1.jnlp"; - private static String deadlocktest = "/deadlocktest.jnlp"; - - @BeforeClass - public static void printJavas() throws Exception { - ServerAccess.logOutputReprint("Currently runnng javas1 " + countJavaInstances()); - - } - - @Test - public void testDeadLockTestTerminated() throws Exception { - testDeadLockTestTerminatedBody(deadlocktest); - testDeadLockTestTerminatedBody(deadlocktest); - ServerAccess.logOutputReprint("Currently running javas12 " + countJavaInstances()); - } - - @Test - public void testDeadLockTestTerminated2() throws Exception { - testDeadLockTestTerminatedBody(deadlocktest_1); - testDeadLockTestTerminatedBody(deadlocktest_1); - /** - * this happens, when p.p.destroy is called before p.interrupt. and destroyed variable is removedI have no idea why, but it is incorrect. - Assert.assertNotNull("return can not be null in no fork process. Was ",pr.returnValue);//in this case forking is forbiden, and sojava throws an exception after destroy - */ - ServerAccess.logOutputReprint("Currently running javas13 " + countJavaInstances()); - } - - public void testDeadLockTestTerminatedBody(String jnlp) throws Exception { - List before = countJavaInstances(); - ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size()); - ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp); - assertDeadlockTestLaunched(pr); - List after = countJavaInstances(); - ServerAccess.logOutputReprint("java2 " + jnlp + " : " + after.size()); - String ss = "This process is hanging more than 30s. Should be killed"; - Assert.assertFalse("stdout should not contains: " + ss + ", but did", pr.stdout.contains(ss)); -// Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application - Assert.assertTrue("testDeadLockTestTerminated should be terminated, but wasn't", pr.wasTerminated); - Assert.assertNull("Killed process must have null return value. Have not - ", pr.returnValue); - killDiff(before, after); - List afterKill = countJavaInstances(); - ServerAccess.logOutputReprint("java3 " + jnlp + " : " + afterKill.size()); - Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); - } - - @Test - public void ensureAtLeasOneJavaIsRunning() throws Exception { - Assert.assertTrue("at least one java should be running, but isn't! Javas are probably counted badly", countJavaInstances().size() > 0); - - } - - @Test - public void testSimpletest1lunchFork() throws Exception { - List before = countJavaInstances(); - ServerAccess.logOutputReprint("java4: " + before.size()); - BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, null); - bd.start(); - Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); - List during = countJavaInstances(); - ServerAccess.logOutputReprint("java5: " + during.size()); - waitForBackgroundDeadlock(bd); - List after = countJavaInstances(); - ServerAccess.logOutputReprint("java6: " + after.size()); - Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); - assertDeadlockTestLaunched(bd.getPr()); - killDiff(before, during); - List afterKill = countJavaInstances(); - ServerAccess.logOutputReprint("java66: " + afterKill.size()); - Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); - // div by two is caused by jav in java process hierarchy - Assert.assertEquals("launched JVMs must be exactly 2, was " + (during.size() - before.size()) / 2, 2, (during.size() - before.size()) / 2); - } - - @Test - public void testSimpletest1lunchNoFork() throws Exception { - List before = countJavaInstances(); - ServerAccess.logOutputReprint("java7: " + before.size()); - BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, Arrays.asList(new String[]{"-Xnofork"})); - bd.start(); - Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); - List during = countJavaInstances(); - ServerAccess.logOutputReprint("java8: " + during.size()); - waitForBackgroundDeadlock(bd); - List after = countJavaInstances(); - ServerAccess.logOutputReprint("java9: " + after.size()); - Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); - assertDeadlockTestLaunched(bd.getPr()); - killDiff(before, during); - List afterKill = countJavaInstances(); - ServerAccess.logOutputReprint("java99: " + afterKill.size()); - Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); - // div by two is caused by jav in java process hierarchy - Assert.assertEquals("launched JVMs must be exactly 1, was " + (during.size() - before.size()) / 2, 1, (during.size() - before.size()) / 2); - } - - /** - * by process assasin destroyed processes are hanging random amount of time as zombies. - * Kill -9 is handling zombies pretty well. - * - * This function kills or processes which are in nw but are not in old - * (eq.to killing new zombies:) ) - * - * @param old - * @param nw - * @return - * @throws Exception - */ - private static List killDiff(List old, List nw) throws Exception { - ensureLinux(); - List result = new ArrayList(); - for (String string : nw) { - if (old.contains(string)) { - continue; - } - ServerAccess.logOutputReprint("Killing " + string); - ServerAccess.PROCESS_LOG = false; - try { - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string})); - } finally { - ServerAccess.PROCESS_LOG = true; - } - result.add(string); - ServerAccess.logOutputReprint("Killed " + string); - } - return result; - } - - private static List countJavaInstances() throws Exception { - ensureLinux(); - List result = new ArrayList(); - ServerAccess.PROCESS_LOG = false; - try { - ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"})); - Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout); - int i = 0; - while (m.find()) { - i++; - String ss = m.group(); - //ServerAccess.logOutputReprint(i+": "+ss); - result.add(ss.trim().split("\\s+")[0]); - } - } finally { - ServerAccess.PROCESS_LOG = true; - } - return result; - - } - - public static void main(String[] args) throws Exception { - ServerAccess.logOutputReprint("" + countJavaInstances()); - } - - private void assertDeadlockTestLaunched(ProcessResult pr) { - String s = "Deadlock test started"; - Assert.assertTrue("Deadlock test should print out " + s + ", but did not", pr.stdout.contains(s)); - String ss = "xception"; - Assert.assertFalse("Deadlock test should not stderr " + ss + " but did", pr.stderr.contains(ss)); - //each 3500 seconds deadlock test stdout something - //timeout is 20s - //so it should write out FIVE sentences, but is mostly just three or four. Last is nearly always consumed by termination - for (int i = 1; i <= 3; i++) { - String sentence = i + " Deadlock sleeping"; - Assert.assertTrue( - "stdout should contains: " + sentence + ", didn't, so framework have consumed to much during termination", - pr.stdout.contains(sentence)); - } - } - - private void waitForBackgroundDeadlock(final BackgroundDeadlock bd) throws InterruptedException { - while (!bd.isFinished()) { - Thread.sleep(500); - - } - } - - private static class BackgroundDeadlock extends Thread { - - private boolean finished = false; - private ProcessResult pr = null; - String jnlp; - List args; - - public BackgroundDeadlock(String jnlp, List args) { - this.jnlp = jnlp; - this.args = args; - } - - @Override - public void run() { - try { - pr = server.executeJavawsHeadless(args, jnlp); - } catch (Exception ex) { - ServerAccess.logException(ex); - } finally { - finished = true; - } - - } - - public ProcessResult getPr() { - return pr; - } - - public boolean isFinished() { - return finished; - } - } - - private static void ensureLinux() { - String os = System.getProperty("os.name").toLowerCase(); - if (!(os.contains("linux") || os.contains("unix"))) { - throw new IllegalStateException("This test can be procesed only on linux like machines"); - } - } -} diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletest1.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletest1.jnlp deleted file mode 100644 index d7d0b85..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletest1.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletestCustomSplash.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletestCustomSplash.jnlp deleted file mode 100644 index 66eb519..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletestCustomSplash.jnlp +++ /dev/null @@ -1,55 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletestMegaSlow.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletestMegaSlow.jnlp deleted file mode 100644 index 7e319d3..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletestMegaSlow.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlow.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlow.jnlp deleted file mode 100644 index 905cf7c..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlow.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest1 - IcedTea - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp deleted file mode 100644 index 0b09c5b..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - simpletest1 - IcedTea - - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp b/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp deleted file mode 100644 index 99ad0b0..0000000 --- a/tests/jnlp_tests/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp +++ /dev/null @@ -1,54 +0,0 @@ - - - - - simpletest1 - IcedTea - - - simpletest1 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest1/srcs/SimpleTest1.java b/tests/jnlp_tests/simple/simpletest1/srcs/SimpleTest1.java deleted file mode 100644 index 0957480..0000000 --- a/tests/jnlp_tests/simple/simpletest1/srcs/SimpleTest1.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SimpleTest1.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SimpleTest1{ - - public static void main(String[] args){ - System.out.println("Good simple javaws exapmle"); - } -} diff --git a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java b/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java deleted file mode 100644 index abc1592..0000000 --- a/tests/jnlp_tests/simple/simpletest1/testcases/SimpleTest1Test.java +++ /dev/null @@ -1,61 +0,0 @@ -/* SimpleTest1Test.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class SimpleTest1Test { - - private static ServerAccess server = new ServerAccess(); - - - - @Test - public void testSimpletest1lunchOk() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest1.jnlp"); - String s="Good simple javaws exapmle"; - Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s)); - String ss="xception"; - Assert.assertFalse("testSimpletest1lunchOk stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); - Assert.assertFalse(pr.wasTerminated); - Assert.assertEquals((Integer)0, pr.returnValue); - } - - } diff --git a/tests/jnlp_tests/simple/simpletest2/resources/simpletest2.jnlp b/tests/jnlp_tests/simple/simpletest2/resources/simpletest2.jnlp deleted file mode 100644 index cc6e11a..0000000 --- a/tests/jnlp_tests/simple/simpletest2/resources/simpletest2.jnlp +++ /dev/null @@ -1,53 +0,0 @@ - - - - - simpletest2 - IcedTea - - simpletest2 - - - - - - - - - diff --git a/tests/jnlp_tests/simple/simpletest2/srcs/SimpleTest2.java b/tests/jnlp_tests/simple/simpletest2/srcs/SimpleTest2.java deleted file mode 100644 index 9160c62..0000000 --- a/tests/jnlp_tests/simple/simpletest2/srcs/SimpleTest2.java +++ /dev/null @@ -1,44 +0,0 @@ -/* SimpleTest2.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -public class SimpleTest2{ - - public static void main(String[] args){ -throw new RuntimeException("Correct exception"); - - } -} diff --git a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java deleted file mode 100644 index 9a77da4..0000000 --- a/tests/jnlp_tests/simple/simpletest2/testcases/SimpleTest2Test.java +++ /dev/null @@ -1,62 +0,0 @@ -/* SimpleTest2Test.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Assert; - -import org.junit.Test; - -public class SimpleTest2Test { - - private static ServerAccess server = new ServerAccess(); - - - @Test - public void testSimpletest2lunchException() throws Exception { - ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); - Assert.assertTrue("stdout should be < 1 , but was "+pr.stdout.trim().length(),pr.stdout.trim().length() < 1); - String s="Correct exception"; - Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); - String ss="Exception"; - Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss)); - Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated); - //Assert.assertFalse(0==pr.returnValue);exception and still returned 0? - } - - - - } diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ContentReaderListener.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ContentReaderListener.java deleted file mode 100644 index 9981a31..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ContentReaderListener.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.sourceforge.jnlp; - -public interface ContentReaderListener { - - public void charReaded(char ch); - public void lineReaded(String s); - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java deleted file mode 100644 index 097ac4f..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java +++ /dev/null @@ -1,389 +0,0 @@ -/* ResourcesTestl.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -package net.sourceforge.jnlp; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Arrays; -import java.util.List; -import net.sourceforge.jnlp.browsertesting.Browser; -import net.sourceforge.jnlp.browsertesting.BrowserFactory; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import net.sourceforge.jnlp.annotations.NeedsDisplay; -import net.sourceforge.jnlp.browsertesting.browsers.LinuxBrowser; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import org.junit.Assert; - -import org.junit.Test; - -public class ResourcesTest extends BrowserTest{ - - - @Test - @NeedsDisplay - public void testNonExisitngBrowserWillNotDeadlock() throws Exception { - server.setCurrentBrowser(Browsers.none); - ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp"); - Assert.assertNull(pr.process); - Assert.assertEquals(pr.stderr, ""); - Assert.assertEquals(pr.stdout, ""); - Assert.assertTrue(pr.wasTerminated); - Assert.assertTrue(pr.returnValue < 0); - junit.framework.Assert.assertNotNull(pr.deadlyException); - } - - @Test - public void testUnexistingProcessWillFailRecognizedly() throws Exception { - server.setCurrentBrowser(Browsers.none); - List al=Arrays.asList(new String[] {"definietly_not_Existing_process"}); - ServerAccess.ProcessResult pr = server.executeProcess(al); - Assert.assertNull(pr.process); - Assert.assertEquals(pr.stderr, ""); - Assert.assertEquals(pr.stdout, ""); - Assert.assertTrue(pr.wasTerminated); - Assert.assertTrue(pr.returnValue < 0); - junit.framework.Assert.assertNotNull(pr.deadlyException); - } - - @Test - public void testGetUrlUponThisInstance() throws MalformedURLException{ - URL u1=server.getUrlUponThisInstance("simple.jsp"); - URL u2=server.getUrlUponThisInstance("/simple.jsp"); - Assert.assertEquals(u1, u2); - } - - @Test - @TestInBrowsers(testIn=Browsers.none) - public void testNonExisitngBrowserWillNotCauseMess() throws Exception { - ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp"); - Assert.assertNull(pr.process); - Assert.assertEquals(pr.stderr, ""); - Assert.assertEquals(pr.stdout, ""); - Assert.assertTrue(pr.wasTerminated); - Assert.assertTrue(pr.returnValue < 0); - junit.framework.Assert.assertNotNull(pr.deadlyException); - } - - @Test - public void testBrowsers2() throws Exception { - List a = BrowserFactory.getFactory().getAllBrowsers(); - Assert.assertNotNull("returned browsers array must not be null", a); - Assert.assertTrue("at least one browser must be configured", a.size() > 0); - for (Browser b : a) { - testBrowser(b); - } - - } - - @Test - @TestInBrowsers(testIn = Browsers.all) - public void testBrowser3() throws Exception { - testBrowser(server.getCurrentBrowser()); - - - } - - @Test - public void testBrowsers1() throws Exception { - BrowserFactory bf = new BrowserFactory(null); - int expected = 0; - Assert.assertTrue("Created from null there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - bf = new BrowserFactory(""); - expected = 0; - Assert.assertTrue("Created from empty there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - String s = "dsgrdg"; - bf = new BrowserFactory(s); - expected = 0; - Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = "sgrg/jkik"; - bf = new BrowserFactory(s); - expected = 0; - Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox + "/jkik"; - bf = new BrowserFactory(s); - expected = 0; - Assert.assertTrue("Created from nonsense " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = "sgrg/jkik:sege"; - bf = new BrowserFactory(s); - expected = 0; - Assert.assertTrue("Created from two nonsenses " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox.toExec() + ":" + Browsers.firefox; - bf = new BrowserFactory(s); - expected = 2; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox.toExec(); - bf = new BrowserFactory(s); - expected = 1; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = "something/somewhere/" + Browsers.firefox.toExec(); - bf = new BrowserFactory(s); - expected = 1; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec(); - bf = new BrowserFactory(s); - expected = 2; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec() + ":" + Browsers.chromiumBrowser; - bf = new BrowserFactory(s); - expected = 3; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox.toExec() + ":" + "vfdgf" + ":" + Browsers.googleChrome.toExec(); - bf = new BrowserFactory(s); - expected = 2; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox.toExec() + ":" + Browsers.chromiumBrowser + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera + ":" + Browsers.epiphany + ":" + Browsers.midori; - bf = new BrowserFactory(s); - expected = 6; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - testFullFactory(bf); - - s = "fgfd/" + Browsers.firefox.toExec() + ":" + "/fgfd/" + Browsers.chromiumBrowser + ":" + "fgfd/dfsdf/" + Browsers.googleChrome.toExec() + ":" + "/g/fgfd/" + Browsers.opera + ":" + Browsers.epiphany + ":" + Browsers.midori; - bf = new BrowserFactory(s); - expected = 6; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - testFullFactory(bf); - - s = Browsers.firefox.toExec() + ":" + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera; - bf = new BrowserFactory(s); - expected = 3; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = Browsers.firefox.toExec() + ":" + ":" + ":" + Browsers.opera; - bf = new BrowserFactory(s); - expected = 2; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = ":" + ":" + Browsers.googleChrome.toExec() + ":"; - bf = new BrowserFactory(s); - expected = 1; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - s = ":" + Browsers.firefox.toExec() + ":bfgbfg/fddf/" + Browsers.googleChrome.toExec() + ":"; - bf = new BrowserFactory(s); - expected = 2; - Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); - - - - - } - - @Test - public void testResourcesExists() throws Exception { - File[] simpleContent = server.getDir().listFiles(new FileFilter() { - - public boolean accept(File file) { - if (!file.isDirectory()) { - return true; - } else { - return false; - } - } - }); - Assert.assertNotNull(simpleContent); - Assert.assertTrue(simpleContent.length > 5); - - for (int i = 0; i < simpleContent.length; i++) { - File file = simpleContent[i]; - ServerAccess.logOutputReprint(file.getName()); - //server port have in fact no usage in converting filename to uri-like-filename. - //But if there is null, instead if some number, then nullpointer exception is thrown (Integer->int). - //So I'm using "real" currently used port, instead of some random value. - URI u = new URI((String) null, (String) null, (String) null, server.getPort(), file.getName(), (String) null, null); - ServerAccess.logOutputReprint(" ("+u.toString()+")"); - String fname = u.toString(); - if (file.getName().toLowerCase().endsWith(".jnlp")) { - String c = server.getResourceAsString("/" + fname); - Assert.assertTrue(c.contains("<")); - Assert.assertTrue(c.contains(">")); - Assert.assertTrue(c.contains("jnlp")); - Assert.assertTrue(c.contains("resources")); - Assert.assertTrue(c.replaceAll("\\s*", "").contains("")); - - } else { - byte[] c = server.getResourceAsBytes("/" + fname).toByteArray(); - Assert.assertEquals(c.length, file.length()); - } - - } - - } - - @Test - @NeedsDisplay - @TestInBrowsers(testIn = Browsers.one) - public void testListeners() throws Exception { - final StringBuilder o1 = new StringBuilder(); - final StringBuilder e1 = new StringBuilder(); - final StringBuilder o2 = new StringBuilder(); - final StringBuilder e2 = new StringBuilder(); - final ContentReaderListener lo = new ContentReaderListener() { - - @Override - public void charReaded(char ch) { - //ServerAccess.logOutputReprint("OO recieved char: "+ch); - o1.append(ch); - } - - @Override - public void lineReaded(String s) { - //ServerAccess.logOutputReprint("OO recieved line: "+s); - o2.append(s).append("\n"); - } - }; - ContentReaderListener le = new ContentReaderListener() { - - @Override - public void charReaded(char ch) { - //ServerAccess.logOutputReprint("EE recieved char: "+ch); - e1.append(ch); - } - - @Override - public void lineReaded(String s) { - //ServerAccess.logOutputReprint("EE recieved line: "+s); - e2.append(s).append("\n"); - } - }; - ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp", le, lo); - server.setCurrentBrowser(BrowserFactory.getFactory().getFirst().getID()); - Assert.assertNotNull(server.getCurrentBrowsers()); - Assert.assertNotNull(server.getCurrentBrowser()); -// ServerAccess.logOutputReprint("total o"); -// ServerAccess.logOutputReprint(pr.stdout); -// ServerAccess.logOutputReprint("total e"); -// ServerAccess.logOutputReprint(pr.stderr); - Assert.assertEquals(pr.stdout, o1.toString()); - Assert.assertEquals(pr.stderr, e1.toString()); - //the last \n is mandatory as las tline is flushed also when proces dies - Assert.assertEquals(pr.stdout.replace("\n", ""), o2.toString().replace("\n", "")); - Assert.assertEquals(pr.stderr.replace("\n", ""), e2.toString().replace("\n", "")); - - } - - private void testFullFactory(BrowserFactory bf) { - Assert.assertEquals(bf.getBrowser(Browsers.chromiumBrowser).getID(), Browsers.chromiumBrowser); - Assert.assertEquals(bf.getBrowser(Browsers.googleChrome).getID(), Browsers.googleChrome); - Assert.assertEquals(bf.getBrowser(Browsers.firefox).getID(), Browsers.firefox); - Assert.assertEquals(bf.getBrowser(Browsers.opera).getID(), Browsers.opera); - Assert.assertEquals(bf.getBrowser(Browsers.epiphany).getID(), Browsers.epiphany); - Assert.assertEquals(bf.getBrowser(Browsers.midori).getID(), Browsers.midori); - } - - private void testBrowser(Browser browser) throws IOException { - File f1 = null; - if (browser.getDefaultPluginExpectedLocation() != null) { - f1 = new File(browser.getDefaultPluginExpectedLocation()); - } - File f2 = null; - if (browser.getUserDefaultPluginExpectedLocation() != null) { - f2 = new File(browser.getUserDefaultPluginExpectedLocation()); - } - if (f1 != null) { - Assert.assertTrue("browser's plugins location should exist " + f1.toString() + " for " + browser.getID().toString(), f1.exists()); - } - if (f2 != null) { - Assert.assertTrue("browser's users-plugins location should exist " + f2.toString() + " for " + browser.getID().toString(), f2.exists()); - } - - File[] ff1 = new File[0]; - if (f1 != null) { - ff1 = f1.listFiles(); - } - - File[] ff2 = new File[0]; - if (f2 != null) { - ff2 = f2.listFiles(); - } - - Assert.assertTrue("at least one of browser's plugins directory should contains at least one file didn't. For " + browser.getID().toString(), ff1.length + ff2.length > 0); - - ff1 = new File[0]; - if (f1 != null) { - ff1 = f1.listFiles(new FileFilter() { - - @Override - public boolean accept(File pathname) { - return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); - } - }); - } - - ff2 = new File[0]; - if (f2 != null) { - ff2 = f2.listFiles(new FileFilter() { - - @Override - public boolean accept(File pathname) { - return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); - } - }); - } - - Assert.assertTrue("browser's plugins directories should contains exactly one " + LinuxBrowser.DEFAULT_PLUGIN_NAME + ", but didnt for " + browser.getID().toString(), - ff1.length + ff2.length == 1); - String currentPath = server.getJavawsFile().getParentFile().getParentFile().getAbsolutePath(); - - File[] ff; - if (ff1.length == 1) { - ff = ff1; - } else { - ff = ff2; - } - String s = ServerAccess.getContentOfStream(new FileInputStream(ff[0]), "ASCII"); - Assert.assertTrue("browser's plugins shoud points to" + currentPath + ", but didnt", - s.contains(s)); - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java deleted file mode 100644 index af16a63..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java +++ /dev/null @@ -1,1764 +0,0 @@ -/* ServerAccess.java -Copyright (C) 2011 Red Hat, Inc. - -This file is part of IcedTea. - -IcedTea is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, version 2. - -IcedTea is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with IcedTea; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. - */ -package net.sourceforge.jnlp; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -import java.lang.reflect.Method; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.SocketException; -import java.net.URL; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.StringTokenizer; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import net.sourceforge.jnlp.browsertesting.Browser; -import net.sourceforge.jnlp.browsertesting.BrowserFactory; -import net.sourceforge.jnlp.browsertesting.BrowserTest; -import net.sourceforge.jnlp.browsertesting.Browsers; -import org.junit.Assert; -import org.junit.Test; - -/** - * - * This class provides access to virtual server and stuff around. - * It can find unoccupied port, start server, provides its singleton instantiation, lunch parallel instantiations, - * read location of installed (tested javaws) see javaws.build.bin java property, - * location of server www root on file system (see test.server.dir java property), - * stubs for lunching javaws and for locating resources and read resources. - * - * It can also execute processes with timeout (@see PROCESS_TIMEOUT) (used during lunching javaws) - * Some protected apis are exported because public classes in this package are put to be tested by makefile. - * - * There are included test cases which show some basic usages. - * - * - */ -public class ServerAccess { - - public static final long NANO_TIME_DELIMITER=1000000l; - /** - * java property which value containing path to default (makefile by) directory with deployed resources - */ - public static final String TEST_SERVER_DIR = "test.server.dir"; - /** - * java property which value containing path to installed (makefile by) javaws binary - */ - public static final String JAVAWS_BUILD_BIN = "javaws.build.bin"; - /** property to set the different then default browser - */ - public static final String USED_BROWSERS = "used.browsers"; - public static final String DEFAULT_LOCALHOST_NAME = "localhost"; - /** - * server instance singleton - */ - private static ServerLauncher server; - /** - * inner version of engine - */ - private static final String version = "4"; - /** - * timeout to read 'remote' resources - * This can be changed in runtime, but will affect all following tasks - */ - public static int READ_TIMEOUT = 1000; - /** - * timeout in ms to let process to finish, before assassin will kill it. - * This can be changed in runtime, but will affect all following tasks - */ - public static long PROCESS_TIMEOUT = 20 * 1000;//ms - /** - * all terminated processes are stored here. As wee need to 'wait' to termination to be finished. - */ - private static Set terminated = new HashSet(); - /** - * this flag is indicating whether output of executeProcess should be logged. By default true. - */ - public static boolean PROCESS_LOG = true; - public static boolean LOGS_REPRINT = false; - - private Browser currentBrowser; - /** - * This is static copy of name of id of currentBrowser for logging purposes - */ - private static String loggedBrowser=Browsers.none.toString(); - public static final String UNSET_BROWSER="unset_browser"; - - /** - * map of classes, each have map of methods, each have errorlist, outLIst, and allList (allist contains also not std or err messages) - * class.testMethod.logs - */ - private static final Map> processLogs = new HashMap>(100); - private static final File DEFAULT_LOG_FILE = new File("ServerAccess-logs.xml"); - private static final File DEFAULT_STDERR_FILE = new File("stderr.log"); - private static final File DEFAULT_STDOUT_FILE = new File("stdout.log"); - private static final File DEFAULT_STDLOGS_FILE = new File("all.log"); - private static BufferedWriter DEFAULT_STDERR_WRITER; - private static BufferedWriter DEFAULT_STDOUT_WRITER; - private static BufferedWriter DEFAULT_STDLOGS_WRITER; - - static{ - try{ - DEFAULT_STDOUT_WRITER=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDOUT_FILE))); - DEFAULT_STDERR_WRITER=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDERR_FILE))); - DEFAULT_STDLOGS_WRITER=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDLOGS_FILE))); - }catch(Throwable t){ - t.printStackTrace(); - } - } - private static final String LOGS_ELEMENT = "logs"; - private static final String CLASSLOG_ELEMENT = "classlog"; - private static final String CLASSNAME_ATTRIBUTE = "className"; - private static final String TESTLOG_ELEMENT = "testLog"; - private static final String TESTMETHOD_ATTRIBUTE = "testMethod"; - private static final String FULLID_ATTRIBUTE = "fullId"; - private static final String LOG_ELEMENT = "log"; - private static final String LOG_ID_ATTRIBUTE = "id"; - private static final String ITEM_ELEMENT = "item"; - private static final String ITEM_ID_ATTRIBUTE = "id"; - private static final String STAMP_ELEMENT = "stamp"; - private static final String TEXT_ELEMENT = "text"; - private static final String FULLTRACE_ELEMENT = "fulltrace"; - - private static void writeXmlLog() throws FileNotFoundException, IOException { - writeXmlLog(DEFAULT_LOG_FILE); - } - - private static void writeXmlLog(File f) throws FileNotFoundException, IOException { - Writer w = new OutputStreamWriter(new FileOutputStream(f)); - Set>> classes = processLogs.entrySet(); - w.write("<" + LOGS_ELEMENT + ">"); - for (Entry> classLog : classes) { - String className = classLog.getKey(); - w.write("<" + CLASSLOG_ELEMENT + " " + CLASSNAME_ATTRIBUTE + "=\"" + className + "\">"); - Set> testsLogs = classLog.getValue().entrySet(); - for (Entry testLog : testsLogs) { - String testName = testLog.getKey(); - String testLogs = testLog.getValue().toString(); - w.write("<" + TESTLOG_ELEMENT + " " + TESTMETHOD_ATTRIBUTE + "=\"" + testName + "\" " + FULLID_ATTRIBUTE + "=\"" + className + "." + testName + "\" >"); - w.write(testLogs); - w.write(""); - } - w.write(""); - } - w.write(""); - w.flush(); - w.close(); - } - - private static void addToXmlLog(String message, boolean printToOut, boolean printToErr, StackTraceElement ste) { - Map classLog = processLogs.get(ste.getClassName()); - if (classLog == null) { - classLog = new HashMap(50); - processLogs.put(ste.getClassName(), classLog); - } - String methodBrowseredName = ste.getMethodName(); - methodBrowseredName = modifyMethodWithForBrowser(methodBrowseredName,ste.getClassName()); - TestsLogs methodLog = classLog.get(methodBrowseredName); - if (methodLog == null) { - methodLog = new TestsLogs(); - classLog.put(methodBrowseredName, methodLog); - } - methodLog.add(printToErr, printToOut, message); - } - - private static String modifyMethodWithForBrowser(String methodBrowseredName, String className) { - try { - Class clazz = Class.forName(className); - /* - * By using this isAssignable to ensure corect class before invocation, - * then we lost possibility to track manualy set browsers, but it is correct, - * as method description is set only when annotation is used - */ - if (clazz != null && BrowserTest.class.isAssignableFrom(clazz)){ - Method testMethod = clazz.getMethod(methodBrowseredName); - if (testMethod != null) { - TestInBrowsers tib = testMethod.getAnnotation(TestInBrowsers.class); - if (tib != null) { - methodBrowseredName = methodBrowseredName + " - " + loggedBrowser; - } - } - } - } catch (Throwable ex) { - ex.printStackTrace(); - } - return methodBrowseredName; - } - - private static class TestsLogs { - - public final List outs = new LinkedList(); - public final List errs = new LinkedList(); - public final List all = new LinkedList(); - private static boolean added = false; - - public synchronized void add(boolean err, boolean out, String text) { - if (text == null) { - text = "null"; - } - LogItem li = new LogItem(text); - if (out) { - outs.add(li); - } - if (err) { - errs.add(li); - } - all.add(li); - if (!added) { - Runtime.getRuntime().addShutdownHook(new Thread() { - - @Override - public void run() { - try { - writeXmlLog(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - }); - added = true; - } - } - - @Override - public String toString() { - StringBuilder sb = listToStringBuilder(outs, "out"); - sb.append(listToStringBuilder(errs, "err")); - sb.append(listToStringBuilder(all, "all")); - return sb.toString(); - } - - private StringBuilder listToStringBuilder(List l, String id) { - StringBuilder sb = new StringBuilder(); - sb.append("<" + LOG_ELEMENT + " " + LOG_ID_ATTRIBUTE + "=\"").append(id).append("\">\n"); - int i = 0; - for (LogItem logItem : l) { - i++; - sb.append(logItem.toStringBuilder(i)); - } - sb.append("\n"); - return sb; - } - }; - - private static class LogItem { - - public final Date timeStamp = new Date(); - public final StackTraceElement[] fullTrace = Thread.currentThread().getStackTrace(); - public final String text; - - public LogItem(String text) { - this.text = text; - } - - public StringBuilder toStringBuilder(int id) { - StringBuilder sb = new StringBuilder(); - sb.append(" <" + ITEM_ELEMENT + " " + ITEM_ID_ATTRIBUTE + "=\"").append(id).append("\">\n"); - sb.append(" <" + STAMP_ELEMENT + ">\n"); - sb.append(" <" + TEXT_ELEMENT + ">\n"); - sb.append(" <" + FULLTRACE_ELEMENT + "> \n"); - sb.append(" \n"); - return sb; - } - } - /** - * main method of this class prints out random free port - * or runs server - * param "port" prints out the port - * nothing or number will run server on random(or on number specified) - * port in -Dtest.server.dir - */ - public static void main(String[] args) throws Exception { - if (args.length > 0 && args[0].equalsIgnoreCase("port")) { - int i = findFreePort(); - System.out.println(i); - System.exit(0); - } else { - int port = 44321; - if (args.length > 0) { - port=new Integer(args[0]); - } - getIndependentInstance(port); - while (true) { - Thread.sleep(1000); - } - - } - } - - /** - * utility method to find random free port - * - * @return - found random free port - * @throws IOException - if socket can't be opened or no free port exists - */ - public static int findFreePort() - throws IOException { - ServerSocket findPortTestingSocket = new ServerSocket(0); - int port = findPortTestingSocket.getLocalPort(); - findPortTestingSocket.close(); - return port; - } - public static final String HEADLES_OPTION="-headless"; - - /** - * we would like to have an singleton instance ASAP - */ - public ServerAccess() { - - getInstance(); - - - } - - /** - * - * @return cached instance. If none, then creates new - */ - public static ServerLauncher getInstance() { - if (server == null) { - server = getIndependentInstance(); - } - return server; - } - - /** - * - * @return new not cached iserver instance on random port, - * useful for testing application loading from different url then base - */ - public static ServerLauncher getIndependentInstance() { - return getIndependentInstance(true); - } - public static ServerLauncher getIndependentInstance(boolean daemon) { - String dir = (System.getProperty(TEST_SERVER_DIR)); - try{ - return getIndependentInstance(dir, findFreePort(),daemon); - }catch (Exception ex){ - throw new RuntimeException(ex); - } - } - - - /** - * - * @return new not cached iserver instance on random port, - * useful for testing application loading from different url then base - */ - - public static ServerLauncher getIndependentInstance(int port) { - return getIndependentInstance(port, true); - } - public static ServerLauncher getIndependentInstance(int port,boolean daemon) { - String dir = (System.getProperty(TEST_SERVER_DIR)); - return getIndependentInstance(dir,port,daemon); - } - - /** - * - * @return new not cached iserver instance on random port upon custom www root directory, - * useful for testing application loading from different url then base - */ - - public static ServerLauncher getIndependentInstance(String dir, int port) { - return getIndependentInstance(dir, port, true); - } - public static ServerLauncher getIndependentInstance(String dir, int port,boolean daemon) { - - - if (dir == null || dir.trim().length() == 0 || !new File(dir).exists() || !new File(dir).isDirectory()) { - throw new RuntimeException("test.server.dir property must be set to valid directory!"); - } - try { - ServerLauncher lServerLuncher = new ServerLauncher(port, new File(dir)); - Thread r=new Thread(lServerLuncher); - r.setDaemon(daemon); - r.start(); - return lServerLuncher; - } catch (Exception ex) { - throw new RuntimeException(ex); - } - - } - - /** - * - * @return - value passed inside as javaws binary location. See JAVAWS_BUILD_BIN - */ - public String getJavawsLocation() { - return System.getProperty(JAVAWS_BUILD_BIN); - } - - /** - * - * @return - bianry from where to lunch current browser - */ - public String getBrowserLocation() { - if (this.currentBrowser==null) return UNSET_BROWSER; - return this.currentBrowser.getBin(); - } - - public List getBrowserParams() { - if (this.currentBrowser==null) return null; - List l1=this.currentBrowser.getComaptibilitySwitches(); - List l2=this.currentBrowser.getDefaultSwitches(); - List l= new ArrayList(); - if (l1!=null)l.addAll(l1); - if (l2!=null)l.addAll(l2); - return l; - - } - - public Browsers getCurrentBrowsers() { - if (currentBrowser==null) return null; - return currentBrowser.getID(); - } - public Browser getCurrentBrowser() { - return currentBrowser; - } - - public void setCurrentBrowser(Browsers currentBrowser) { - this.currentBrowser = BrowserFactory.getFactory().getBrowser(currentBrowser); - if (this.currentBrowser == null) { - loggedBrowser = UNSET_BROWSER; - } else { - loggedBrowser = this.currentBrowser.getID().toString(); - } - } - - public void setCurrentBrowser(Browser currentBrowser) { - this.currentBrowser = currentBrowser; - if (this.currentBrowser == null) { - loggedBrowser = UNSET_BROWSER; - } else { - loggedBrowser = this.currentBrowser.getID().toString(); - } - } - - - - /** - * - * @return - value passed inside as javaws binary location as file. See JAVAWS_BUILD_BIN - */ - public File getJavawsFile() { - return new File(System.getProperty(JAVAWS_BUILD_BIN)); - } - - @Test - public void testsProcessResultFiltering() throws Exception { - ProcessResult pn = new ProcessResult(null, null, null, true, 0, null); - Assert.assertNull(pn.notFilteredStdout); - Assert.assertNull(pn.stdout); - Assert.assertNull(pn.stderr); - String fakeOut2 = - "EMMA: processing instrumentation path ...\n" - + "EMMA: package [net.sourceforge.filebrowser] contains classes [ArrayOfString] without full debug info\n" - + "EMMA: instrumentation path processed in 1407 ms\n" - + "test stage 1\n" - + "test stage 2\n" - + "EMMA: The intruder!\n" - + "test stage 3\n" - + "EMMA: [45 class(es) instrumented, 13 resource(s) copied]\n" - + "EMMA: metadata merged into [icedtea-web/inc] {in 105 ms}\n" - + "EMMA: processing instrumentation path ..."; - String filteredOut2 = - "test stage 1\n" - + "test stage 2\n" - + "test stage 3\n"; - ProcessResult p2 = new ProcessResult(fakeOut2, fakeOut2, null, true, 0, null); - Assert.assertEquals(p2.notFilteredStdout, fakeOut2); - Assert.assertEquals(p2.stdout, filteredOut2); - Assert.assertEquals(p2.stderr, fakeOut2); - fakeOut2+="\n"; - p2 = new ProcessResult(fakeOut2, fakeOut2, null, true, 0, null); - Assert.assertEquals(p2.notFilteredStdout, fakeOut2); - Assert.assertEquals(p2.stdout, filteredOut2); - Assert.assertEquals(p2.stderr, fakeOut2); - String fakeOut = - "test string\n" - + "EMMA: processing instrumentation path ...\n" - + "EMMA: package [net.sourceforge.filebrowser] contains classes [ArrayOfString] without full debug info\n" - + "EMMA: instrumentation path processed in 1407 ms\n" - + "test stage 1\n" - + "test stage 2\n" - + "test stage 3\n" - + "EMMA: [45 class(es) instrumented, 13 resource(s) copied]\n" - + "EMMA: metadata merged into [icedtea-web/inc] {in 105 ms}\n" - + "EMMA: processing instrumentation path ...\n" - + "test ends"; - String filteredOut = - "test string\n" - + "test stage 1\n" - + "test stage 2\n" - + "test stage 3\n" - + "test ends"; - ProcessResult p = new ProcessResult(fakeOut, fakeOut, null, true, 0, null); - Assert.assertEquals(p.notFilteredStdout, fakeOut); - Assert.assertEquals(p.stdout, filteredOut); - Assert.assertEquals(p.stderr, fakeOut); - fakeOut+="\n"; - filteredOut+="\n"; - p = new ProcessResult(fakeOut, fakeOut, null, true, 0, null); - Assert.assertEquals(p.notFilteredStdout, fakeOut); - Assert.assertEquals(p.stdout, filteredOut); - Assert.assertEquals(p.stderr, fakeOut); - } - - @Test - public void ensureJavaws() throws Exception { - String javawsValue = getJavawsLocation(); - Assert.assertNotNull(javawsValue); - Assert.assertTrue(javawsValue.trim().length() > 2); - File javawsFile = getJavawsFile(); - Assert.assertTrue(javawsFile.exists()); - Assert.assertFalse(javawsFile.isDirectory()); - } - - @Test - public void ensureServer() throws Exception { - - Assert.assertNotNull(server.getPort()); - Assert.assertNotNull(server.getDir()); - Assert.assertTrue(server.getPort() > 999); - Assert.assertTrue(server.getDir().toString().trim().length() > 2); - - Assert.assertTrue(server.getDir().exists()); - Assert.assertTrue(server.getDir().isDirectory()); - - File portFile = new File(server.getDir(), "server.port"); - File dirFile = new File(server.getDir(), "server.dir"); - - saveFile(server.getDir().getAbsolutePath(), dirFile); - saveFile(server.getPort().toString(), portFile); - saveFile(server.getPort().toString(), portFile); - - Assert.assertTrue(portFile.exists()); - Assert.assertTrue(dirFile.exists()); - Assert.assertTrue(server.getDir().listFiles().length > 1); - - String portFileContent = getContentOfStream(new FileInputStream(portFile)); - String dirFileContent = getContentOfStream(new FileInputStream(dirFile)); - - URL portUrl = new URL("http", "localhost", server.getPort(), "/server.port"); - URL dirUrl = new URL("http", "localhost", server.getPort(), "/server.dir"); - - String portUrlContent = getContentOfStream(portUrl.openConnection().getInputStream()); - String dirUrlContent = getContentOfStream(dirUrl.openConnection().getInputStream()); - - Assert.assertEquals(portUrlContent.trim(), portFileContent.trim()); - Assert.assertEquals(dirUrlContent.trim(), dirFileContent.trim()); - Assert.assertEquals(new File(dirUrlContent.trim()), server.getDir()); - Assert.assertEquals(new Integer(portUrlContent.trim()), server.getPort()); - - URL fastUrl = new URL("http", "localhost", server.getPort(), "/simpletest1.jnlp"); - URL slowUrl = new URL("http", "localhost", server.getPort(), "/XslowXsimpletest1.jnlp"); - - String fastUrlcontent = getContentOfStream(fastUrl.openConnection().getInputStream()); - String slowUrlContent = getContentOfStream(slowUrl.openConnection().getInputStream()); - Assert.assertEquals(fastUrlcontent, slowUrlContent); - - } - - /** - * - * @return port on which is running cached server. If non singleton instance is running, new is created. - */ - public int getPort() { - if (server == null) { - getInstance(); - } - //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); - return server.getPort(); - - } - - /** - * - * @return directory upon which is running cached server. If non singleton instance is running, new is created. - */ - public File getDir() { - if (server == null) { - getInstance(); - } - // if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); - return server.getDir(); - } - - /** - * - * @return url pointing to cached server resource. If non singleton instance is running, new is created. - */ - public URL getUrl(String resource) throws MalformedURLException { - if (server == null) { - getInstance(); - } - //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); - return server.getUrl(resource); - } - - /** - * - * @return url pointing to cached server . If non singleton instance is running, new is created. - */ - public URL getUrl() throws MalformedURLException { - return getUrl(""); - - } - - /** - * - * @return whether cached server is alive. If non singleton instance is running, new is created. - */ - public boolean isRunning() { - if (server == null) { - getInstance(); - } - //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); - return server.isRunning(); - - } - - /** - * Return resource from cached server - * - * @param resource to be located on cached server - * @return individual bytes of resource - * @throws IOException if connection can't be established or resource does not exist - */ - public ByteArrayOutputStream getResourceAsBytes(String resource) throws IOException { - return getResourceAsBytes(getUrl(resource)); - } - - /** - * Return resource from cached server - * - * @param resource to be located on cached server - * @return string constructed from resource - * @throws IOException if connection can't be established or resource does not exist - */ - public String getResourceAsString(String resource) throws IOException { - return getResourceAsString(getUrl(resource)); - } - - /** - * utility method which can read bytes of any stream - * - * @param input stream to be read - * @return individual bytes of resource - * @throws IOException if connection can't be established or resource does not exist - */ - public static ByteArrayOutputStream getBytesFromStream(InputStream is) throws IOException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int nRead; - byte[] data = new byte[16384]; - while ((nRead = is.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); - } - buffer.flush(); - return buffer; - } - - /** - * utility method which can read from any stream as one long String - * - * @param input stream - * @return stream as string - * @throws IOException if connection can't be established or resource does not exist - */ - public static String getContentOfStream(InputStream is,String encoding) throws IOException { - try { - BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); - StringBuilder sb = new StringBuilder(); - while (true) { - String s = br.readLine(); - if (s == null) { - break; - } - sb.append(s).append("\n"); - - } - return sb.toString(); - } finally { - is.close(); - } - - } - - /** - * utility method which can read from any stream as one long String - * - * @param input stream - * @return stream as string - * @throws IOException if connection can't be established or resource does not exist - */ - public static String getContentOfStream(InputStream is) throws IOException { - return getContentOfStream(is, "UTF-8"); - - } - - /** - * utility method which can read bytes of resource from any url - * - * @param resource to be located on any url - * @return individual bytes of resource - * @throws IOException if connection can't be established or resource does not exist - */ - public static ByteArrayOutputStream getResourceAsBytes(URL u) throws IOException { - HttpURLConnection connection = (HttpURLConnection) u.openConnection(); - connection = (HttpURLConnection) u.openConnection(); - connection.setRequestMethod("GET"); - connection.setDoOutput(true); - connection.setReadTimeout(READ_TIMEOUT); - connection.connect(); - return getBytesFromStream(connection.getInputStream()); - - } - - /** - * utility method which can read string of resource from any url - * - * @param resource to be located on any url - * @return resource as string - * @throws IOException if connection can't be established or resource does not exist - */ - public static String getResourceAsString(URL u) throws IOException { - HttpURLConnection connection = (HttpURLConnection) u.openConnection(); - connection = (HttpURLConnection) u.openConnection(); - connection.setRequestMethod("GET"); - connection.setDoOutput(true); - connection.setReadTimeout(READ_TIMEOUT); - connection.connect(); - return getContentOfStream(connection.getInputStream()); - } - - /** - * helping dummy method to save String as file - * - * @param content - * @param f - * @throws IOException - */ - public static void saveFile(String content, File f) throws IOException { - saveFile(content, f, "utf-8"); - } - public static void saveFile(String content, File f,String encoding) throws IOException { - Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding)); - output.write(content); - output.flush(); - output.close(); - } - - /** - * wrapping method to executeProcess (eg: javaws -headless http://localhost:port/resource) - * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) - * with parameter -headless (no gui, no asking) - * @param resource name of resource - * @return result what left after running this process - * @throws Exception - */ - public ProcessResult executeJavawsHeadless(String resource) throws Exception { - return executeJavawsHeadless(null, resource); - } - public ProcessResult executeJavawsHeadless(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeJavawsHeadless(null, resource,stdoutl,stderrl); - } - - /** - * wrapping method to executeProcess (eg: javaws arg arg -headless http://localhost:port/resource) - * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) - * with parameter -headless (no gui, no asking) - * @param resource name of resource - * @param otherargs other arguments to be added to headless one - * @return result what left after running this process - * @throws Exception - */ - public ProcessResult executeJavawsHeadless(List otherargs, String resource) throws Exception { - return executeJavawsHeadless(otherargs, resource,null,null); - } - public ProcessResult executeJavawsHeadless(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - if (otherargs == null) { - otherargs = new ArrayList(1); - } - List headlesList = new ArrayList(otherargs); - headlesList.add(HEADLES_OPTION); - return executeJavaws(headlesList, resource,stdoutl,stderrl); - } - - - /** - * wrapping method to executeProcess (eg: javaws http://localhost:port/resource) - * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) - * @param resource name of resource - * @return result what left after running this process - * @throws Exception - */ - public ProcessResult executeJavaws(String resource) throws Exception { - return executeJavaws(null, resource); - } - public ProcessResult executeJavaws(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeJavaws(null, resource,stdoutl,stderrl); - } - public ProcessResult executeBrowser(String resource) throws Exception { - return executeBrowser(getBrowserParams(), resource); - } - public ProcessResult executeBrowser(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeBrowser(getBrowserParams(), resource,stderrl,stdoutl); - } - - /** - * wrapping method to executeProcess (eg: javaws arg arg http://localhost:port/resource) - * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance())) - * @param resource name of resource - * @param otherargs other arguments to be added - * @return result what left after running this process - * @throws Exception - */ - public ProcessResult executeJavaws(List otherargs, String resource) throws Exception { - return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource)); - } - public ProcessResult executeJavaws(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); - } - - public ProcessResult executeBrowser(List otherargs, String resource) throws Exception { - return executeProcessUponURL(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource)); - } - public ProcessResult executeBrowser(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeProcessUponURL(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); - } - - public ProcessResult executeBrowser(Browser b,List otherargs, String resource) throws Exception { - return executeProcessUponURL(b.getBin(), otherargs, getUrlUponThisInstance(resource)); - } - public ProcessResult executeBrowser(Browser b,List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeProcessUponURL(b.getBin(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); - } - - /** - * Ctreate resource on http, on 'localhost' on port on which this instance is running - * @param resource - * @return - * @throws MalformedURLException - */ - public URL getUrlUponThisInstance(String resource) throws MalformedURLException { - if (!resource.startsWith("/")) { - resource = "/" + resource; - } - return new URL("http", server.getServerName(), getPort(), resource); - } - - /** - * wrapping method to executeProcess (eg: javaws arg arg arg url) - * will execute default javaws (@see JAVAWS_BUILD_BIN) upon any server - * @param u url of resource upon any server - * @param javaws arguments - * @return result what left after running this process - * @throws Exception - */ - public ProcessResult executeJavawsUponUrl(List otherargs, URL u) throws Exception { - return executeProcessUponURL(getJavawsLocation(), otherargs, u); - } - public ProcessResult executeJavawsUponUrl(List otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeProcessUponURL(getJavawsLocation(), otherargs, u,stdoutl,stderrl); - } - - /** - * wrapping utility method to executeProcess (eg: any_binary arg arg arg url) - * - * will execute any process upon url upon any server - * @param u url of resource upon any server - * @param javaws arguments - * @return result what left after running this process - * @throws Exception - */ - public static ProcessResult executeProcessUponURL(String toBeExecuted, List otherargs, URL u) throws Exception { - return executeProcessUponURL(toBeExecuted, otherargs, u,null,null); - } - - public static ProcessResult executeProcessUponURL(String toBeExecuted, List otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - Assert.assertNotNull(u); - Assert.assertNotNull(toBeExecuted); - Assert.assertTrue(toBeExecuted.trim().length() > 1); - if (otherargs == null) { - otherargs = new ArrayList(1); - } - List urledArgs = new ArrayList(otherargs); - urledArgs.add(0, toBeExecuted); - urledArgs.add(u.toString()); - return executeProcess(urledArgs, stdoutl, stderrl); - } - - public static ProcessResult executeProcess(final List args) throws Exception { - return executeProcess(args, null); - } - public static ProcessResult executeProcess(final List args,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { - return executeProcess(args, null,stdoutl,stderrl); - } - /** - * utility method to lunch process, get its stdout/stderr, its return value and to kill it if running to long (@see PROCESS_TIMEOUT) - * - * - * Small bacground: - * This method creates thread inside which exec will be executed. Then creates assassin thread with given timeout to kill the previously created thread if necessary. - * Starts assassin thread, starts process thread. Wait until process is running, then starts content readers. - * Closes input of process. - * Wait until process is running (no matter if it terminate itself (correctly or badly), or is terminated by its assassin. - * Construct result from readed stdout, stderr, process return value, assassin successfully - * - * @param args binary with args to be executed - * @param dir optional, directory where this process will run - * @return what left from process - process itself, its stdout, stderr and return value and whether it was terminated by assassin. - * @throws Exception - */ - public static ProcessResult executeProcess(final List args,File dir) throws Exception { - return executeProcess(args, dir, null, null); - } - - private static String createConnectionMessage(ThreadedProcess t) { - return "Connecting " + t.getCommandLine(); - } - - /** - * Proceed message s to logging with request to reprint to System.err - * @param s - */ - public static void logErrorReprint(String s) { - log(s, false, true); - } - - /** - * Proceed message s to logging with request to reprint to System.out - * @param s - */ - public static void logOutputReprint(String s) { - log(s, true, false); - } - - /** - * Proceed message s to logging withhout request to reprint - * @param s - */ - public static void logNoReprint(String s) { - log(s, false, false); - } - - private static void log(String message, boolean printToOut, boolean printToErr) { - String idded; - StackTraceElement ste = getTestMethod(); - String fullId = ste.getClassName() + "." + ste.getMethodName(); - fullId = modifyMethodWithForBrowser(ste.getMethodName(), ste.getClassName()); - if (message.contains("\n")) { - idded = fullId + ": \n" + message + "\n" + fullId + " ---"; - } else { - idded = fullId + ": " + message; - - } - if (LOGS_REPRINT) { - if (printToOut) { - System.out.println(idded); - } - if (printToErr) { - System.err.println(idded); - } - } - try{ - if (printToOut) { - DEFAULT_STDOUT_WRITER.write(idded); - DEFAULT_STDOUT_WRITER.newLine(); - } - if (printToErr) { - DEFAULT_STDERR_WRITER.write(idded); - DEFAULT_STDERR_WRITER.newLine(); - } - DEFAULT_STDLOGS_WRITER.write(idded); - DEFAULT_STDLOGS_WRITER.newLine(); - }catch (Throwable t){ - t.printStackTrace(); - } - - addToXmlLog(message,printToOut,printToErr,ste); - } - - public static void logException(Throwable t){ - logException(t, true); - } - public static void logException(Throwable t, boolean print){ - try{ - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - t.printStackTrace(pw); - log(sw.toString(), false, print); - pw.close(); - sw.close(); - }catch(Exception ex){ - throw new RuntimeException(ex); - } - } - - private static StackTraceElement getTestMethod() { - return getTestMethod(Thread.currentThread().getStackTrace()); - } - - private static StackTraceElement getTestMethod(StackTraceElement[] stack) { - //0 is always thread - //1 is net.sourceforge.jnlp.ServerAccess - StackTraceElement result = stack[1]; - String baseClass = stack[1].getClassName(); - int i = 2; - for (; i < stack.length; i++) { - result = stack[i];//at least moving up - if(stack[i].getClassName().contains("$")){ - continue; - } - if (!baseClass.equals(stack[i].getClassName())) { - break; - } - } - //if nothing left in stack then we have been in ServerAccess already - //so the target method is the highest form it and better to return it - //rather then die to ArrayOutOfBounds - if(i >= stack.length){ - return result; - } - //now we are out of net.sourceforge.jnlp.ServerAccess - //method we need (the test) is highest from following class - baseClass = stack[i].getClassName(); - for (; i < stack.length; i++) { - if(stack[i].getClassName().contains("$")){ - continue; - } - if (!baseClass.equals(stack[i].getClassName())) { - break; - } - result = stack[i]; - } - - return result; - } - - public static ProcessResult executeProcess(final List args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl) throws Exception { - ThreadedProcess t = new ThreadedProcess(args, dir); - if (PROCESS_LOG) { - String connectionMesaage = createConnectionMessage(t); - log(connectionMesaage, true, true); - } - ProcessAssasin pa = new ProcessAssasin(t, PROCESS_TIMEOUT); - pa.start(); - t.start(); - while (t.getP() == null && t.deadlyException == null) { - Thread.sleep(100); - } - if (t.deadlyException != null) { - pa.setCanRun(false); - return new ProcessResult("", "", null, true, Integer.MIN_VALUE, t.deadlyException); - } - ContentReader crs = new ContentReader(t.getP().getInputStream(),stdoutl); - ContentReader cre = new ContentReader(t.getP().getErrorStream(),stderrl); - - OutputStream out = t.getP().getOutputStream(); - if (out != null) { - out.close(); - } - - new Thread(crs).start(); - new Thread(cre).start(); - while (t.isRunning()) { - Thread.sleep(100); - } - - while (!t.isDestoyed()) { - Thread.sleep(100); - } - pa.setCanRun(false); - // ServerAccess.logOutputReprint(t.getP().exitValue()); when process is killed, this throws exception - - ProcessResult pr=new ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null); - if (PROCESS_LOG) { - log(pr.stdout, true, false); - log(pr.stderr, false, true); - } - return pr; - } - - /** - * - * wrapper around Runtime.getRuntime().exec(...) which ensures that process is run inside its own, by us controlled, thread. - * Process builder caused some unexpected and weird behavior :/ - */ - private static class ThreadedProcess extends Thread { - - Process p = null; - List args; - Integer exitCode; - Boolean running; - File dir; - Throwable deadlyException = null; - /* - * before removing this "useless" variable - * check DeadLockTestTest.testDeadLockTestTerminated2 - */ - private boolean destoyed = false; - - public boolean isDestoyed() { - return destoyed; - } - - public void setDestoyed(boolean destoyed) { - this.destoyed = destoyed; - } - - public Boolean isRunning() { - return running; - } - - public Integer getExitCode() { - return exitCode; - } - - public ThreadedProcess(List args) { - this.args = args; - } - public ThreadedProcess(List args,File dir) { - this.args = args; - this.dir=dir; - } - - public String getCommandLine() { - String commandLine = "unknown command"; - try { - if (args != null && args.size() > 0) { - commandLine = ""; - for (String string : args) { - commandLine = commandLine + " " + string; - - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } finally { - return commandLine; - } - } - - public Process getP() { - return p; - } - - @Override - public void run() { - try { - running = true; - Runtime r = Runtime.getRuntime(); - if (dir==null){ - p = r.exec(args.toArray(new String[0])); - }else{ - p = r.exec(args.toArray(new String[0]),new String[0], dir); - } - try { - exitCode = p.waitFor(); - Thread.sleep(500); //this is giving to fast done proecesses's e/o readers time to read all. I would like to know better solution :-/ - } finally { - destoyed = true; - } - } catch (Exception ex) { - if (ex instanceof InterruptedException) { - //add to the set of terminated threaded processes - deadlyException = ex; - logException(deadlyException, false); - terminated.add(this); - } else { - //happens when non-existing process is launched, is causing p null! - terminated.add(this); - deadlyException = ex; - logException(deadlyException, false); - throw new RuntimeException(ex); - } - } finally { - running = false; - } - } - } - - /** - * wrapper around tiny http server to separate lunch configurations and servers. - * to allow terminations and stuff around. - */ - public static class ServerLauncher implements Runnable { - - /** - * default url name part. - * This can be changed in runtime, but will affect all following tasks upon those server - */ - private String serverName = DEFAULT_LOCALHOST_NAME; - private boolean running; - private final Integer port; - private final File dir; - - public String getServerName() { - return serverName; - } - - public void setServerName(String serverName) { - this.serverName = serverName; - } - - public ServerLauncher(Integer port, File dir) { - this.port = port; - this.dir = dir; - System.err.println("port: " + port); - System.err.println("dir: " + dir); - } - - public boolean isRunning() { - return running; - } - - public Integer getPort() { - return port; - } - - public File getDir() { - return dir; - } - - public ServerLauncher(File dir) { - this(8181, dir); - } - - public ServerLauncher(Integer port) { - - this(port, new File(System.getProperty("user.dir"))); - } - - public ServerLauncher() { - this(8181, new File(System.getProperty("user.dir"))); - - } - - public void run() { - running = true; - try { - ServerSocket s = new ServerSocket( - port); - while (running) { - new TinyHttpdImpl(s.accept(), dir, port); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - running = false; - } - - } - - public URL getUrl(String resource) throws MalformedURLException { - return new URL("http", getServerName(), getPort(), resource); - } - - public URL getUrl() throws MalformedURLException { - return getUrl(""); - } - - /** - * based on http://www.mcwalter.org/technology/java/httpd/tiny/index.html - * Very small implementation of http return headers for our served resources - * - * When resource starts with XslowX prefix, then resouce (without XslowX) - * is returned, but its delivery is delayed - */ - private class TinyHttpdImpl extends Thread { - - Socket c; - private final File dir; - private final int port; - private boolean canRun = true; - private static final String XSX="/XslowX"; - - public void setCanRun(boolean canRun) { - this.canRun = canRun; - } - - public TinyHttpdImpl(Socket s, File f, int port) { - c = s; - this.dir = f; - this.port = port; - start(); - } - - public int getPort() { - return port; - } - - @Override - public void run() { - try { - BufferedReader i = new BufferedReader(new InputStreamReader(c.getInputStream())); - DataOutputStream o = new DataOutputStream(c.getOutputStream()); - try { - while (canRun) { - String s = i.readLine(); - if (s.length() < 1) { - break; - } - if (s.startsWith("GET")) { - StringTokenizer t = new StringTokenizer(s, " "); - t.nextToken(); - String op = t.nextToken(); - String p = op; - if (p.startsWith(XSX))p=p.replace(XSX, "/"); - logNoReprint("Getting: "+p); - p=URLDecoder.decode(p, "UTF-8"); - logNoReprint("Serving: "+p); - p = (".".concat(((p.endsWith("/")) ? p.concat( - "index.html") : p))).replace('/', File.separatorChar); - File pp = new File(dir, p); - int l = (int) pp.length(); - byte[] b = new byte[l]; - FileInputStream f = new FileInputStream(pp); - f.read(b); - String content = ""; - String ct = "Content-Type: "; - if (p.toLowerCase().endsWith(".jnlp")) { - content = ct + "application/x-java-jnlp-file\n"; - } else if (p.toLowerCase().endsWith(".html")) { - content = ct + "text/html\n"; - } else if (p.toLowerCase().endsWith(".jar")) { - content = ct + "application/x-jar\n"; - } - o.writeBytes("HTTP/1.0 200 OK\nConten" - + "t-Length:" + l + "\n" + content + "\n"); - if (op.startsWith(XSX)){ - byte[][] bb=ServerAccess.splitArray(b,10); - for (int j = 0; j < bb.length; j++) { - Thread.sleep(2000); - byte[] bs = bb[j]; - o.write(bs, 0, bs.length); - } - }else{ - o.write(b, 0, l); - } - } - } - }catch (SocketException e) { - logException(e, false); - } catch (Exception e) { - o.writeBytes("HTTP/1.0 404 ERROR\n\n\n"); - logException(e, false); - } - o.close(); - } catch (Exception e) { - logException(e, false); - } - } - } - } - - - /** - * This function splits input array to severasl pieces - * from byte[length] splitt to n pieces s is retrunrd byte[n][length/n], except - * last piece which contains length%n - * - * @param input - array to be splitted - * @param pieces - to how many pieces it should be broken - * @return inidividual pices of original array, which concatet again givs original array - */ - public static byte[][] splitArray(byte[] input, int pieces) { - int rest = input.length; - int rowLength = rest / pieces; - if (rest % pieces > 0) rowLength++; - if (pieces * rowLength >= rest + rowLength) pieces--; - int i = 0, j = 0; - byte[][] array = new byte[pieces][]; - array[0] = new byte[rowLength]; - for (byte b : input) { - if (i >= rowLength) { - i = 0; - array[++j] = new byte[Math.min(rowLength, rest)]; - } - array[j][i++] = b; - rest--; - } - return array; - } - - - @Test - public void splitArrayTest0() throws Exception { - byte[] b={1,2,3,4,5,6,7,8,9,10,11,12,13,14}; - byte[][] bb=splitArray(b, 3); - //printArrays(bb); - byte[] b1={1,2,3,4,5}; - byte[] b2={6,7,8,9,10}; - byte[] b3={11,12,13,14}; - Assert.assertEquals(3,bb.length); - Assert.assertArrayEquals(b1,bb[0]); - Assert.assertArrayEquals(b2,bb[1]); - Assert.assertArrayEquals(b3,bb[2]); - } - - @Test - public void splitArrayTest1() throws Exception { - byte[] b={1,2,3,4,5,6,7,8,9,10,11,12,13}; - byte[][] bb=splitArray(b, 3); - //printArrays(bb); - byte[] b1={1,2,3,4,5}; - byte[] b2={6,7,8,9,10}; - byte[] b3={11,12,13}; - Assert.assertEquals(3,bb.length); - Assert.assertArrayEquals(b1,bb[0]); - Assert.assertArrayEquals(b2,bb[1]); - Assert.assertArrayEquals(b3,bb[2]); - } - - @Test - public void splitArrayTest2() throws Exception { - byte[] b={1,2,3,4,5,6,7,8,9,10,11,12}; - byte[][] bb=splitArray(b, 3); - //printArrays(bb); - byte[] b1={1,2,3,4}; - byte[] b2={5,6,7,8}; - byte[] b3={9,10,11,12}; - Assert.assertEquals(3,bb.length); - Assert.assertArrayEquals(b1,bb[0]); - Assert.assertArrayEquals(b2,bb[1]); - Assert.assertArrayEquals(b3,bb[2]); - } - - private void printArrays(byte[][] bb) { - System.out.println("[][] l=" + bb.length); - for (int i = 0; i < bb.length; i++) { - byte[] bs = bb[i]; - System.out.println(i + ": l=" + bs.length); - for (int j = 0; j < bs.length; j++) { - byte c = bs[j]; - System.out.print(" " + j + ":" + c + " "); - } - System.out.println(""); - } - } - - - /** - * class which timeout any ThreadedProcess. This killing of 'thread with process' replaced not working process.destroy(). - */ - private static class ProcessAssasin extends Thread { - - long timeout; - private final ThreadedProcess p; - //false == is disabled:( - private boolean canRun = true; - private boolean wasTerminated = false; - /** - * if this is true, then process is not destroyed after timeout, but just left to its own destiny. - * Its stdout/err is no longer recorded, and it is leaking system resources until it dies by itself - * The contorl is returned to main thread with all informations recorded untill now. - * You will be able to listen to std out from listeners still - */ - private boolean skipInstedOfDesroy = false; - - /** - * - * @param p - * @param timeout - time to die in milliseconds - */ - public ProcessAssasin(ThreadedProcess p, long timeout) { - this.p = (p); - this.timeout = timeout; - - - } - - public ProcessAssasin(ThreadedProcess p, long timeout, boolean skipInstedOfDesroy) { - this.p = (p); - this.timeout = timeout; - this.skipInstedOfDesroy = skipInstedOfDesroy; - - - } - - public void setCanRun(boolean canRun) { - this.canRun = canRun; - if (p != null) { - if (p.getP() != null) { - logNoReprint("Stopping assassin for" + p.toString() + " " + p.getP().toString() + " " + p.getCommandLine() + ": "); - } else { - logNoReprint("Stopping assassin for" + p.toString() + " " + p.getCommandLine() + ": "); - } - } else { - logNoReprint("Stopping assassin for null job: "); - } - } - - public boolean isCanRun() { - return canRun; - } - - public boolean wasTerminated() { - return wasTerminated; - } - - public void setSkipInstedOfDesroy(boolean skipInstedOfDesroy) { - this.skipInstedOfDesroy = skipInstedOfDesroy; - } - - public boolean isSkipInstedOfDesroy() { - return skipInstedOfDesroy; - } - - @Override - public void run() { - - long startTime = System.nanoTime() / NANO_TIME_DELIMITER; - while (canRun) { - try { - - long time = System.nanoTime() / NANO_TIME_DELIMITER; - //ServerAccess.logOutputReprint(time - startTime); - //ServerAccess.logOutputReprint((time - startTime) > timeout); - if ((time - startTime) > timeout) { - try { - if (p != null) { - if (p.getP() != null) { - logErrorReprint("Timed out " + p.toString() + " " + p.getP().toString() + " .. killing " + p.getCommandLine() + ": "); - } else { - logErrorReprint("Timed out " + p.toString() + " " + "null .. killing " + p.getCommandLine() + ": "); - } - wasTerminated = true; - p.interrupt(); - while (!terminated.contains(p)) { - Thread.sleep(100); - } - if (p.getP() != null) { - try { - if (!skipInstedOfDesroy) { - p.getP().destroy(); - } - } catch (Throwable ex) { - if (p.deadlyException == null) { - p.deadlyException = ex; - } - ex.printStackTrace(); - } - } - if (p.getP() != null) { - logErrorReprint("Timed out " + p.toString() + " " + p.getP().toString() + " .. killed " + p.getCommandLine()); - } else { - logErrorReprint("Timed out " + p.toString() + " null .. killed " + p.getCommandLine()); - } - } else { - logErrorReprint("Timed out null job"); - } - break; - } finally { - p.setDestoyed(true); - } - - - } - Thread.sleep(100); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - if (p != null) { - if (p.getP() != null) { - logNoReprint("assassin for" + p.toString() + " " + p.getP().toString() + " .. done " + p.getCommandLine() + " termination " + wasTerminated); - } else { - logNoReprint("assassin for" + p.toString() + " null .. done " + p.getCommandLine() + " termination " + wasTerminated); - } - } else { - logNoReprint("assassin for non existing job termination " + wasTerminated); - } - } - } - - /** - * artefacts what are left by finished process - */ - public static class ProcessResult { - - public final String stdout; - public final String notFilteredStdout; - public final String stderr; - public final Process process; - public final Integer returnValue; - public final boolean wasTerminated; - /* - * possible exception which caused Process not to be launched - */ - public final Throwable deadlyException; - - public ProcessResult(String stdout, String stderr, Process process, boolean wasTerminated, Integer r, Throwable deadlyException) { - this.notFilteredStdout = stdout; - if (stdout == null) { - this.stdout = null; - } else { - this.stdout = stdout.replaceAll("EMMA:.*\n?", ""); - } - this.stderr = stderr; - this.process = process; - this.wasTerminated = wasTerminated; - this.returnValue = r; - this.deadlyException = deadlyException; - } - } - - /** - * Class to read content of stdout/stderr of process, and to cooperate with its running/terminated/finished statuses. - */ - private static class ContentReader implements Runnable { - - StringBuilder sb = new StringBuilder(); - private final InputStream is; - private boolean done; - ContentReaderListener listener; - - public String getContent() { - return sb.toString(); - } - - public ContentReader(InputStream is) throws IOException { - this.is = is; - } - public ContentReader(InputStream is,ContentReaderListener l) throws IOException { - this.is = is; - this.listener=l; - } - - public void setListener(ContentReaderListener listener) { - this.listener = listener; - } - - public ContentReaderListener getListener() { - return listener; - } - - - /** - * Blocks until the copy is complete, or until the thread is interrupted - */ - public synchronized void waitUntilDone() throws InterruptedException { - boolean interrupted = false; - - // poll interrupted flag, while waiting for copy to complete - while (!(interrupted = Thread.interrupted()) && !done) { - wait(1000); - } - - if (interrupted) { - logNoReprint("Stream copier: throwing InterruptedException"); - //throw new InterruptedException(); - } - } - - @Override - public void run() { - try { - Reader br = new InputStreamReader(is, "UTF-8"); - StringBuilder line = new StringBuilder(); - while (true) { - int s = br.read(); - if (s < 0) { - if (line.length() > 0 && listener != null) { - listener.lineReaded(line.toString()); - } - break; - } - char ch = ((char) s); - sb.append(ch); - line.append(ch); - if (ch == '\n') { - if (listener != null) { - listener.lineReaded(line.toString()); - } - line = new StringBuilder(); - } - if (listener != null) { - listener.charReaded(ch); - } - - } - //do not want to bother output with terminations - //mostly compaling when assassin kill the process about StreamClosed - } catch (Exception ex) { - // logException(ex); - } finally { - try { - is.close(); - } catch (Exception ex) { - // ex.printStackTrace(); - } finally { - done = true; - } - } - - } - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java deleted file mode 100644 index ac157d9..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.sourceforge.jnlp.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * When declare for suite class or for Test-marked method, - * should be interpreted by report generating tool to links. - * Known shortcuts are - * SX - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=X - * PRX - http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=X - * RHX - https://bugzilla.redhat.com/show_bug.cgi?id=X - * DX - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=X - * GX - http://bugs.gentoo.org/show_bug.cgi?id=X - * CAX - http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id=X - * LPX - https://bugs.launchpad.net/bugs/X - * - * http://mail.openjdk.java.net/pipermail/distro-pkg-dev/ - * and http://mail.openjdk.java.net/pipermail/ are proceed differently - * You just put eg @Bug(id="RH12345",id="http:/my.bukpage.com/terribleNew") - * and RH12345 will be transalated as - * 123456 or - * similar, the url will be inclueded as is. Both added to proper tests or suites - * - */ -@Target({ElementType.METHOD,ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface Bug { - public String[] id(); -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/KnownToFail.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/KnownToFail.java deleted file mode 100644 index e7c2464..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/KnownToFail.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sourceforge.jnlp.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - *

- * This annotation marks a test as a known failure (as opposed to a - * regression). A test that is a known failure will not hold of a release, - * nor should developers hold off a fix if they run the unit tests and a - * test marked as a known failure fails. - *

- * This annotation is meant for adding tests for bugs before the fix is - * implemented. - *

- */ - -@Target({ElementType.METHOD,ElementType.TYPE}) -@Retention(RetentionPolicy.RUNTIME) -public @interface KnownToFail { - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java deleted file mode 100644 index e8b9d49..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java +++ /dev/null @@ -1,18 +0,0 @@ - -package net.sourceforge.jnlp.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * This annotation should be declared for each test which requires DISPALY defined. - * If no display is defined, then those test will not be run - * - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface NeedsDisplay { - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/TestInBrowsers.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/TestInBrowsers.java deleted file mode 100644 index b4ea2a3..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/TestInBrowsers.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package net.sourceforge.jnlp.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import net.sourceforge.jnlp.browsertesting.Browsers; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface TestInBrowsers { - public Browsers[] testIn(); -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browser.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browser.java deleted file mode 100644 index 81db960..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browser.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.sourceforge.jnlp.browsertesting; - -import java.util.List; - -/** - * interface which represents individual browsers - */ -public interface Browser { - public String getDefaultBin(); - public String getDefaultPluginExpectedLocation(); - public String getBin(); - //public void setBin(String bin); - public String getUserDefaultPluginExpectedLocation(); - public Browsers getID(); - public List getComaptibilitySwitches(); - public List getDefaultSwitches(); - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserFactory.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserFactory.java deleted file mode 100644 index 7171afc..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserFactory.java +++ /dev/null @@ -1,189 +0,0 @@ -package net.sourceforge.jnlp.browsertesting; - -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Random; -import net.sourceforge.jnlp.ServerAccess; -import net.sourceforge.jnlp.browsertesting.browsers.Chrome; -import net.sourceforge.jnlp.browsertesting.browsers.Chromium; -import net.sourceforge.jnlp.browsertesting.browsers.Epiphany; -import net.sourceforge.jnlp.browsertesting.browsers.Firefox; -import net.sourceforge.jnlp.browsertesting.browsers.Midory; -import net.sourceforge.jnlp.browsertesting.browsers.Opera; - -public class BrowserFactory { - - private static final BrowserFactory factory = new BrowserFactory(System.getProperty(ServerAccess.USED_BROWSERS)); - private List configuredBrowsers; - Random oneGenerator = new Random(); - - public static BrowserFactory getFactory() { - return factory; - } - - /** - * This is public just for testing purposes! - */ - public BrowserFactory(String browsers) { - if (browsers == null) { - configuredBrowsers = new ArrayList(0); - } else { - String[] s = browsers.split(File.pathSeparator); - configuredBrowsers = new ArrayList(s.length); - for (int i = 0; i < s.length; i++) { - String string = s[i]; - String[] p = string.split("/"); - if (p.length > 1) { - string = p[p.length - 1]; - } - if (string.equals(Browsers.chromiumBrowser.toString())) { - configuredBrowsers.add(new Chromium(s[i])); - } - if (string.equals(Browsers.googleChrome.toString())) { - configuredBrowsers.add(new Chrome(s[i])); - } - if (string.equals(Browsers.opera.toString())) { - configuredBrowsers.add(new Opera(s[i])); - } - if (string.equals(Browsers.firefox.toString())) { - configuredBrowsers.add(new Firefox(s[i])); - } - if (string.equals(Browsers.epiphany.toString())) { - configuredBrowsers.add(new Epiphany(s[i])); - } - if (string.equals(Browsers.midori.toString())) { - configuredBrowsers.add(new Midory(s[i])); - } - } - } - - } - - public Browser getBrowser(Browsers id) { - for (int i = 0; i < configuredBrowsers.size(); i++) { - Browser browser = configuredBrowsers.get(i); - if (browser.getID() == id) { - return browser; - } - - } - return null; - - } - - public Browser getFirst() { - for (int i = 0; i < configuredBrowsers.size(); i++) { - Browser browser = configuredBrowsers.get(i); - return browser; - - } - return null; - - } - - public Browser getRandom() { - if (configuredBrowsers.isEmpty()){ - return null; - } - return configuredBrowsers.get(oneGenerator.nextInt(configuredBrowsers.size())); - } - - public List getAllBrowsers() { - return Collections.unmodifiableList(configuredBrowsers); - } - - public List getBrowsers(TestInBrowsers tib) { - return getBrowsers(tib.testIn()); - } - public List getBrowsers(Browsers[] testIn) { - List q = translateAnnotationSilently(testIn); - if (q==null || q.isEmpty()){ - List qq = new ArrayList(0); - qq.add(Browsers.none); - return qq; - } - List qq = new ArrayList(q.size()); - for (Browser browser : q) { - qq.add(browser.getID()); - } - return qq; - - } - /** - * - * @param testIn Bbrowsers which should be transformed to list of Browser - * @return all matching browser, if browser do not exists, this is ignored and run is silently continued - */ - public List translateAnnotationSilently(Browsers[] testIn) { - if (testIn==null) { - return null; - } - List r = new ArrayList(configuredBrowsers.size()); - for (Browsers b : testIn) { - if (b == Browsers.all) { - if (getAllBrowsers().isEmpty()) { - ServerAccess.logErrorReprint("You try to add all browsers, but there is none"); - } else { - r.addAll(getAllBrowsers()); - } - } else if (b == Browsers.one) { - Browser bb = getRandom(); - if (bb == null) { - ServerAccess.logErrorReprint("You try to add random browser, but there is none"); - } else { - r.add(bb); - } - } else { - Browser bb = getBrowser(b); - if (bb == null) { - ServerAccess.logErrorReprint("You try to add " + b.toString() + " browser, but it do not exists"); - } else { - r.add(bb); - } - - } - } - - return r; - - } - - /** - * - * @param tib - * @return all matching browser, if browser do not exists, exception is thrown - */ - public List translateAnnotationLaudly(TestInBrowsers tib) { - return translateAnnotationLaudly(tib.testIn()); - } - public List translateAnnotationLaudly(Browsers[] testIn) { - List r = new ArrayList(configuredBrowsers.size()); - for (Browsers b :testIn) { - if (b == Browsers.all) { - if (getAllBrowsers().isEmpty()) { - throw new IllegalStateException("You try to add all browsers, but there is none"); - } - r.addAll(getAllBrowsers()); - } else if (b == Browsers.one) { - Browser bb = getRandom(); - if (bb == null) { - throw new IllegalStateException("You try to add random browser, but there is none"); - } - r.add(bb); - } else { - Browser bb = getBrowser(b); - if (bb == null) { - throw new IllegalStateException("You try to add " + b.toString() + " browser, but it do not exists"); - } - r.add(bb); - - } - } - - return r; - - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTest.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTest.java deleted file mode 100644 index 232b63a..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTest.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.sourceforge.jnlp.browsertesting; - -import net.sourceforge.jnlp.ServerAccess; -import org.junit.runner.RunWith; - - -@RunWith(value = BrowserTestRunner.class) -public abstract class BrowserTest { - - public static Browsers browser=null; - public static final ServerAccess server = new ServerAccess(); - - public static void setBrowser(Browsers b) { - browser = b; - server.setCurrentBrowser(browser); - } - - public static Browsers getBrowser() { - return browser; - } - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java deleted file mode 100644 index 36350e8..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java +++ /dev/null @@ -1,148 +0,0 @@ -package net.sourceforge.jnlp.browsertesting; - -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import net.sourceforge.jnlp.annotations.TestInBrowsers; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Random; -import net.sourceforge.jnlp.ServerAccess; -import org.junit.Ignore; -import org.junit.internal.AssumptionViolatedException; -import org.junit.internal.runners.model.EachTestNotifier; -import org.junit.runner.Description; -import org.junit.runner.notification.RunNotifier; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.model.FrameworkMethod; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.Statement; - -public class BrowserTestRunner extends BlockJUnit4ClassRunner { - - public BrowserTestRunner(java.lang.Class testClass) throws InitializationError { - super(testClass); - } - - @Override - protected void runChild(FrameworkMethod method, RunNotifier notifier) { - Method mm = method.getMethod(); - TestInBrowsers tib = mm.getAnnotation(TestInBrowsers.class); - injectBrowserCatched(method, Browsers.none); - boolean browserIgnoration = false; - if (tib != null) { - try { - List testableBrowsers = BrowserFactory.getFactory().getBrowsers(tib); - String mbr = System.getProperty("modified.browsers.run"); - if (mbr != null) { - if (mbr.equalsIgnoreCase("all")) { - if (!isBrowsersNoneSet(tib)) { - testableBrowsers = BrowserFactory.getFactory().getBrowsers(new Browsers[]{Browsers.all}); - } - } else if (mbr.equalsIgnoreCase("one")) { - //this complication here is for case like - // namely enumerated concrete browsers, so we want to pick up - // random one from those already enumerated - if (isBrowsersNoneSet(tib)) { - testableBrowsers = Arrays.asList(new Browsers[]{testableBrowsers.get(new Random().nextInt(testableBrowsers.size()))}); - } - } else if (mbr.equalsIgnoreCase("ignore")) { - testableBrowsers = BrowserFactory.getFactory().getBrowsers(new Browsers[]{Browsers.none}); - browserIgnoration = true; - } else { - ServerAccess.logErrorReprint("unrecognized value of modified.browsers.run - " + mbr); - } - } - for (Browsers browser : testableBrowsers) { - try { - injcetBrowser(method, browser); - runChildX(method, notifier, browser, browserIgnoration); - } catch (Exception ex) { - //throw new RuntimeException("unabled to inject browser", ex); - ServerAccess.logException(ex, true); - } - } - } finally { - injectBrowserCatched(method, Browsers.none); - } - } else { - runChildX(method, notifier, null, false); - } - } - - private boolean isBrowsersNoneSet(TestInBrowsers tib) { - if (tib.testIn().length == 1 && tib.testIn()[0] == Browsers.none) { - return true; - } - return false; - } - - private void injectBrowserCatched(FrameworkMethod method, Browsers browser) { - try { - injcetBrowser(method, browser); - } catch (Exception ex) { - //throw new RuntimeException("unabled to inject browser", ex); - ServerAccess.logException(ex, true); - } - } - - private void injcetBrowser(FrameworkMethod method, Browsers browser) throws IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException { - Method ff = method.getMethod().getDeclaringClass().getMethod("setBrowser", Browsers.class); - ff.invoke(null, browser); - } - - protected void runChildX(final FrameworkMethod method, RunNotifier notifier, Browsers browser, boolean browserIgnoration) { - Description description = describeChild(method, browser); - if (method.getAnnotation(Ignore.class) != null) { - notifier.fireTestIgnored(description); - } else { - try { - runLeaf(methodBlock(method), description, notifier, browserIgnoration); -// ServerAccess.logOutputReprint("trying leaf"); -// Method m = this.getClass().getMethod("runLeaf", Statement.class, Description.class, RunNotifier.class); -// m.setAccessible(true); -// m.invoke(this, methodBlock(method), description, notifier); -// ServerAccess.logOutputReprint("leaf invoked"); - } catch (Exception ex) { - //throw new RuntimeException("unabled to lunch test on leaf", ex); - ServerAccess.logException(ex, true); - } - } - } - - /** - * Runs a {@link Statement} that represents a leaf (aka atomic) test. - */ - protected final void runLeaf(Statement statement, Description description, - RunNotifier notifier, boolean ignore) { - EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); - eachNotifier.fireTestStarted(); - if (ignore) { - eachNotifier.fireTestIgnored(); - return; - } - try { - statement.evaluate(); - } catch (AssumptionViolatedException e) { - eachNotifier.addFailedAssumption(e); - } catch (Throwable e) { - eachNotifier.addFailure(e); - } finally { - eachNotifier.fireTestFinished(); - } - } - - protected Description describeChild(FrameworkMethod method, Browsers browser) { - if (browser == null) { - return super.describeChild(method); - } else { - try { - return Description.createTestDescription(getTestClass().getJavaClass(), - testName(method) + " - " + browser.toString(), method.getAnnotations()); - } catch (Exception ex) { - ServerAccess.logException(ex, true); - return super.describeChild(method); - } - } - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browsers.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browsers.java deleted file mode 100644 index 8d85241..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/Browsers.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.sourceforge.jnlp.browsertesting; - -/** - * When all represent all configured browser, one represens one random - * (the first found) configured browser. Each other represents inidivdual browsers - * - */ -public enum Browsers { - - none, all, one, opera, googleChrome, chromiumBrowser, firefox, midori,epiphany; - - public String toExec() { - switch (this) { - case opera: - return "opera"; - case googleChrome: - return "google-chrome"; - case chromiumBrowser: - return "chromium-browser"; - case firefox: - return "firefox"; - case midori: - return "midori"; - case epiphany: - return "epiphany"; - default: - return null; - - } - } - - @Override - public String toString() { - if (toExec()!=null) return toExec(); - switch (this) { - case all: - return "all"; - case one: - return "one"; - case none: - return "unset_browser"; - default: return "unknown"; - - } - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java deleted file mode 100644 index 2668d65..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Chrome extends MozillaFamilyLinuxBrowser { - - public Chrome(String bin) { - super(bin); - } - - @Override - public Browsers getID() { - return Browsers.googleChrome; - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java deleted file mode 100644 index 616d38a..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Chromium extends MozillaFamilyLinuxBrowser { - - public Chromium(String bin) { - super(bin); - } - - @Override - public Browsers getID() { - return Browsers.chromiumBrowser; - } -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java deleted file mode 100644 index 3adc3d8..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Epiphany extends MozillaFamilyLinuxBrowser { - - public Epiphany(String bin) { - super(bin); - } - - @Override - public Browsers getID() { - return Browsers.epiphany; - } - - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java deleted file mode 100644 index 8458bce..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import java.util.Arrays; -import java.util.List; -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Firefox extends MozillaFamilyLinuxBrowser { - - public Firefox(String bin) { - super(bin); - } - - String[] cs={"-no-remote", "-new-tab"}; - - @Override - public Browsers getID() { - return Browsers.firefox; - } - - @Override - public List getComaptibilitySwitches() { - return Arrays.asList(cs); - } - - - - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java deleted file mode 100644 index edc95e0..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import net.sourceforge.jnlp.browsertesting.Browser; - - -public abstract class LinuxBrowser implements Browser{ - public static final String DEFAULT_PLUGIN_NAME="libjavaplugin.so"; - public static final String DEFAULT_BIN_PATH="/usr/bin/"; - - protected final String bin; - protected String fsdir="unknown"; - - public LinuxBrowser(String bin) { - this.bin = bin; - } - - - - @Override - public String getBin() { - return bin; - } - -// @Override -// public void setBin(String bin) { -// this.bin=bin; -// } - - @Override - public String getDefaultBin() { - return DEFAULT_BIN_PATH+getID().toExec(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Browser)) return false; - Browser b=(Browser) obj; - return b.getBin().equals(getBin()); - } - - @Override - public int hashCode() { - int hash = 5; - hash = 59 * hash + (this.bin != null ? this.bin.hashCode() : 0); - return hash; - } - - @Override - public String getDefaultPluginExpectedLocation() { - if (System.getProperty("os.arch").contains("64")) { - return "/usr/lib64/"+fsdir+"/plugins"; - } else { - return "/usr/lib/"+fsdir+"/plugins"; - - } - } - - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Midory.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Midory.java deleted file mode 100644 index fc563fb..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Midory.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Midory extends MozillaFamilyLinuxBrowser { - - public Midory(String bin) { - super(bin); - } - - @Override - public Browsers getID() { - return Browsers.midori; - } - - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java deleted file mode 100644 index c8d1e85..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import java.util.List; - -public abstract class MozillaFamilyLinuxBrowser extends LinuxBrowser{ - - public MozillaFamilyLinuxBrowser(String bin) { - super(bin); - fsdir="mozilla"; - } - - - @Override - public List getComaptibilitySwitches() { - return null; - } - - @Override - public List getDefaultSwitches() { - return null; - } - - @Override - public String getUserDefaultPluginExpectedLocation() { - return System.getProperty("user.home")+"/.mozilla/plugins"; - } - - -} diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Opera.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Opera.java deleted file mode 100644 index edbf57f..0000000 --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/browsertesting/browsers/Opera.java +++ /dev/null @@ -1,37 +0,0 @@ -package net.sourceforge.jnlp.browsertesting.browsers; - -import java.util.Arrays; -import java.util.List; -import net.sourceforge.jnlp.browsertesting.Browsers; - -public class Opera extends LinuxBrowser { - - public Opera(String bin) { - super(bin); - fsdir="opera"; - } - - @Override - public Browsers getID() { - return Browsers.opera; - } - - @Override - public String getUserDefaultPluginExpectedLocation() { - return null; - } - - - String[] cs={"-nosession", "-nomail", "-nolirc", "-newtab"}; - - @Override - public List getComaptibilitySwitches() { - return Arrays.asList(cs); - } - - @Override - public List getDefaultSwitches() { - return null; - } - -} \ No newline at end of file diff --git a/tests/reproducers/README b/tests/reproducers/README new file mode 100644 index 0000000..a582318 --- /dev/null +++ b/tests/reproducers/README @@ -0,0 +1,32 @@ +Each file in directory simple must follows hierarchy conventions and is compiled/jared + automatically into server's working directory and content of resources likewise. + The name of jnlp is independent, and there can be even more jnlps for each future jar. +Directories are honored in srcs and in resources, but not in testcases. +Directories in signed handle their content in similar way as simple's content is handled, + but in addition final jars are signed with simple testkey. +Files in custom directory have to care about compilation/packaging and deploying of srcs + directory themselves. This can affect also testcase and resources, but testcases and + resources are still automatically prepared like they are in the other test types. +There are three reproducers – simpletest1, simpletest2 and deadlocktest, which tests + test’s suite itself and serve as examples of behaviour. + +Directory "signed" is listed in Makefile.am. You can specify as much to-be-signed +directories as you want. And jars in each of those signed directories will be +signed by their's own unique key (number of signed directories == number of certificates). +Do not forget to add each this directory into list n Makefile.am + +If the name of a folder in simple/signed is composed of dots, then its contents + are deployed from under a directory structure such that each part evaluates to + a folder. For example, my.dir.reproducer/ will be deployed as jnlp_test_server/my/dir/reproducer.jar. + +Inside custom directory are expected directories which are handling themselves. + The only strictly necessary file is custom/reproducerName/srcs/Makefile. Upon + all custom/*/srcs are then launched make prepare-reproducer and during cleaning make + clean-reproducer. Those targets are run after all simple and signed reproducers are + prepared, so they can reuse components of the simple and signed reproducers, eg + certificates or dependencies. to keep this custom makefiles as simple as possible. + Some comment in makefile or readme file is recommended for each custom reproducer + to tell dependencies and what it does. Some readme (or comment in classes) is good + advice for any reproducer anyway;) +Because of automake only small set of variables from icedtea-web Makefile is + available for custom makefiles, but feel free to export others if needed. diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html b/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html new file mode 100644 index 0000000..88b8d99 --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/resources/AppletFolderInArchiveTag.html @@ -0,0 +1,42 @@ + + +

+

+ + diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java new file mode 100644 index 0000000..0440500 --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/AppletFolderInArchiveTag.java @@ -0,0 +1,58 @@ +import java.applet.Applet; + +/* +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class AppletFolderInArchiveTag extends Applet { + + private static class Killer extends Thread { + @Override + public void run() { + try { + int n = 2000; + Thread.sleep(n); + System.exit(0); + } catch (Exception ex) { + } + } + } + + @Override + public void init() { + new Killer().start(); + System.out.println("This was ran from a folder specified in the archive tag."); + } +} diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile new file mode 100644 index 0000000..aa7f7fe --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/srcs/Makefile @@ -0,0 +1,18 @@ +TESTNAME=AppletFolderInArchiveTag +ARCHIVE_TEST_FOLDER=archive_tag_folder_test +JAVAC_CLASSPATH=$(JNLP_TESTS_ENGINE_DIR):$(NETX_DIR)/lib/classes.jar +DEPLOY_SUBDIR=$(JNLP_TESTS_SERVER_DEPLOYDIR)/$(ARCHIVE_TEST_FOLDER) +INDEX_HTML_BODY="

Required to recognize folder structure

" + +prepare-reproducer: + echo PREPARING REPRODUCER $(TESTNAME) + mkdir -p $(DEPLOY_SUBDIR) + echo INDEX_HTML_BODY > $(DEPLOY_SUBDIR)/index.html + $(EXPORTED_JAVAC) -classpath $(JAVAC_CLASSPATH) -d $(DEPLOY_SUBDIR) $(TESTNAME).java + echo PREPARED REPRODUCER $(TESTNAME) + +clean-reproducer: + echo CLEANING REPRODUCER $(TESTNAME) + rm -rf $(DEPLOY_SUBDIR) + echo CLEANED REPRODUCER $(TESTNAME) + diff --git a/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java b/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java new file mode 100644 index 0000000..63e8d7c --- /dev/null +++ b/tests/reproducers/custom/AppletFolderInArchiveTag/testcases/AppletFolderInArchiveTagTests.java @@ -0,0 +1,61 @@ +/* AppletFolderInArchiveTagTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +import org.junit.Assert; +import org.junit.Test; + +public class AppletFolderInArchiveTagTests extends BrowserTest{ + + + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.all}) + @Bug(id="PR1011") + public void testClassInAppletFolder() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletFolderInArchiveTag.html"); + + String s0 = "This was ran from a folder specified in the archive tag."; + Assert.assertTrue("Expected '"+s0+"', stdout was: " + pr.stdout, pr.stdout.contains(s0)); + } +} \ No newline at end of file diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp new file mode 100644 index 0000000..d75a83b --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedJAVAXJNLP.jnlp @@ -0,0 +1,57 @@ + + + + + Test accessClassInPackage signed + IcedTea + + testing access to some javax.jnlp.* package by signed app + + + + + + javax.jnlp.ServiceManager + + + + + diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp new file mode 100644 index 0000000..c6b066b --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedNETSF.jnlp @@ -0,0 +1,57 @@ + + + + + Test accessClassInPackage by signed app + IcedTea + + testing access to net.sourceforge.* package by signed app + + + + + + net.sourceforge.jnlp.Parser + + + + + diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp new file mode 100644 index 0000000..b7d1ff5 --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSELF.jnlp @@ -0,0 +1,57 @@ + + + + + Test accessClassInPackage by signed app + IcedTea + + testing aaccess to package's internal class by signed app + + + + + + AccessClassInPackageSigned + + + + + diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp new file mode 100644 index 0000000..ae4a19e --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/resources/AccessClassInPackageSignedSUNSEC.jnlp @@ -0,0 +1,57 @@ + + + + + Test accessClassInPackage by signed app + IcedTea + + testing access to sun.security.* package by signed app + + + + + + sun.security.internal.spec.TlsKeyMaterialSpec + + + + + diff --git a/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java b/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java new file mode 100644 index 0000000..63c681d --- /dev/null +++ b/tests/reproducers/signed/AccessClassInPackageSigned/srcs/AccessClassInPackageSigned.java @@ -0,0 +1,44 @@ +/* AccessClassInPackage.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AccessClassInPackageSigned { + + public static void main(String[] args) throws Exception{ + Class.forName(args[0]); + System.out.println("Class was obtained: "+ args[0]); + } +} diff --git a/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html new file mode 100644 index 0000000..6c6ac48 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.html @@ -0,0 +1,46 @@ + + +

+ + + + +

+ + diff --git a/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp new file mode 100644 index 0000000..2045818 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/resources/AppletTestSigned.jnlp @@ -0,0 +1,63 @@ + + + + + SignedAppletTest + IcedTea + + SignedAppletTest + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java b/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java new file mode 100644 index 0000000..1d475a5 --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/srcs/AppletTestSigned.java @@ -0,0 +1,82 @@ +/* AppletTestSigned.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.applet.Applet; + +public class AppletTestSigned extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("AppletTestSigned killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("AppletTestSigned was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("AppletTestSigned was started"); + System.out.println(getParameter("key1")); + System.out.println(getParameter("key2")); + killer.start(); + System.out.println("killer was started"); + } + + @Override + public void stop() { + System.out.println("AppletTestSigned was stopped"); + } + + @Override + public void destroy() { + System.out.println("AppletTestSigned will be destroyed"); + } +} diff --git a/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java b/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java new file mode 100644 index 0000000..d3d87ba --- /dev/null +++ b/tests/reproducers/signed/AppletTestSigned/testcases/AppletTestSignedTests.java @@ -0,0 +1,94 @@ +/* AppletTestSignedTests.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletTestSignedTests extends BrowserTest { + + private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); + + @Test + public void AppletTestSignedTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/AppletTestSigned.jnlp"); + evaluateSignedApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluateSignedApplet(ProcessResult pr) { + String s3 = "AppletTestSigned was initialised"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s3 + " but didn't", pr.stdout.contains(s3)); + String s0 = "AppletTestSigned was started"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s0 + " but didn't", pr.stdout.contains(s0)); + String s1 = "value1"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s1 + " but didn't", pr.stdout.contains(s1)); + String s2 = "value2"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s2 + " but didn't", pr.stdout.contains(s2)); + String s4 = "AppletTestSigned was stopped"; + Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s4 + " but did", pr.stdout.contains(s4)); + String s5 = "AppletTestSigned will be destroyed"; + Assert.assertFalse("AppletTestSigned stdout shouldn't contain " + s5 + " but did", pr.stdout.contains(s5)); + String ss = "xception"; + Assert.assertFalse("AppletTestSigned stderr should not contain " + ss + " but did", pr.stderr.contains(ss)); + String s7 = "AppletTestSigned killing himself after 2000 ms of life"; + Assert.assertTrue("AppletTestSigned stdout should contain " + s7 + " but didn't", pr.stdout.contains(s7)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.all}) + public void AppletTestSignedFirefoxTest() throws Exception { + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/AppletTestSigned.html"); + evaluateSignedApplet(pr); + Assert.assertTrue(pr.wasTerminated); + //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null + } finally { + ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } +} diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp new file mode 100644 index 0000000..87bfde4 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1.jnlp @@ -0,0 +1,17 @@ + + + + Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar + IcedTea + + + + + + + + + + diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp new file mode 100644 index 0000000..dba2a65 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer1_1.jnlp @@ -0,0 +1,17 @@ + + + + Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar + IcedTea + + + + + + + + + + diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp new file mode 100644 index 0000000..a588211 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2.jnlp @@ -0,0 +1,17 @@ + + + + Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar + IcedTea + + + + + + + + + + diff --git a/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp new file mode 100644 index 0000000..97745a7 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/resources/CacheReproducer2_1.jnlp @@ -0,0 +1,17 @@ + + + + Just prints out "Good simple javaws exapmle" using reflection call from CacheReproducer.jar SimpletestSigned1.jar + IcedTea + + + + + + + + + + diff --git a/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java b/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java new file mode 100644 index 0000000..e0813fa --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/srcs/CacheReproducer.java @@ -0,0 +1,47 @@ +/* CacheReproducer.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.lang.reflect.*; + +public class CacheReproducer{ + + public static void main(String[] args) throws Exception{ + Class c1= Class.forName("SimpletestSigned1"); + Method m1=c1.getDeclaredMethod("main",args.getClass()); + m1.invoke((Object) null, (Object)args); + } +} diff --git a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java new file mode 100644 index 0000000..a8a2859 --- /dev/null +++ b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java @@ -0,0 +1,478 @@ +/* CacheReproducerTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.KnownToFail; +import org.junit.AfterClass; +import org.junit.Assert; + +import org.junit.Test; + +public class CacheReproducerTest { + + private static final ServerAccess server = new ServerAccess(); + private static final List clear = Arrays.asList(new String[]{server.getJavawsLocation(), "-Xclearcache", ServerAccess.HEADLES_OPTION}); + private static final List trustedVerboses = Arrays.asList(new String[]{"-Xtrustall", ServerAccess.HEADLES_OPTION,"-verbose"}); + private static final List verbosed = Arrays.asList(new String[]{"-verbose", ServerAccess.HEADLES_OPTION}); + private static final String home = System.getProperty("user.home"); + private static final String name = System.getProperty("user.name"); + private static final String tmp = System.getProperty("java.io.tmpdir"); + private static final File icedteaDir = new File(home + "/" + ".icedtea"); + private static final File icedteaCache = new File(icedteaDir, "cache"); + private static final File icedteaCacheFile = new File(icedteaCache, "recently_used"); + private static final File netxLock = new File(tmp + "/" + name + "/netx/locks/netx_running"); + private static final String lre = "LruCacheException"; + private static final String ioobe = "IndexOutOfBoundsException"; + private static final String corruptRegex = "\\d{13}"; + private static final Pattern corruptPatern = Pattern.compile(corruptRegex); + private static final String corruptString = "156dsf1562kd5"; + + String testS = "#netx file\n" + + "#Mon Dec 12 16:20:46 CET 2011\n" + + "1323703236508,0=/home/xp13/.icedtea/cache/0/http/localhost/ReadPropertiesBySignedHack.jnlp\n" + + "1323703243086,2=/home/xp14/.icedtea/cache/2/http/localhost/ReadProperties.jar\n" + + "1323703243082,1=/home/xp15/.icedtea/cache/1/http/localhost/ReadPropertiesBySignedHack.jar"; + + @Test + public void cacheIsWorkingTest() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + } + + @Test + public void cacheIsWorkingTestSigned() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1Signed()); + assertCacheIsNotEmpty(); + } + + private class ParallelSimpleTestRunner extends Thread { + public boolean b=false; + @Override + public void run() { + try { + + ServerAccess.ProcessResult pr = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr); + b=true; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + }; + + @Test + @KnownToFail + public void startParallelInstancesUponBrokenCache() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ParallelSimpleTestRunner t1=new ParallelSimpleTestRunner(); + ParallelSimpleTestRunner t2=new ParallelSimpleTestRunner(); + ParallelSimpleTestRunner t3=new ParallelSimpleTestRunner(); + t1.start(); + t2.start(); + t3.start(); + int c=0; + while(true){ + c++; + Thread.sleep(100); + if (c>600) throw new Error("threads have not died in time"); + if (!t1.isAlive() && !t2.isAlive() && !t3.isAlive()) break; + } + Thread.sleep(1000); + Assert.assertTrue(t1.b); + Assert.assertTrue(t2.b); + Assert.assertTrue(t3.b); + } + + + private void assertCacheIsNotEmpty() { + Assert.assertTrue("icedtea cache " + icedteaCache.getAbsolutePath() + " should exist some any run", icedteaCache.exists()); + Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should exist some any run", icedteaCacheFile.exists()); + Assert.assertTrue("icedtea cache file " + icedteaCacheFile.getAbsolutePath() + " should not be empty", icedteaCacheFile.length() > 0); + } + + /** + * This is breaking integer numbers in first part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache1() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + /** + * This is breaking integer numbers in first part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache2() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + /** + * This is breaking paths in second part of cache file item + * @throws Exception + */ + @Test + public void coruptAndRunCache3() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache3(); + ProcessResult pr = runSimpleTest1(); + assertAoobNOTappeared(pr); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + private void assertAoobNOTappeared(ProcessResult pr2) { + Assert.assertFalse("serr should NOT contain " + ioobe, pr2.stderr.contains(ioobe)); + } + + private void assertLruExceptionNOTappeared(ProcessResult pr2) { + Assert.assertFalse("serr should NOT contain " + lre, pr2.stderr.contains(lre)); + } + + private void assertLruExceptionAppeared(ProcessResult pr) { + Assert.assertTrue("serr should contain " + lre, pr.stderr.contains(lre)); + } + + @Test + public void coruptAndRunCache1Signed() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1Signed(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + @Test + public void coruptAndRunCache2Signed() throws Exception { + clearAndEvaluateCache(); + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + breakCache1(); + ProcessResult pr = runSimpleTest1Signed(); + assertLruExceptionAppeared(pr); + evaluateSimpleTest1OkCache(pr); + ProcessResult pr3 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr3); + assertLruExceptionNOTappeared(pr3); + clearAndEvaluateCache(); + ProcessResult pr2 = runSimpleTest1Signed(); + evaluateSimpleTest1OkCache(pr2); + assertLruExceptionNOTappeared(pr2); + } + + @Test + public void clearCacheUnsucessfully() throws Exception { + evaluateSimpleTest1OkCache(runSimpleTest1()); + assertCacheIsNotEmpty(); + ProcessResult pr; + Thread t = new Thread(new Runnable() { + + @Override + public void run() { + try { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(verbosed, "/deadlocktest.jnlp"); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + }); + t.start(); + Thread.sleep(1000); + pr = tryToClearcache(); + String q = "Can not clear cache at this time"; + Assert.assertTrue("Stderr should contain " + q + ", but did not.", pr.stderr.contains(q)); + assertCacheIsNotEmpty(); + } + + + //next four tests are designed to ensure, that corrupted cache will not break already loaded cached files + public static final String CR1 = "CacheReproducer1"; + public static final String CR2 = "CacheReproducer2"; + public static final String CR11 = "CacheReproducer1_1"; + public static final String CR21 = "CacheReproducer2_1"; + + public void testsBody(String id, int breaker) throws Exception { + clearAndEvaluateCache(); + ProcessResult pr1 = runSimpleTestSigned(id); + assertLruExceptionNOTappeared(pr1); + evaluateSimpleTest1OkCache(pr1); + if (breaker < 0) { + breakCache1(); + } else { + breakCache2(breaker); + } + ProcessResult pr2 = runSimpleTestSigned(id); + assertLruExceptionAppeared(pr2); + evaluateSimpleTest1OkCache(pr2); + } + + @Test + public void testAlreadyLoadedCached1() throws Exception { + testsBody(CR1, 1); + testsBody(CR1, 2); + testsBody(CR1, -1); + } + + @Test + public void testAlreadyLoadedCached2() throws Exception { + testsBody(CR2, 1); + testsBody(CR2, 2); + testsBody(CR2, -1); + } + + @Test + public void testAlreadyLoadedCached11() throws Exception { + testsBody(CR11, 1); + testsBody(CR11, 2); + testsBody(CR11, -1); + } + + @Test + public void testAlreadyLoadedCached21() throws Exception { + testsBody(CR21, 1); + testsBody(CR21, 2); + testsBody(CR21, -1); + } + + @AfterClass + public static void clearCache() throws Exception { + clearAndEvaluateCache(); + } + + private static void clearAndEvaluateCache() throws Exception { + clearAndEvaluateCache(true); + } + + private static void clearAndEvaluateCache(boolean force) throws Exception { + if (force) { + if (netxLock.isFile()) { + boolean b = netxLock.delete(); + junit.framework.Assert.assertTrue(b); + } + + } + tryToClearcache(); + Assert.assertFalse("icedtea cache " + icedteaCache.getAbsolutePath() + " should not exist after clearing", icedteaCache.exists()); + } + + private static String loadFile(File f) throws FileNotFoundException, UnsupportedEncodingException, IOException { + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(icedteaCacheFile), "UTF-8")); + StringBuilder sb = new StringBuilder(); + while (true) { + String s = r.readLine(); + if (s == null) { + break; + } + sb.append(s).append("\n"); + + } + return sb.toString(); + } + + private static String loadCacheFile() throws IOException { + return loadFile(icedteaCacheFile); + } + + @Test + public void assertBreakers1AreWorking() { + String s=testS; + String sp[] = s.split("\n"); + String ss[] = breakAll(s).split("\n"); + for (int i = 0; i < 2; i++) { + Assert.assertEquals(sp[i], ss[i]); + + } + for (int i = 2; i < ss.length; i++) { + Assert.assertNotSame(sp[i], ss[i]); + + } + String sb = breakOne(s, 0); + junit.framework.Assert.assertEquals(s, sb); + for (int x = 1; x <= 3; x++) { + String[] sx = breakOne(s, x).split("\n"); + for (int i = 0; i < sx.length; i++) { + if (i == x + 1) { + Assert.assertNotSame(sp[i], sx[i]); + } else { + Assert.assertEquals(sp[i], sx[i]); + } + + } + } + String sbb = breakOne(s, 4); + Assert.assertEquals(s, sbb); + } + + private static String breakAll(String s) { + return s.replaceAll(corruptRegex, corruptString); + } + + private static String breakOne(String s, int i) { + Matcher m1 = corruptPatern.matcher(s); + int x = 0; + while (m1.find()) { + x++; + String r = (m1.group(0)); + if (x == i) { + return s.replace(r, corruptString); + } + } + return s; + } + + @Test + public void assertBreakers2AreWorking() { + String s=testS; + String sp[] = s.split("\n"); + String ss[] = breakPaths (s).split("\n"); + for (int i = 0; i < 2; i++) { + Assert.assertEquals(sp[i], ss[i]); + + } + for (int i = 2; i < ss.length; i++) { + Assert.assertNotSame(sp[i], ss[i]); + + } + } + + private static String breakPaths(String s) { + return s.replaceAll(home+".*", "/ho"); + } + + private static void breakCache1() throws IOException { + String s = loadCacheFile(); + s = breakAll(s); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static void breakCache2(int i) throws FileNotFoundException, UnsupportedEncodingException, IOException { + String s = loadCacheFile(); + s = breakOne(s, i); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static void breakCache3() throws IOException { + String s = loadCacheFile(); + s = breakPaths(s); + ServerAccess.saveFile(s, icedteaCacheFile); + } + + private static ServerAccess.ProcessResult runSimpleTest1() throws Exception { + return runSimpleTest1(verbosed, "simpletest1"); + } + + private static ServerAccess.ProcessResult runSimpleTest1(List args, String s) throws Exception { + ServerAccess.ProcessResult pr2 = server.executeJavawsHeadless(args, "/" + s + ".jnlp"); + return pr2; + } + + private static ServerAccess.ProcessResult runSimpleTest1Signed() throws Exception { + return runSimpleTestSigned("SimpletestSigned1"); + } + + private static ServerAccess.ProcessResult runSimpleTestSigned(String id) throws Exception { + return runSimpleTest1(trustedVerboses, id); + } + + private static void evaluateSimpleTest1OkCache(ServerAccess.ProcessResult pr2) throws Exception { + String s = "Good simple javaws exapmle"; + Assert.assertTrue("test stdout should contain " + s + " but didn't", pr2.stdout.contains(s)); + Assert.assertFalse(pr2.wasTerminated); + Assert.assertEquals((Integer) 0, pr2.returnValue); + } + + private static ProcessResult tryToClearcache() throws Exception { + ServerAccess.ProcessResult pr1 = ServerAccess.executeProcess(clear); + return pr1; + } +} diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp new file mode 100644 index 0000000..44d9025 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-hack.jnlp @@ -0,0 +1,62 @@ + + + + + InternalClassloaderWithDownloadedResource-applet-hack + IcedTea + + InternalClassloaderWithDownloadedResource-applet-hack + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp new file mode 100644 index 0000000..882461c --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-applet-new.jnlp @@ -0,0 +1,62 @@ + + + + + InternalClassloaderWithDownloadedResource-applet-new + IcedTea + + InternalClassloaderWithDownloadedResource-applet-new + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html new file mode 100644 index 0000000..7373bbd --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.html @@ -0,0 +1,48 @@ + + + + + +

+ + + +

+ + diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp new file mode 100644 index 0000000..911cc81 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-hack.jnlp @@ -0,0 +1,57 @@ + + + + + InternalClassloaderWithDownloadedResource-hack + IcedTea + + InternalClassloaderWithDownloadedResource-hack + + + + + + + + hack + + + + + \ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html new file mode 100644 index 0000000..4d0c401 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.html @@ -0,0 +1,48 @@ + + + + + +

+ + + +

+ + diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp new file mode 100644 index 0000000..5a3050e --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/resources/InternalClassloaderWithDownloadedResource-new.jnlp @@ -0,0 +1,57 @@ + + + + + InternalClassloaderWithDownloadedResource-new + IcedTea + + InternalClassloaderWithDownloadedResource-new + + + + + + + + new + + + + + \ No newline at end of file diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java new file mode 100644 index 0000000..96cfcdf --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/srcs/InternalClassloaderWithDownloadedResource.java @@ -0,0 +1,164 @@ +/* InternalClassloaderWithDownloadedResource.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.applet.Applet; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; + +public class InternalClassloaderWithDownloadedResource extends Applet { + + public static void main(String[] args) throws Exception { + int port = 44321; //debug default + String sPort = System.getProperty("serveraccess.port"); + if (sPort != null) { + port = new Integer(sPort); + } + if (args.length != 1) { + throw new IllegalArgumentException("exactly one argument expected"); + } + resolveArgument(args[0], port); + + } + + private static void downlaodAndExecuteForeignMethod(int port, int classlaoder) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { + URL url = new URL("http://localhost:" + port + "/SimpletestSigned1.jar"); + URLClassLoader ucl = null; + if (classlaoder == 1) { + ucl = (URLClassLoader) InternalClassloaderWithDownloadedResource.class.getClassLoader(); + System.out.println("Downloading " + url.toString()); + Method privateStringMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); + privateStringMethod.setAccessible(true); + privateStringMethod.invoke(ucl, url); + } else if (classlaoder == 2) { + ucl = new URLClassLoader(new URL[]{url}); + } else { + throw new IllegalArgumentException("just 1 or 2 classlaoder id expected"); + } + executeForeignMethod(port, ucl); + } + + private static void executeForeignMethod(int port, URLClassLoader loader) throws SecurityException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, MalformedURLException, IllegalArgumentException { + String className = "SimpletestSigned1"; + Class cls = loader.loadClass(className); + Method m = cls.getMethod("main", new Class[]{new String[0].getClass()}); + System.out.println("executing " + className + "'s main"); + m.invoke(null, (Object) new String[0]); + } + + private static void resolveArgument(String s, int port) throws Exception { + if (s == null) { + throw new IllegalArgumentException("arg was null"); + } else if (s.equalsIgnoreCase("hack")) { + downlaodAndExecuteForeignMethod(port, 1); + } else if (s.equalsIgnoreCase("new")) { + downlaodAndExecuteForeignMethod(port, 2); + } else { + throw new IllegalArgumentException("hack or new expected as argument"); + } + } + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("applet was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("applet was started"); + killer.start(); + int port = 44321; //debug default + try { + File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); + if (portsFile.exists()) { + String sPort = null; + BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(portsFile), "utf-8")); + try { + sPort = br.readLine(); + } finally { + br.close(); + } + if (sPort != null) { + port = new Integer(sPort.trim()); + } + } + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + try { + resolveArgument(getParameter("arg"), port); + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException(ex); + } + System.out.println("killer was started"); + } + + @Override + public void stop() { + System.out.println("applet was stopped"); + } + + @Override + public void destroy() { + System.out.println("applet will be destroyed"); + } +} diff --git a/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java new file mode 100644 index 0000000..54cb203 --- /dev/null +++ b/tests/reproducers/signed/InternalClassloaderWithDownloadedResource/testcases/InternalClassloaderWithDownloadedResourceTest.java @@ -0,0 +1,140 @@ +/* InternalClassloaderWithDownloadedResourceTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +@Bug(id = {"RH816592","PR858"}) +public class InternalClassloaderWithDownloadedResourceTest extends BrowserTest { + + private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-verbose", "-Xtrustall", "-J-Dserveraccess.port=" + server.getPort()})); + private static final File portsFile = new File(System.getProperty("java.io.tmpdir"), "serveraccess.port"); + + @Before + public void setUp() { + try { + ServerAccess.logOutputReprint("Writeing " + server.getPort() + " to " + portsFile.getAbsolutePath()); + ServerAccess.saveFile("" + server.getPort(), portsFile); + ServerAccess.logOutputReprint("done"); + } catch (Exception ex) { + ServerAccess.logException(ex); + } + } + + @After + public void tearDown() { + ServerAccess.logOutputReprint("Deleting " + portsFile.getAbsolutePath()); + boolean b = portsFile.delete(); + ServerAccess.logOutputReprint("Deletion state (should be true) is " + b); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplication() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-new.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluate(ProcessResult pr) { + String ss = "Good simple javaws exapmle"; + Assert.assertTrue("Stdout should contains " + ss + " but didn't", pr.stdout.contains(ss)); + String s = "xception"; + Assert.assertFalse("Stderr should not contains " + s + " but did", pr.stderr.contains(s)); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplet() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-new.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @Bug(id = {"RH816592","PR858"}) + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.all}) + public void launchInternalClassloaderWithDownloadedResourceAsHtmlApplet() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-new.html"); + evaluate(pr); + Assert.assertTrue("should be terminated but was not", pr.wasTerminated); + } + + @Test + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpApplicationHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-hack.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + public void launchInternalClassloaderWithDownloadedResourceAsJnlpAppletHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/InternalClassloaderWithDownloadedResource-applet-hack.jnlp"); + evaluate(pr); + Assert.assertFalse("should not be terminated but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + @NeedsDisplay + @Bug(id = {"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-May/018737.html"}) + @TestInBrowsers(testIn={Browsers.all}) + public void launchInternalClassloaderWithDownloadedResourceAsHtmlAppletHack() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/InternalClassloaderWithDownloadedResource-hack.html"); + evaluate(pr); + Assert.assertTrue("should be terminated but was not", pr.wasTerminated); + } +} diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp new file mode 100644 index 0000000..ed761ca --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar.jnlp @@ -0,0 +1,21 @@ + + + + test MissingJar + IcedTea + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp new file mode 100644 index 0000000..4a32d78 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar2.jnlp @@ -0,0 +1,19 @@ + + + + test MissingJar + IcedTea + + + + + + + + + + + diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp new file mode 100644 index 0000000..b2b6007 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar3.jnlp @@ -0,0 +1,19 @@ + + + + test MissingJar + IcedTea + + + + + + + + + + + diff --git a/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp b/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp new file mode 100644 index 0000000..60a53c0 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/resources/MissingJar4.jnlp @@ -0,0 +1,21 @@ + + + + test MissingJar + IcedTea + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/MissingJar/srcs/MissingJar.java b/tests/reproducers/signed/MissingJar/srcs/MissingJar.java new file mode 100644 index 0000000..a2b2794 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/srcs/MissingJar.java @@ -0,0 +1,42 @@ +/* MissingJar.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class MissingJar { + public static void main(String[] args) { + System.out.println("only fixed classloader can initialize this app"); + } +} diff --git a/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java b/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java new file mode 100644 index 0000000..dc8bb77 --- /dev/null +++ b/tests/reproducers/signed/MissingJar/testcases/MissingJarTest.java @@ -0,0 +1,84 @@ +/* MissingJar.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import org.junit.Assert; + +import org.junit.Test; + +public class MissingJarTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[]{"-Xtrustall"})); + + private void evaluateResult(ProcessResult pr) { + String c = "only fixed classloader can initialize this app"; + Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did ", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + public void MissingJarTest1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar2.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar3.jnlp"); + evaluateResult(pr); + } + + @Test + public void MissingJarTest4() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/MissingJar4.jnlp"); + evaluateResult(pr); + } +} diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp b/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp new file mode 100644 index 0000000..f4e1223 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/resources/ReadPropertiesBySignedHack.jnlp @@ -0,0 +1,19 @@ + + + + read properties using System.getenv() + IcedTea + + + + + + + user.name + + + + + diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java b/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java new file mode 100644 index 0000000..cea64af --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/srcs/ReadPropertiesBySignedHack.java @@ -0,0 +1,63 @@ +/* ReadPropertiesSigned.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +import java.lang.reflect.*; + +public class ReadPropertiesBySignedHack { + + /** + *some system property is expected as arg[0], eg user.name or user.home + */ + public static void main(String[] args) throws Throwable { + //security manager is not protecting us from accessing classes from + //net.sourceforge.jnlp.runtime via reflection + Class c2= Class.forName("net.sourceforge.jnlp.runtime.JNLPRuntime"); + Field f2 = c2.getDeclaredField("trustAll"); + f2.setAccessible(true); + f2.setBoolean(null, true); + Method m2=c2.getDeclaredMethod("setTrustAll",Boolean.TYPE); + m2.setAccessible(true); + m2.invoke((Object) null, true ); + //but security manager is guarding us against lunching unsigned code + //from signed archvive even if Xtrustall is on. + Class c1= Class.forName("ReadProperties"); + Method m1=c1.getDeclaredMethod("main",args.getClass()); + m1.invoke((Object) null, (Object)args); + } + + + +} diff --git a/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java new file mode 100644 index 0000000..8f9455d --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesBySignedHack/testcases/ReadPropertiesBySignedHackTest.java @@ -0,0 +1,65 @@ +/* ReadPropertiesSignedTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesBySignedHackTest { + + private static ServerAccess server = new ServerAccess(); + private final List l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); + + + @Test + public void ReadPropertiesBySignedHackWithjoutXtrustAll() throws Exception { + //no request for permissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesBySignedHack.jnlp"); + String s="java.lang.SecurityException: class \"ReadProperties\"'s signer information does not match signer information of other classes in the same package"; + Assert.assertTrue("Stderr should contains "+s+" but did not",pr.stderr.contains(s)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp new file mode 100644 index 0000000..a1adab8 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned1.jnlp @@ -0,0 +1,15 @@ + + + + read properties using System.getenv() + IcedTea + + + + + + user.name + + diff --git a/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp new file mode 100644 index 0000000..db338df --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/resources/ReadPropertiesSigned2.jnlp @@ -0,0 +1,18 @@ + + + + read properties using System.getenv() + IcedTea + + + + + + user.name + + + + + diff --git a/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java b/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java new file mode 100644 index 0000000..60f53cb --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/srcs/ReadPropertiesSigned.java @@ -0,0 +1,45 @@ +/* ReadPropertiesSigned.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class ReadPropertiesSigned { + + /** + *some system property is expected as arg[0], eg user.name or user.home + */ + public static void main(String[] args) { + System.out.println(System.getProperty(args[0])); + } +} diff --git a/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java new file mode 100644 index 0000000..6b389e3 --- /dev/null +++ b/tests/reproducers/signed/ReadPropertiesSigned/testcases/ReadPropertiesSignedTest.java @@ -0,0 +1,91 @@ +/* ReadPropertiesSignedTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesSignedTest { + + private static ServerAccess server = new ServerAccess(); + private final List l=Collections.unmodifiableList(Arrays.asList(new String[] {"-Xtrustall"})); + + String accessMatcher = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; + + @Test + public void ReadSignedPropertiesWithoutPermissionsWithXtrustAll() throws Exception { + //no request for permissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned1.jnlp"); + Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be <2 but was "+pr.stdout.length(),pr.stdout.length()<2); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void ReadSignedPropertiesWithPermissionsWithXtrustAll() throws Exception { + //request for allpermissions + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadPropertiesSigned2.jnlp"); + Assert.assertFalse("Stderr should NOT match "+accessMatcher+" but did",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertTrue("stdout lenght should be >= but was "+pr.stdout.length(),pr.stdout.length()>=4); // /home/user or /root or eanything else :( + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void EnsureXtrustallNotAffectingUnsignedBehaviour() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(l,"/ReadProperties1.jnlp"); + Assert.assertTrue("Stderr should match "+accessMatcher+" but did not",pr.stderr.matches(accessMatcher)); + String ss="ClassNotFoundException"; + Assert.assertFalse("Stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertFalse("stdout lenght should not be >2 but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("should not be terminated but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + ServerAccess.ProcessResult pr2=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); + Assert.assertEquals(pr.stderr, pr2.stderr); + Assert.assertEquals(pr.stdout, pr2.stdout); + + } + } diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp new file mode 100644 index 0000000..5285cd9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication1.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpApplication + IcedTea + + SignedJnlpApplication + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp new file mode 100644 index 0000000..a86d0c2 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication2.jnlp @@ -0,0 +1,65 @@ + + + + + SignedJnlpApplication + IcedTea + + SignedJnlpApplication + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp new file mode 100644 index 0000000..0c7cc1f --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/resources/SignedJnlpApplication3.jnlp @@ -0,0 +1,61 @@ + + + + + SignedJnlpApplication + IcedTea + + SignedJnlpApplication + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp new file mode 100644 index 0000000..5285cd9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpApplication + IcedTea + + SignedJnlpApplication + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java b/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java new file mode 100644 index 0000000..1f16697 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/srcs/SignedJnlpApplication.java @@ -0,0 +1,43 @@ +/* SignedJnlpApplication.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SignedJnlpApplication { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java b/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java new file mode 100644 index 0000000..fb4e9ff --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpApplication/testcases/SignedJnlpApplicationTest.java @@ -0,0 +1,77 @@ +/* SignedJnlpApplicationTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SignedJnlpApplicationTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + + @Test + public void launchingFileMatchesSignedApplication1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + /** + * Using a different value of name within the 'property' element in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedApplication1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication2.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } + + /** + * Missing 'property' child element within 'resource' in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedApplication2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpApplication3.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } +} \ No newline at end of file diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp new file mode 100644 index 0000000..3a5651e --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne1.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest + IcedTea + + SignedJnlpCaseTest + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp new file mode 100644 index 0000000..18c0943 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/resources/SignedJnlpCaseTestOne2.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest 2 + IcedTea + + SignedJnlpCaseTest 2 + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp new file mode 100644 index 0000000..3a5651e --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/JNLP-INF/aPpLiCaTioN.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest + IcedTea + + SignedJnlpCaseTest + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java new file mode 100644 index 0000000..993fe6d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/srcs/SignedJnlpCase.java @@ -0,0 +1,43 @@ +/* SignedJnlpCase.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SignedJnlpCase { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java b/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java new file mode 100644 index 0000000..d410790 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestOne/testcases/SignedJnlpCaseOneTest.java @@ -0,0 +1,65 @@ +/* SignedJnlpCaseOneTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SignedJnlpCaseOneTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + + @Test + public void launchingFileMatchesSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + @Test + public void launchingFileDoesNotMatchSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestOne2.jnlp"); + String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp new file mode 100644 index 0000000..23fcacb --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo1.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest + IcedTea + + SignedJnlpCaseTest + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp new file mode 100644 index 0000000..e97a126 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/resources/SignedJnlpCaseTestTwo2.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest 2 + IcedTea + + SignedJnlpCaseTest 2 + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp new file mode 100644 index 0000000..ed34ac9 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/JNLP-INF/aPpLiCaTiOn_tEmPlAte.jnlp @@ -0,0 +1,62 @@ + + + + + SignedJnlpCaseTest + IcedTea + + SignedJnlpCaseTest + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java new file mode 100644 index 0000000..993fe6d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/srcs/SignedJnlpCase.java @@ -0,0 +1,43 @@ +/* SignedJnlpCase.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SignedJnlpCase { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java b/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java new file mode 100644 index 0000000..2869552 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpCaseTestTwo/testcases/SignedJnlpCaseTwoTest.java @@ -0,0 +1,65 @@ +/* SignedJnlpCaseTwoTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SignedJnlpCaseTwoTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + + @Test + public void launchingFileMatchesSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + @Test + public void launchingFileDoesNotMatchSigned() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpCaseTestTwo2.jnlp"); + String s = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + Assert.assertTrue("Stderr should contains " + s + " but did not", pr.stderr.contains(s)); + } +} diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp new file mode 100644 index 0000000..782c465 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate1.jnlp @@ -0,0 +1,66 @@ + + + + + SignedJnlpTemplate + IcedTea + + SignedJnlpTemplate + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp new file mode 100644 index 0000000..d43f834 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate2.jnlp @@ -0,0 +1,64 @@ + + + + + SignedJnlpTemplate + IcedTea + + SignedJnlpTemplate + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp new file mode 100644 index 0000000..c47a74d --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/resources/SignedJnlpTemplate3.jnlp @@ -0,0 +1,71 @@ + + + + + SignedJnlpTemplate + IcedTea + + SignedJnlpTemplate + + + + + IcedTea-Web + IcedTea + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp new file mode 100644 index 0000000..8936031 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp @@ -0,0 +1,62 @@ + + + + + * + IcedTea + + * + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java b/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java new file mode 100644 index 0000000..9a94182 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/srcs/SignedJnlpTemplate.java @@ -0,0 +1,43 @@ +/* SignedJnlpTemplate.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SignedJnlpTemplate { + + public static void main(String[] args) { + System.out.println("Running signed application in main"); + } +} diff --git a/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java b/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java new file mode 100644 index 0000000..5f2dd78 --- /dev/null +++ b/tests/reproducers/signed/SignedJnlpTemplate/testcases/SignedJnlpTemplateTest.java @@ -0,0 +1,77 @@ +/* SignedJnlpTemplateTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SignedJnlpTemplateTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String signedException = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: The signed " + + "JNLP file did not match the launching JNLP file. Missing Resource: Signed Application did not match " + + "launching JNLP File"; + + @Test + public void launchingFileMatchesSignedTemplate1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate1.jnlp"); + String s = "Running signed application in main"; + Assert.assertTrue("Stdout should contains " + s + " but did not", pr.stdout.contains(s)); + } + + /** + * Missing 'j2se' child within the 'resource' element in the launching JNLP file + */ + @Test + public void launchingFileDoesNotMatchSignedTemplate2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate2.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } + + /** + * Added an extra "information" element to the launching JNLP file * + */ + @Test + public void launchingFileDoesNotMatchSignedTemplate3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/SignedJnlpTemplate3.jnlp"); + Assert.assertTrue("Stderr should contains " + signedException + " but did not", pr.stderr.contains(signedException)); + } +} \ No newline at end of file diff --git a/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp b/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp new file mode 100644 index 0000000..177dcaa --- /dev/null +++ b/tests/reproducers/signed/SimpletestSigned1/resources/SimpletestSigned1.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java b/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java new file mode 100644 index 0000000..b0a30a9 --- /dev/null +++ b/tests/reproducers/signed/SimpletestSigned1/srcs/SimpletestSigned1.java @@ -0,0 +1,43 @@ +/* SimpletestSigned1.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SimpletestSigned1{ + + public static void main(String[] args){ + System.out.println("Good simple javaws exapmle"); + } +} diff --git "a/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" "b/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" new file mode 100644 index 0000000..ba5cbc3 --- /dev/null +++ "b/tests/reproducers/signed/Spaces can be everywhere signed/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too signed.jnlp" @@ -0,0 +1,61 @@ + + + + + Spaces can be everywhere test with few more chars for encoding signed + IcedTea + + AppletTest + + + + + + + + + + + + diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp new file mode 100644 index 0000000..e73043c --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere1 signed.jnlp @@ -0,0 +1,53 @@ + + + + + Spaces can be everywhere1 signed + IcedTea + + Spaces can be everywhere1 signed + + + + + + + + + diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp new file mode 100644 index 0000000..872fb8c --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/Spaces can be everywhere2 signed.jnlp @@ -0,0 +1,53 @@ + + + + + Spaces can be everywhere2 + IcedTea + + Spaces can be everywhere2 signed + + + + + + + + + diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp b/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp new file mode 100644 index 0000000..801a62b --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/SpacesCanBeEverywhere1signed.jnlp @@ -0,0 +1,53 @@ + + + + + Spaces can be everywhere signed + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html b/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html new file mode 100644 index 0000000..32e60b4 --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/resources/spaces applet Tests signed.html @@ -0,0 +1,42 @@ + + +

+

+ + diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java b/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java new file mode 100644 index 0000000..25d28cf --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/srcs/SpacesCanBeEverywhereSigned.java @@ -0,0 +1,76 @@ + +import java.applet.Applet; + +/* SpacesCanBeEverywhereSigned.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SpacesCanBeEverywhereSigned extends Applet{ + + public static void main(String[] args){ + System.out.println("Signed spaces can be everywhere.jsr was launched correctly"); + } + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + killer = new Killer(); + } + + @Override + public void start() { + main(null); + killer.start(); + System.out.println("killer was started"); + } + + +} diff --git a/tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java b/tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java new file mode 100644 index 0000000..f33b203 --- /dev/null +++ b/tests/reproducers/signed/Spaces can be everywhere signed/testcases/SpacesCanBeEverywhereTestsSigned.java @@ -0,0 +1,245 @@ +/* SpacesCanBeEverywhereTestsSigned.java +Copyright (C) 20121 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.ArrayList; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"}) +public class SpacesCanBeEverywhereTestsSigned extends BrowserTest { + + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereLocalAppletTestsJnlp2Signed() throws Exception { + List commands=new ArrayList(1); + commands.add(server.getJavawsLocation()); + commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too signed.jnlp"); + /* Change of dir is cousing the Exception bellow + * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + * No X11 DISPLAY variable was set, but this program performed an operation which requires it. + * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) + * at java.awt.Window.(Window.java:476) + * at java.awt.Frame.(Frame.java:419) + * at java.awt.Frame.(Frame.java:384) + * at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1754) + * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831) + * at javax.swing.JWindow.(JWindow.java:185) + * at javax.swing.JWindow.(JWindow.java:137) + * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.(JNLPSecurityManager.java:121) + * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) + * at java.security.AccessController.doPrivileged(Native Method) + * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) + * + * Thats why there is absolute path to the file. + * + * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing - + * it is in headless mode. This can be considered as bug, but because it is + * only on ocal files, and probably only from test run - it can be ignored + */ + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too%20signed.jnlp"); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + @TestInBrowsers(testIn = {Browsers.one}) + public void SpacesCanBeEverywhereRemoteAppletTestsHtml2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests+signed.html"); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); + } + + + @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"}) + @Test + public void SpacesCanBeEverywhereRemoteTests1Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1%20signed.jnlp"); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp"); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test=20"); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2Signed_withQuery2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2%20signed.jnlp?test%3D20"); + + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests3Signed() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1signed.jnlp"); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests1Signed() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere1.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests2Signed() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere2 signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests4Signed() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add(server.getDir()+"/Spaces can be everywhere2 signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests3Signed() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("SpacesCanBeEverywhere1signed.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Signed spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp new file mode 100644 index 0000000..cea0a6c --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageJAVAXJNLP.jnlp @@ -0,0 +1,54 @@ + + + + + Test accessClassInPackage + IcedTea + + testing access to some javax.jnlp.* package + + + + + + javax.jnlp.ServiceManager + + diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp new file mode 100644 index 0000000..f8413e6 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageNETSF.jnlp @@ -0,0 +1,54 @@ + + + + + Test accessClassInPackage + IcedTea + + testing access to net.sourceforge.* package + + + + + + net.sourceforge.jnlp.Parser + + diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp new file mode 100644 index 0000000..4af8c04 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSELF.jnlp @@ -0,0 +1,54 @@ + + + + + Test accessClassInPackage + IcedTea + + testing aaccess to package's internal class + + + + + + AccessClassInPackage + + diff --git a/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp new file mode 100644 index 0000000..8f3c06a --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/resources/AccessClassInPackageSUNSEC.jnlp @@ -0,0 +1,54 @@ + + + + + Test accessClassInPackage + IcedTea + + testing access to sun.security.* package + + + + + + sun.security.internal.spec.TlsKeyMaterialSpec + + diff --git a/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java b/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java new file mode 100644 index 0000000..7164006 --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/srcs/AccessClassInPackage.java @@ -0,0 +1,44 @@ +/* AccessClassInPackage.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AccessClassInPackage { + + public static void main(String[] args) throws Exception{ + Class.forName(args[0]); + System.out.println("Class was obtained: "+ args[0]); + } +} diff --git a/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java b/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java new file mode 100644 index 0000000..e9952ff --- /dev/null +++ b/tests/reproducers/simple/AccessClassInPackage/testcases/AccessClassInPackageTest.java @@ -0,0 +1,168 @@ +/* AccessClassInPackageTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import org.junit.Assert; + +import org.junit.Test; + +public class AccessClassInPackageTest { + + private static ServerAccess server = new ServerAccess(); + private String[] files = { + "AccessClassInPackageJAVAXJNLP.jnlp", + "AccessClassInPackageSELF.jnlp", + "AccessClassInPackageNETSF.jnlp", + "AccessClassInPackageSUNSEC.jnlp" + }; + private String[] filesSigned = { + "AccessClassInPackageSignedJAVAXJNLP.jnlp", + "AccessClassInPackageSignedSELF.jnlp", + "AccessClassInPackageSignedNETSF.jnlp", + "AccessClassInPackageSignedSUNSEC.jnlp" + }; + private String[] badExceptions = { + "accessClassInPackage.javax.jnlp.ServiceManager", + "accessClassInPackage.AccessClassInPackage", + "accessClassInPackage.net.sourceforge.jnlp", + "accessClassInPackage.sun.security.internal.spec" + }; + private String[] pass = { + "javax.jnlp.ServiceManager", + "AccessClassInPackage", + "net.sourceforge.jnlp.Parser", + "sun.security.internal.spec.TlsKeyMaterialSpec" + }; + private static final List xta = Arrays.asList(new String[]{"-Xtrustall"}); + + private void testShouldFail(ServerAccess.ProcessResult pr, String s) { + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; + Assert.assertTrue("stderr should match `" + c + "`, but didn't ", pr.stderr.matches(c)); + } + + private void testShouldNOTFail(ServerAccess.ProcessResult pr, String s) { + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + s + ".*"; + Assert.assertFalse("stderr should NOT match `" + c + "`, but did ", pr.stderr.matches(c)); + } + + private void commonPitfall(ProcessResult pr) { + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("AccessClassInPackageTestLunch1 should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void testShouldPass(ServerAccess.ProcessResult pr, String s) { + String c = "Class was obtained: " + s; + Assert.assertTrue("stdout should contains `" + c + "`, but didn't ", pr.stdout.contains(c)); + } + + private void testShouldNOTPass(ServerAccess.ProcessResult pr, String s) { + String c = "Class was obtained: " + s; + Assert.assertFalse("stdout should not contains `" + c + "`, but did ", pr.stdout.contains(c)); + } + + @Test + public void AccessClassInPackageJAVAXJNLP() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[0]); + commonPitfall(pr); + testShouldPass(pr, pass[0]); + testShouldNOTFail(pr, badExceptions[0]); + } + + @Test + public void AccessClassInPackageSELF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[1]); + commonPitfall(pr); + testShouldPass(pr, pass[1]); + testShouldNOTFail(pr, badExceptions[1]); + } + + @Test + public void AccessClassInPackageNETSF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[2]); + commonPitfall(pr); + testShouldFail(pr, badExceptions[2]); + testShouldNOTPass(pr, pass[2]); + } + + @Test + public void AccessClassInPackageSUNSEC() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + files[3]); + commonPitfall(pr); + commonPitfall(pr); + testShouldFail(pr, badExceptions[3]); + testShouldNOTPass(pr, pass[3]); + } + + //now signed vaiants + @Test + public void AccessClassInPackageSignedJAVAXJNLP() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[0]); + commonPitfall(pr); + testShouldPass(pr, pass[0]); + testShouldNOTFail(pr, badExceptions[0]); + } + + @Test + public void AccessClassInPackageSignedSELF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[1]); + commonPitfall(pr); + testShouldPass(pr, pass[1]); + testShouldNOTFail(pr, badExceptions[1]); + } + + @Test + public void AccessClassInPackageSignedNETSF() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[2]); + commonPitfall(pr); + testShouldPass(pr, pass[2]); + testShouldNOTFail(pr, badExceptions[2]); + } + + @Test + public void AccessClassInPackageSignedSUNSEC() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(xta, "/" + filesSigned[3]); + commonPitfall(pr); + testShouldPass(pr, pass[3]); + testShouldNOTFail(pr, badExceptions[3]); + } + +} diff --git a/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp b/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp new file mode 100644 index 0000000..42272ff --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/resources/AddShutdownHook.jnlp @@ -0,0 +1,13 @@ + + + + test adding shutdown hooks + IcedTea + + + + + + diff --git a/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java b/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java new file mode 100644 index 0000000..2b731eb --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/srcs/AddShutdownHook.java @@ -0,0 +1,48 @@ +/* AddShutdownHook.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AddShutdownHook { + public static void main(String[] args) { + + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + // no op + } + }); + + } +} diff --git a/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java new file mode 100644 index 0000000..165276a --- /dev/null +++ b/tests/reproducers/simple/AddShutdownHook/testcases/AddShutdownHookTest.java @@ -0,0 +1,58 @@ +/* AddShutdownHookTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class AddShutdownHookTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void AddShutdownHookTestLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AddShutdownHook.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "shutdownHooks" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("AddShutdownHookTestLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp b/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp new file mode 100644 index 0000000..be6b3f3 --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/resources/AllStackTraces.jnlp @@ -0,0 +1,13 @@ + + + + Test Thread.getAllStackTraces + IcedTea + + + + + + diff --git a/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java b/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java new file mode 100644 index 0000000..f871b9c --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/srcs/AllStackTraces.java @@ -0,0 +1,42 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class AllStackTraces { + public static void main(String[] args) { + Thread.getAllStackTraces(); + } +} diff --git a/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java new file mode 100644 index 0000000..0372f4c --- /dev/null +++ b/tests/reproducers/simple/AllStackTraces/testcases/AllStackTracesTest.java @@ -0,0 +1,61 @@ +/* AllStackTracesTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class AllStackTracesTest { + + private static ServerAccess server = new ServerAccess(); + + + + @Test + public void AllStackTracesTest1() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/AllStackTraces.jnlp"); + String c = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getStackTrace" + ".*"; + Assert.assertTrue("stderr should match `"+c+"`, but didn't ",pr.stderr.matches(c)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did ",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("AllStackTracesTest1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html new file mode 100644 index 0000000..9cc0fe1 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html @@ -0,0 +1,48 @@ + + + + + + + + diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp new file mode 100644 index 0000000..4902f25 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp @@ -0,0 +1,58 @@ + + + + + AppletBaseURL + IcedTea + + AppletBaseURL + + + + + + + + + diff --git a/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html new file mode 100644 index 0000000..752a767 --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java b/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java new file mode 100644 index 0000000..8234e3c --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/srcs/AppletBaseURL.java @@ -0,0 +1,64 @@ +/* AppletBaseURL.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.applet.Applet; +public class AppletBaseURL extends Applet { + + private class Killer extends Thread { + + public int n = 1000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Aplet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("Document base is " + getDocumentBase() + " for this applet"); + System.out.println("Codebase is " + getCodeBase() + " for this applet"); + killer = new Killer(); + killer.start(); + } +} diff --git a/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java b/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java new file mode 100644 index 0000000..ec14cfa --- /dev/null +++ b/tests/reproducers/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java @@ -0,0 +1,89 @@ +/* AppletBaseURLTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +import org.junit.Assert; +import org.junit.Test; + +public class AppletBaseURLTest extends BrowserTest{ + + private void evaluateApplet(ProcessResult pr, String baseName) { + String s8 = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*"; + Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8)); + String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*"; + Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9)); + String ss = "xception"; + Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss)); + } + + @NeedsDisplay + @Test + public void AppletWebstartBaseURLTest() throws Exception { + ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp"); + evaluateApplet(pr, ""); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR855") + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html"); + pr.process.destroy(); + evaluateApplet(pr, "AppletBaseURLTest.html"); + Assert.assertTrue(pr.wasTerminated); + } + + @Bug(id="PR855") + @NeedsDisplay + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletWithJNLPHrefTest() throws Exception { + ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html"); + pr.process.destroy(); + evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html"); + Assert.assertTrue(pr.wasTerminated); + } +} diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html new file mode 100644 index 0000000..aed49b8 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html @@ -0,0 +1,42 @@ + + +

+

+ + diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp new file mode 100644 index 0000000..6a2325d --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp @@ -0,0 +1,62 @@ + + + + + AppletReadsInvalidJar + IcedTea + + AppletTest + + + + + + + + + + + + + diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar b/tests/reproducers/simple/AppletReadsInvalidJar/resources/NOT_A_VALID_JAR.jar new file mode 100644 index 0000000..e69de29 diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java b/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java new file mode 100644 index 0000000..9b0bcd6 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/srcs/Valid.java @@ -0,0 +1,58 @@ +import java.applet.Applet; + +/* +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class Valid extends Applet { + + private static class Killer extends Thread { + @Override + public void run() { + try { + int n = 2000; + Thread.sleep(n); + System.exit(0); + } catch (Exception ex) { + } + } + } + + @Override + public void init() { + new Killer().start(); + System.out.println("Program Executed Correctly."); + } +} diff --git a/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java b/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java new file mode 100644 index 0000000..11b0bb0 --- /dev/null +++ b/tests/reproducers/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java @@ -0,0 +1,69 @@ +/* AppletReadsInvalidJarTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletReadsInvalidJarTests extends BrowserTest{ + + + static final String CORRECT_EXECUTION = "Program Executed Correctly."; + static final String JNLP_EXPECTED_EXCEPTION = "ZipException"; + + /*This SHOULD NOT execute the applet!*/ + @Test + public void AppletJNLPTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp"); + + Assert.assertFalse("AppletReadsInvalidJar stdout should NOT contain '" + CORRECT_EXECUTION + "', but did (applet should not have ran!).", pr.stdout.contains(CORRECT_EXECUTION)); + Assert.assertTrue("AppletReadsInvalidJar stderr should contain 'ZipException', but did not.", pr.stderr.contains(JNLP_EXPECTED_EXCEPTION)); + } + + /*This SHOULD execute the applet!*/ + @Test + @TestInBrowsers(testIn={Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html"); + + Assert.assertTrue("AppletReadsInvalidJar stdout should contain '" + CORRECT_EXECUTION + "' but did not.", pr.stdout.contains(CORRECT_EXECUTION)); + } +} diff --git a/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html new file mode 100644 index 0000000..fcd9454 --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.html @@ -0,0 +1,44 @@ + + +

+ + +

+ + diff --git a/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp new file mode 100644 index 0000000..76ea69f --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/resources/appletTakesLastParam.jnlp @@ -0,0 +1,63 @@ + + + + + AppletTakesLastParam + IcedTea + + AppletTakesLastParam + + + + + + + + + + + + + + diff --git a/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java b/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java new file mode 100644 index 0000000..9d2b44d --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/srcs/AppletTakesLastParam.java @@ -0,0 +1,63 @@ + +import java.applet.Applet; + +/* AppletTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class AppletTakesLastParam extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing itself after " + n + " ms"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer = new Killer(); + + @Override + public void init() { + System.out.println(getParameter("param")); + killer.start(); + } +} diff --git a/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java b/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java new file mode 100644 index 0000000..206f6de --- /dev/null +++ b/tests/reproducers/simple/AppletTakesLastParam/testcases/AppletTakesLastParamTests.java @@ -0,0 +1,68 @@ +/* AppletTestTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletTakesLastParamTests extends BrowserTest { + + @Test + public void AppletTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws(null, "/appletTakesLastParam.jnlp"); + evaluateApplet(pr); + } + + private void evaluateApplet(ProcessResult pr) { + String s0 = "value1"; + Assert.assertTrue("AppletTakesLastParam stdout should not contain " + s0 + " but did.", !pr.stdout.contains(s0)); + String s1 = "value2"; + Assert.assertTrue("AppletTakesLastParam stdout should contain " + s1 + " but did not.", pr.stdout.contains(s1)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.one}) + public void AppletInFirefoxTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletTakesLastParam.html"); + evaluateApplet(pr); + } +} diff --git a/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp b/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp new file mode 100644 index 0000000..1b27e8f --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/AppletTest.jnlp @@ -0,0 +1,63 @@ + + + + + AppletTest + IcedTea + + AppletTest + + + + + + + + + + + + + + diff --git a/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html b/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html new file mode 100644 index 0000000..a2613d9 --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletAutoTests.html @@ -0,0 +1,44 @@ + + +

+ + +

+ + diff --git a/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html b/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html new file mode 100644 index 0000000..a5c370c --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletAutoTests2.html @@ -0,0 +1,44 @@ + + +

+ + +

+ + diff --git a/tests/reproducers/simple/AppletTest/resources/appletViewTest.html b/tests/reproducers/simple/AppletTest/resources/appletViewTest.html new file mode 100644 index 0000000..0b489c8 --- /dev/null +++ b/tests/reproducers/simple/AppletTest/resources/appletViewTest.html @@ -0,0 +1,52 @@ + + +ok applet + +

ok applet

+

+ +

+

ok applet

+

bad applet

+

+ +

+

bad applet

+ + diff --git a/tests/reproducers/simple/AppletTest/srcs/AppletTest.java b/tests/reproducers/simple/AppletTest/srcs/AppletTest.java new file mode 100644 index 0000000..bac629a --- /dev/null +++ b/tests/reproducers/simple/AppletTest/srcs/AppletTest.java @@ -0,0 +1,82 @@ + +import java.applet.Applet; + +/* AppletTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class AppletTest extends Applet { + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Aplet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + System.out.println("applet was initialised"); + killer = new Killer(); + } + + @Override + public void start() { + System.out.println("applet was started"); + System.out.println(getParameter("key1")); + System.out.println(getParameter("key2")); + killer.start(); + System.out.println("killer was started"); + } + + @Override + public void stop() { + System.out.println("applet was stopped"); + } + + @Override + public void destroy() { + System.out.println("applet will be destroyed"); + } +} diff --git a/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java b/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java new file mode 100644 index 0000000..9fd662d --- /dev/null +++ b/tests/reproducers/simple/AppletTest/testcases/AppletTestTests.java @@ -0,0 +1,141 @@ +/* AppletTestTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class AppletTestTests extends BrowserTest { + + @Test + @TestInBrowsers(testIn = {Browsers.googleChrome}) + @NeedsDisplay + public void doubleChrome() throws Exception { + server.PROCESS_TIMEOUT = 30 * 1000; + try { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recording browser + ServerAccess.ProcessResult pr1 = server.executeBrowser("/appletAutoTests.html"); + if (pr1.process == null) { + Assert.assertTrue("If proces was null here, then google-chrome had to not exist, and so " + + ServerAccess.UNSET_BROWSER + + " should be in exception, but exception was " + + pr1.deadlyException.getMessage(), + pr1.deadlyException.getMessage().contains(ServerAccess.UNSET_BROWSER)); + return; + } + evaluateApplet(pr1); + Assert.assertTrue(pr1.wasTerminated); + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + // just verify loging is recording browser + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + } finally { + server.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } + + @Test + @NeedsDisplay + public void AppletTest() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/AppletTest.jnlp"); + evaluateApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + private void evaluateApplet(ProcessResult pr) { + String s3 = "applet was initialised"; + Assert.assertTrue("AppletTest stdout should contains " + s3 + " bud didn't", pr.stdout.contains(s3)); + String s0 = "applet was started"; + Assert.assertTrue("AppletTest stdout should contains " + s0 + " bud didn't", pr.stdout.contains(s0)); + String s1 = "value1"; + Assert.assertTrue("AppletTest stdout should contains " + s1 + " bud didn't", pr.stdout.contains(s1)); + String s2 = "value2"; + Assert.assertTrue("AppletTest stdout should contains " + s2 + " bud didn't", pr.stdout.contains(s2)); + String s4 = "applet was stopped"; + Assert.assertFalse("AppletTest stdout shouldn't contains " + s4 + " bud did", pr.stdout.contains(s4)); + String s5 = "applet will be destroyed"; + Assert.assertFalse("AppletTest stdout shouldn't contains " + s5 + " bud did", pr.stdout.contains(s5)); + String ss = "xception"; + Assert.assertFalse("AppletTest stderr should not contains " + ss + " but did", pr.stderr.contains(ss)); + String s7 = "Aplet killing himself after 2000 ms of life"; + Assert.assertTrue("AppletTest stdout should contains " + s7 + " bud didn't", pr.stdout.contains(s7)); + } + + @Test + @TestInBrowsers(testIn = {Browsers.all}) + @NeedsDisplay + public void AppletInBrowserTest() throws Exception { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recordingb rowser + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests2.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null + } finally { + ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } + + @TestInBrowsers(testIn = {Browsers.all}) + @NeedsDisplay + public void AppletInBrowserTestXslowX() throws Exception { + //System.out.println("connecting AppletInFirefoxTest request in " + getBrowser().toString()); + //just verify loging is recording browser + ServerAccess.PROCESS_TIMEOUT = 30 * 1000; + try { + ServerAccess.ProcessResult pr = server.executeBrowser("/appletAutoTests.html"); + pr.process.destroy(); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + //Assert.assertEquals((Integer) 0, pr.returnValue); due to destroy is null + } finally { + ServerAccess.PROCESS_TIMEOUT = 20 * 1000; //back to normal + } + } +} diff --git a/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html b/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html new file mode 100644 index 0000000..0cdb0b7 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/resources/CheckPluginServices.html @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp b/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp new file mode 100644 index 0000000..22419b5 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/resources/CheckServices.jnlp @@ -0,0 +1,57 @@ + + + + + CheckServices + IcedTea + + CheckServices + + + + + + + + diff --git a/tests/reproducers/simple/CheckServices/srcs/CheckServices.java b/tests/reproducers/simple/CheckServices/srcs/CheckServices.java new file mode 100644 index 0000000..df5205a --- /dev/null +++ b/tests/reproducers/simple/CheckServices/srcs/CheckServices.java @@ -0,0 +1,109 @@ +/* CheckServices.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import javax.jnlp.ServiceManager; +import javax.jnlp.BasicService; +import java.applet.Applet; + +public class CheckServices extends Applet { + + public CheckServices() { + System.out.println("Applet constructor reached."); + checkSetup("constructor"); + } + + public void checkSetup(String method) { + try { + BasicService basicService = + (BasicService)ServiceManager.lookup("javax.jnlp.BasicService"); + // getCodeBase() will return null if ServiceManager does not + // have access to ApplicationInstance. + String codebase = basicService.getCodeBase().toString(); + System.out.println("Codebase for applet was found in " + method + + ": " + codebase); + } catch (NullPointerException npe) { + System.err.println("Exception occurred with null codebase in " + method); + npe.printStackTrace(); + } catch (Exception ex) { + System.err.println("Exception occurred (probably with ServiceManager)."); + ex.printStackTrace(); + } + } + + @Override + public void init() { + System.out.println("Applet is initializing."); + checkSetup("init()"); + } + + @Override + public void start() { + System.out.println("Applet is starting."); + checkSetup("start()"); + // FIXME: Instead of killing the thread, use the AWT robot to close + // the applet window, signaling the event that runs stop/destroy. + System.out.println("Killer thread is starting."); + Thread killer = new Thread() { + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing itself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + }; + killer.start(); + } + + /* FIXME: Check ServiceManagaer is setup once stop/destroy can be called. + @Override + public void stop() { + System.out.println("Applet is stopping."); + checkSetup("stop()"); + } + + @Override + public void destroy() { + System.out.println("Applet is destorying itself."); + checkSetup("destroy()"); + } + */ +} diff --git a/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java b/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java new file mode 100644 index 0000000..a36e394 --- /dev/null +++ b/tests/reproducers/simple/CheckServices/testcases/CheckServicesTests.java @@ -0,0 +1,88 @@ +/* CheckServicesTests.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +import org.junit.Assert; +import org.junit.Test; + +@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017153.html") +public class CheckServicesTests extends BrowserTest{ + + public void evaluateApplet(ProcessResult pr) { + String s0 = "Codebase for applet was found in constructor"; + Assert.assertTrue("CheckServices stdout should contain `" + s0 + "' but didn't.", pr.stdout.contains(s0)); + String s1 = "Codebase for applet was found in init()"; + Assert.assertTrue("CheckServices stdout should contain `" + s1 + "' but didn't.", pr.stdout.contains(s1)); + String s2 = "Codebase for applet was found in start()"; + Assert.assertTrue("CheckServices stdout should contain `" + s2 + "' but didn't.", pr.stdout.contains(s2)); + /* FIXME: Once the awt robot can close the applet window (i.e. send + * a stop event), stdout should be checked for these asserts. + String s3 = "Codebase for applet was found in stop()"; + Assert.assertTrue("CheckServices stdout should contain `" + s3 + "' but didn't.", pr.stdout.contains(s3)); + String s4 = "Codebase for applet was found in destroy()"; + Assert.assertTrue("CheckServices stdout should contain `" + s4 + "' but didn't.", pr.stdout.contains(s4)); + */ + String s5 = "Exception occurred with null codebase in"; + Assert.assertFalse("CheckServices stderr should not contain `" + s5 + "' but did.", pr.stdout.contains(s5)); + String s6 = "Applet killing itself after 2000 ms of life"; + Assert.assertTrue("CheckServices stdout should contain `" + s6 + "' but didn't.", pr.stdout.contains(s6)); + } + + @Test + @NeedsDisplay + public void CheckWebstartServices() throws Exception { + ProcessResult pr = server.executeJavaws(null, "/CheckServices.jnlp"); + evaluateApplet(pr); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn={Browsers.one}) + public void CheckPluginJNLPHServices() throws Exception { + ProcessResult pr = server.executeBrowser(null, "/CheckPluginServices.html"); + evaluateApplet(pr); + Assert.assertTrue(pr.wasTerminated); + } +} diff --git a/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp b/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp new file mode 100644 index 0000000..6804bcd --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/resources/CreateClassLoader.jnlp @@ -0,0 +1,13 @@ + + + + set context classloader + IcedTea + + + + + + diff --git a/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java b/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java new file mode 100644 index 0000000..e33299e --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/srcs/CreateClassLoader.java @@ -0,0 +1,46 @@ +/* CreateClassLoader.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.net.URL; +import java.net.URLClassLoader; + +public class CreateClassLoader { + public static void main(String[] args) throws Exception { + URLClassLoader ucl = new URLClassLoader(new URL[0]); + + } +} diff --git a/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java new file mode 100644 index 0000000..46b7300 --- /dev/null +++ b/tests/reproducers/simple/CreateClassLoader/testcases/CreateClassLoaderTest.java @@ -0,0 +1,58 @@ +/* CreateClassLoaderTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class CreateClassLoaderTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void CreateClassLoaderLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/CreateClassLoader.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "createClassLoader" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("CreateClassLoaderLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp new file mode 100644 index 0000000..aabd685 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/InformationParser.jnlp @@ -0,0 +1,47 @@ + + + + + + + + + + + diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp new file mode 100644 index 0000000..fad50cc --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleParser.jnlp @@ -0,0 +1,52 @@ + + + + + IcedTea + + Title tag missing + + + + + + + + + diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp new file mode 100644 index 0000000..f3159b9 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/TitleVendorParser.jnlp @@ -0,0 +1,51 @@ + + + + + + Title/Vendor tags missing + + + + + + + + + diff --git a/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp b/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp new file mode 100644 index 0000000..5a76e1e --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/resources/VendorParser.jnlp @@ -0,0 +1,52 @@ + + + + + VendorParser + + Vendor tag missing + + + + + + + + + diff --git a/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java b/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java new file mode 100644 index 0000000..b760441 --- /dev/null +++ b/tests/reproducers/simple/InformationTitleVendorParser/testcases/InformationTitleVendorParserTest.java @@ -0,0 +1,77 @@ +/* InformationTitleVendorParserTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class InformationTitleVendorParserTest { + + private static ServerAccess server = new ServerAccess(); + + public void runTest(String jnlpName, String exceptionMessage) throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/" + jnlpName + ".jnlp"); + String s1 = "Good simple javaws exapmle"; + Assert.assertFalse("test" + jnlpName + " stdout should not contain " + s1 + " but did.", pr.stdout.contains(s1)); + // Looking for "Could not read or parse the JNLP file. (${DESCRIPTION})" + String s2 = "(?s).*Could not read or parse the JNLP file.{0,5}" + exceptionMessage + "(?s).*"; + Assert.assertTrue("testForTitle stderr should match " + s2 + " but did not.", pr.stderr.matches(s2)); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void testInformationeParser() throws Exception { + runTest("InformationParser", "No information section defined"); + } + + @Test + public void testTitleParser() throws Exception { + runTest("TitleParser", "The title section has not been defined in the JNLP file."); + } + @Test + public void testVendorParser() throws Exception { + runTest("VendorParser", "The vendor section has not been defined in the JNLP file."); + } + + @Test + public void testTitleVendorParser() throws Exception { + // Note that the title message missing causes an immediate exception, regardless of Vendor. + runTest("TitleVendorParser", "The title section has not been defined in the JNLP file."); + } +} diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp new file mode 100644 index 0000000..32e4fbb --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainAppDesc.jnlp @@ -0,0 +1,53 @@ + + + + + Test Thread.getAllStackTraces + IcedTea + + testing jar with manin class in manifest. Invalid xml exception should go out + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp new file mode 100644 index 0000000..0e91484 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2mainNoAppDesc.jnlp @@ -0,0 +1,54 @@ + + + + + + ManifestedJar-1main2mainNoAppDesc.jnlp + IcedTea + + testing jar with manin class in manifest, hello from manifestedjar1 should go out + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp new file mode 100644 index 0000000..ee8a3bf --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1main2nothingNoAppDesc.jnlp @@ -0,0 +1,54 @@ + + + + + + ManifestedJar-1main2nothingNoAppDesc + IcedTea + + testing jar with manin class in manifest, hello from manifestedjar2 should be printed + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp new file mode 100644 index 0000000..5faf1e0 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainHaveAppDesc.jnlp @@ -0,0 +1,54 @@ + + + + + "ManifestedJar-1mainHaveAppDesc.jnlp + IcedTea + + testing jar with manin class in manifest, hello from manifestedjar2 should be printed + + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp new file mode 100644 index 0000000..1aaed4a --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1mainNoAppDesc.jnlp @@ -0,0 +1,53 @@ + + + + + + ManifestedJar-1mainNoAppDesc.jnlp + IcedTea + + testing jar with manin class in manifest, hello from manifestedjar should be printed + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp new file mode 100644 index 0000000..4a6c7a9 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDesc.jnlp @@ -0,0 +1,52 @@ + + + + + ManifestedJar-1noAppDesc + IcedTea + + testing jar with manin class in manifest, hello from manifestedjar1 shold be printed + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp new file mode 100644 index 0000000..54ed21a --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1noAppDescAtAll.jnlp @@ -0,0 +1,49 @@ + + + + + ManifestedJar-1noAppDescAtAll + IcedTea + + testing jar with manin class in manifest, exception during launching, no application specified + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp new file mode 100644 index 0000000..2d60dcd --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingAppDesc.jnlp @@ -0,0 +1,54 @@ + + + + + + ManifestedJar-1nothing2nothingAppDesc + IcedTea + + testing jar with manin class in manifest. Hello from manifestedjar2 should be printed + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp new file mode 100644 index 0000000..476d34b --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/resources/ManifestedJar-1nothing2nothingNoAppDesc.jnlp @@ -0,0 +1,54 @@ + + + + + + ManifestedJar-1nothing2nothingNoAppDesc + IcedTea + + testing jar with manin class in manifest. Hello from manifestedjar1 should be printed + + + + + + + diff --git a/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF b/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF new file mode 100644 index 0000000..badcd09 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/srcs/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: ManifestedJar1 + diff --git a/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java b/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java new file mode 100644 index 0000000..a7cfb9b --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/srcs/ManifestedJar1.java @@ -0,0 +1,45 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ManifestedJar1 { + public static void main(String[] args) { + hello1(); + } + public static void hello1() { + System.out.println("Hello from ManifestedJar1"); + } +} diff --git a/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java b/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java new file mode 100644 index 0000000..47baa6f --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar1/testcases/ManifestedJar1Test.java @@ -0,0 +1,217 @@ +/* ManifestedJar1Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import org.junit.Assert; + +import org.junit.Test; + +@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017435.html") +public class ManifestedJar1Test { + + private static ServerAccess server = new ServerAccess(); + private static final String nonLunchableMessage = "net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Not a launchable JNLP file. File must be a JNLP application, applet, or installer type."; + //actually this on eis never printed as stderr will not recieve this message in headless mode :( + private static final String twoMainException = "net.sourceforge.jnlp.ParseException: Invalid XML document syntax"; + + private void assertManifestedJar1(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar1"; + Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); + } + + private void assertManifestedJar2(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar2"; + Assert.assertTrue(id + " stdout should contains `" + s + "`, but didn't ", q.stdout.contains(s)); + } + + private void assertNotManifestedJar1(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar1"; + Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); + } + private void assertAppError(String id, ServerAccess.ProcessResult q) { + Assert.assertTrue(id + " stderr should contains `" + nonLunchableMessage + "`, but didnn't ", q.stderr.contains(nonLunchableMessage)); + } + + private void assertNotManifestedJar2(String id, ServerAccess.ProcessResult q) { + String s = "Hello from ManifestedJar2"; + Assert.assertFalse(id + " stdout should NOT contains `" + s + "`, but didn ", q.stdout.contains(s)); + } + + private void assertNotDead(String id, ServerAccess.ProcessResult pr) { + String cc = "ClassNotFoundException"; + Assert.assertFalse(id + " stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse(id + " should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Test + /** + * if two jars with manifest specified, none is main and no main class, then first one is loaded + */ + public void manifestedJar1nothing2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1nothing2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, is not main, and no main class then is lunched + * + */ + @Test + public void manifestedJar1noAppDesc() throws Exception { + String id = "ManifestedJar-1noAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, but not marked as main and no main class then is lunched + * + */ + @Test + public void manifestedJar1mainNoAppDesc() throws Exception { + String id = "ManifestedJar-1mainNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + *if one jar with manifest, marked as main and no main class then is lunched + * + */ + @Test + public void ManifestedJar1mainHaveAppDesc() throws Exception { + String id = "ManifestedJar-1mainHaveAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, First is main, but specified mainclass belongs to second one, then second one should be lunched + */ + @Test + public void ManifestedJar1main2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, seconds is main, no mainclass, then the one marked as main is lunched + */ + @Test + public void manifestedJar1main2nothingNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2nothingNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, no app desc + * + * thisis passing, SUSPICIOUS, but to lunch at least something is better then to lunch nothing at all. + * althoug it maybe SHOULD throw twoMainException + */ + @Test + public void manifestedJar1main2mainNoAppDesc() throws Exception { + String id = "ManifestedJar-1main2mainNoAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertManifestedJar1(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, have app desc + * + * corectly failing with twoMainException + */ + @Test + public void manifestedJar1main2mainAppDesc() throws Exception { + String id = "ManifestedJar-1main2mainAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar1(id, pr); + assertNotManifestedJar2(id, pr); + assertNotDead(id, pr); + } + + /** + * + * Two jars, both with manifest, sboth with main tag, have app desc + * + * corectly failing + */ + @Test + public void manifestedJar1noAppDescAtAll() throws Exception { + String id = "ManifestedJar-1noAppDescAtAll"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar1(id, pr); + assertNotManifestedJar2(id, pr); + assertAppError(id, pr); + assertNotDead(id, pr); + } + + + + /** + * + * Two jars, both with manifest, non with main tag, have app desc + * + * this jnlp is NOT lunched, twoMainException thrown - ok + * + */ + @Test + public void manifestedJar1nothing2nothingAppDesc() throws Exception { + String id = "ManifestedJar-1nothing2nothingAppDesc"; + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/" + id + ".jnlp"); + assertNotManifestedJar2(id, pr); + assertNotManifestedJar1(id, pr); + assertNotDead(id, pr); + } + +} diff --git a/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF b/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d11e8a5 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar2/srcs/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: ManifestedJar2 + diff --git a/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java b/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java new file mode 100644 index 0000000..3682209 --- /dev/null +++ b/tests/reproducers/simple/ManifestedJar2/srcs/ManifestedJar2.java @@ -0,0 +1,45 @@ +/* AllStackTraces.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ManifestedJar2 { + public static void main(String[] args) { + hello2(); + } + public static void hello2() { + System.out.println("Hello from ManifestedJar2"); + } +} diff --git a/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp b/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp new file mode 100644 index 0000000..dd3bce4 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/resources/ReadEnvironment.jnlp @@ -0,0 +1,13 @@ + + + + ReadEnvironment using System.getenv() + IcedTea + + + + + + diff --git a/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java b/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java new file mode 100644 index 0000000..a426803 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/srcs/ReadEnvironment.java @@ -0,0 +1,44 @@ +/* ReadEnvironment.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class ReadEnvironment { + public static void main(String[] args) { + + System.getenv("USER"); + + } +} diff --git a/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java new file mode 100644 index 0000000..5d82da4 --- /dev/null +++ b/tests/reproducers/simple/ReadEnvironment/testcases/ReadEnvironmentTest.java @@ -0,0 +1,58 @@ +/* ReadEnvironmentTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class ReadEnvironmentTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void ReadEnvironmentLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReadEnvironment.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "getenv.USER" + ".*"; + Assert.assertTrue("stderr should match"+s+"but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadEnvironmentLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp b/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp new file mode 100644 index 0000000..54873c2 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/resources/ReadProperties1.jnlp @@ -0,0 +1,17 @@ + + + + read properties using System.getenv() + IcedTea + + + + + + user.name + + + + diff --git a/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp b/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp new file mode 100644 index 0000000..f4e5418 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/resources/ReadProperties2.jnlp @@ -0,0 +1,15 @@ + + + + read properties using System.getenv() + IcedTea + + + + + + user.home + + diff --git a/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java b/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java new file mode 100644 index 0000000..f031369 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/srcs/ReadProperties.java @@ -0,0 +1,45 @@ +/* ReadProperties.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class ReadProperties { + +/** +*some system property is expected as arg[0], eg user.name or user.home +*/ + public static void main(String[] args) { + System.out.println(System.getProperty(args[0])); + } +} diff --git a/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java new file mode 100644 index 0000000..dfe9590 --- /dev/null +++ b/tests/reproducers/simple/ReadProperties/testcases/ReadPropertiesTest.java @@ -0,0 +1,71 @@ +/* ReadPropertiesTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReadPropertiesTest { + + private static ServerAccess server = new ServerAccess(); + + + @Test + public void ReadPropertiesLunch1() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties1.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.name.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadPropertiesLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + @Test + public void ReadPropertiesLunch2() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/ReadProperties2.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.util.PropertyPermission.{0,5}" + "user.home.{0,5}read" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReadPropertiesLunch2 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + } diff --git a/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp b/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp new file mode 100644 index 0000000..ca26613 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/resources/RedirectStreams.jnlp @@ -0,0 +1,13 @@ + + + + redirect stdin/stdout streams + IcedTea + + + + + + diff --git a/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java b/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java new file mode 100644 index 0000000..2130168 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/srcs/RedirectStreams.java @@ -0,0 +1,44 @@ +/* RedirectStreams.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.io.StringBufferInputStream; + +public class RedirectStreams { + public static void main(String[] args) { + System.setIn(new StringBufferInputStream("TEST")); + } +} diff --git a/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java new file mode 100644 index 0000000..1d745c7 --- /dev/null +++ b/tests/reproducers/simple/RedirectStreams/testcases/RedirectStreamsTest.java @@ -0,0 +1,57 @@ +/* RedirectStreamsTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class RedirectStreamsTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void RedirectStreamsTest1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/RedirectStreams.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setIO" + ".*"; + Assert.assertTrue("Stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("RedirectStreams should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp b/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp new file mode 100644 index 0000000..4f153bf --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/resources/ReplaceSecurityManager.jnlp @@ -0,0 +1,13 @@ + + + + Test replacing security manager + IcedTea + + + + + + diff --git a/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java b/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java new file mode 100644 index 0000000..e00cd5a --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/srcs/ReplaceSecurityManager.java @@ -0,0 +1,43 @@ +/* ReplaceSecurityManager.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +public class ReplaceSecurityManager { + public static void main(String[] args) throws Exception{ + + System.setSecurityManager(null); + + } +} diff --git a/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java new file mode 100644 index 0000000..73bbd9d --- /dev/null +++ b/tests/reproducers/simple/ReplaceSecurityManager/testcases/ReplaceSecurityManagerTest.java @@ -0,0 +1,57 @@ +/* ReplaceSecurityManagerTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class ReplaceSecurityManagerTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void ReplaceSecurityManagerLunch1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/ReplaceSecurityManager.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setSecurityManager" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("ReplaceSecurityManagerLunch1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp b/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp new file mode 100644 index 0000000..996bb88 --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/resources/SetContextClassLoader.jnlp @@ -0,0 +1,13 @@ + + + + set context classloader + IcedTea + + + + + + diff --git a/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java b/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java new file mode 100644 index 0000000..5c5b215 --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/srcs/SetContextClassLoader.java @@ -0,0 +1,44 @@ +/* SetContextClassLoader.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SetContextClassLoader { + public static void main(String[] args) throws Exception{ + + Thread.currentThread().setContextClassLoader(null); + + } +} diff --git a/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java new file mode 100644 index 0000000..f45aedb --- /dev/null +++ b/tests/reproducers/simple/SetContextClassLoader/testcases/SetContextClassLoaderTest.java @@ -0,0 +1,57 @@ +/* SetContextClassLoaderTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class SetContextClassLoaderTest { + + private static ServerAccess server = new ServerAccess(); + + @Test + public void SetContextClassLoader1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SetContextClassLoader.jnlp"); + String s = "(?s).*java.security.AccessControlException.{0,5}access denied.{0,5}java.lang.RuntimePermission.{0,5}" + "setContextClassLoader" + ".*"; + Assert.assertTrue("stderr should match "+s+" but didn't",pr.stderr.matches(s)); + String cc="ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `"+cc+"`, but did",pr.stderr.contains(cc)); + Assert.assertFalse("stdout length should be <=2, but was "+pr.stdout.length(),pr.stdout.length()>2); + Assert.assertFalse("SetContextClassLoader1 should not be terminated, but was",pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git "a/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" "b/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" new file mode 100644 index 0000000..9856676 --- /dev/null +++ "b/tests/reproducers/simple/Spaces can be everywhere/resources/NotOnly spaces can kill \304\233\305\241\304\215\305\231\305\276 too.jnlp" @@ -0,0 +1,61 @@ + + + + + Spaces can be everywhere test with few more chars for encoding + IcedTea + + AppletTest + + + + + + + + + + + + diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp new file mode 100644 index 0000000..245b01d --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere1.jnlp @@ -0,0 +1,53 @@ + + + + + Spaces can be everywhere1 + IcedTea + + Spaces can be everywhere1 + + + + + + + + + diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp new file mode 100644 index 0000000..274add7 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/Spaces can be everywhere2.jnlp @@ -0,0 +1,53 @@ + + + + + Spaces can be everywhere2 + IcedTea + + Spaces can be everywhere2 + + + + + + + + + diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp b/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp new file mode 100644 index 0000000..22b77b0 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/SpacesCanBeEverywhere1.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html b/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html new file mode 100644 index 0000000..74b7554 --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/resources/spaces applet Tests.html @@ -0,0 +1,42 @@ + + +

+

+ + diff --git a/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java b/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java new file mode 100644 index 0000000..e65544b --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/srcs/SpacesCanBeEverywhere.java @@ -0,0 +1,76 @@ + +import java.applet.Applet; + +/* SpacesCanBeEverywhere.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SpacesCanBeEverywhere extends Applet{ + + public static void main(String[] args){ + System.out.println("Spaces can be everywhere.jsr was launched correctly"); + } + + private class Killer extends Thread { + + public int n = 2000; + + @Override + public void run() { + try { + Thread.sleep(n); + System.out.println("Applet killing himself after " + n + " ms of life"); + System.exit(0); + } catch (Exception ex) { + } + } + } + private Killer killer; + + @Override + public void init() { + killer = new Killer(); + } + + @Override + public void start() { + main(null); + killer.start(); + System.out.println("killer was started"); + } + + +} diff --git a/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java b/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java new file mode 100644 index 0000000..cb2a98f --- /dev/null +++ b/tests/reproducers/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java @@ -0,0 +1,244 @@ +/* SpacesCanBeEverywhereTests.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.ArrayList; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.annotations.Bug; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; +import org.junit.Test; + +@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"}) +public class SpacesCanBeEverywhereTests extends BrowserTest { + + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereLocalAppletTestsJnlp2() throws Exception { + List commands=new ArrayList(1); + commands.add(server.getJavawsLocation()); + commands.add(server.getDir()+"/NotOnly spaces can kill ěščřž too.jnlp"); + /* Change of dir is cousing the Exception bellow + * ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + * No X11 DISPLAY variable was set, but this program performed an operation which requires it. + * at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173) + * at java.awt.Window.(Window.java:476) + * at java.awt.Frame.(Frame.java:419) + * at java.awt.Frame.(Frame.java:384) + * at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1754) + * at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1831) + * at javax.swing.JWindow.(JWindow.java:185) + * at javax.swing.JWindow.(JWindow.java:137) + * at net.sourceforge.jnlp.runtime.JNLPSecurityManager.(JNLPSecurityManager.java:121) + * at net.sourceforge.jnlp.runtime.JNLPRuntime.initialize(JNLPRuntime.java:202) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:177) + * at net.sourceforge.jnlp.runtime.Boot.run(Boot.java:51) + * at java.security.AccessController.doPrivileged(Native Method) + * at net.sourceforge.jnlp.runtime.Boot.main(Boot.java:168) + * + * Thats why there is absolute path to the file. + * + * This is also why SpacesCanBeEverywhereLocalTests1Signed is passing - + * it is in headless mode. This can be considered as bug, but because it is + * only on ocal files, and probably only from test run - it can be ignored + */ + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + public void SpacesCanBeEverywhereRemoteAppletTestsJnlp2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavaws("/NotOnly%20spaces%20can%20kill%20%C4%9B%C5%A1%C4%8D%C5%99%C5%BE%20too.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should NOT be terminated, but was not", pr.wasTerminated); + } + + @Bug(id="PR811") + @Test + @NeedsDisplay + @TestInBrowsers(testIn = {Browsers.all}) + public void SpacesCanBeEverywhereRemoteAppletTestsHtml2() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/spaces+applet+Tests.html"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "xception"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertTrue("should be terminated, but was not", pr.wasTerminated); + } + + + @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"}) + @Test + public void SpacesCanBeEverywhereRemoteTests1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere1.jnlp"); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2_withQuery1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test=10"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests2_withQuery2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/Spaces%20can%20be%20everywhere2.jnlp?test%3D10"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR811") + @Test + public void SpacesCanBeEverywhereRemoteTests3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, "/SpacesCanBeEverywhere1.jnlp"); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests1() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere1.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s = "Good simple javaws exapmle"; + Assert.assertTrue("stdout should contains `" + s + "`, but did not", pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests2() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("Spaces can be everywhere2.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests4() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add(server.getDir()+"/Spaces can be everywhere2.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } + + @Bug(id="PR804") + @Test + public void SpacesCanBeEverywhereLocalTests3() throws Exception { + List commands=new ArrayList(4); + commands.add(server.getJavawsLocation()); + commands.add(ServerAccess.HEADLES_OPTION); + commands.add("SpacesCanBeEverywhere1.jnlp"); + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(commands,server.getDir()); + String s="Spaces can be everywhere.jsr was launched correctly"; + Assert.assertTrue("stdout should contains `"+s+"`, but did not",pr.stdout.contains(s)); + String cc = "ClassNotFoundException"; + Assert.assertFalse("stderr should NOT contains `" + cc + "`, but did", pr.stderr.contains(cc)); + Assert.assertFalse("should not be terminated, but was", pr.wasTerminated); + Assert.assertEquals((Integer) 0, pr.returnValue); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp new file mode 100644 index 0000000..979058d --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication1.jnlp @@ -0,0 +1,54 @@ + + + + + UnsignedJnlpApplication + IcedTea + + UnsignedJnlpApplication + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp new file mode 100644 index 0000000..84f7539 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication2.jnlp @@ -0,0 +1,56 @@ + + + + + UnsignedJnlpApplication + IcedTea + + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp new file mode 100644 index 0000000..d5e6584 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/resources/UnsignedJnlpApplication3.jnlp @@ -0,0 +1,57 @@ + + + + + DIFFERENTJnlpApplicationNAME + IcedTea + + UnsignedJnlpApplication + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp new file mode 100644 index 0000000..e4a3722 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/JNLP-INF/APPLICATION.jnlp @@ -0,0 +1,62 @@ + + + + + UnsignedJnlpApplication + IcedTea + + UnsignedJnlpApplication + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java new file mode 100644 index 0000000..f4afa4f --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/srcs/UnsignedJnlpApplication.java @@ -0,0 +1,43 @@ +/* UnsignedJnlpApplication.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class UnsignedJnlpApplication { + + public static void main(String[] args) { + System.out.println("Running unsigned application in main"); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java b/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java new file mode 100644 index 0000000..e48509d --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpApplication/testcases/UnsignedJnlpApplicationTest.java @@ -0,0 +1,68 @@ +/* UnsignedJnlpApplicationTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class UnsignedJnlpApplicationTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String outputString = "Running unsigned application in main"; + + @Test + public void jnlpFileIsUnchecked1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication1.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpFileIsUnchecked2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication2.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpFileIsUnchecked3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpApplication3.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp new file mode 100644 index 0000000..077c5dc --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate1.jnlp @@ -0,0 +1,54 @@ + + + + + UnsignedJnlpTemplate + IcedTea + + UnsignedJnlpTemplate + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp new file mode 100644 index 0000000..f665a93 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate2.jnlp @@ -0,0 +1,56 @@ + + + + + UnsignedJnlpTemplate + IcedTea + + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp new file mode 100644 index 0000000..abbd085 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/resources/UnsignedJnlpTemplate3.jnlp @@ -0,0 +1,57 @@ + + + + + DIFFERENTJnlpTemplateNAME + IcedTea + + UnsignedJnlpTemplate + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp new file mode 100644 index 0000000..5a9dce0 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/JNLP-INF/APPLICATION_TEMPLATE.jnlp @@ -0,0 +1,62 @@ + + + + + UnsignedJnlpTemplate + IcedTea + + UnsignedJnlpTemplate + + + + + + + + + + + + + + + + + + diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java new file mode 100644 index 0000000..3883c22 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/srcs/UnsignedJnlpTemplate.java @@ -0,0 +1,43 @@ +/* UnsignedJnlpTemplate.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class UnsignedJnlpTemplate { + + public static void main(String[] args) { + System.out.println("Running unsigned application in main"); + } +} diff --git a/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java b/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java new file mode 100644 index 0000000..b2aec62 --- /dev/null +++ b/tests/reproducers/simple/UnsignedJnlpTemplate/testcases/UnsignedJnlpTemplateTest.java @@ -0,0 +1,68 @@ +/* UnsignedJnlpTemplateTest.java +Copyright (C) 2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; +import org.junit.Test; + +public class UnsignedJnlpTemplateTest { + + private static ServerAccess server = new ServerAccess(); + private final List l = Collections.unmodifiableList(Arrays.asList(new String[] { "-Xtrustall" })); + private final String outputString = "Running unsigned application in main"; + + @Test + public void jnlpTemplateIsUnchecked1() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate1.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpTemplateIsUnchecked2() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate2.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } + + @Test + public void jnlpTemplateIsUnchecked3() throws Exception { + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(l, "/UnsignedJnlpTemplate3.jnlp"); + Assert.assertTrue("Stdout should contains " + outputString + " but did not", pr.stdout.contains(outputString)); + } +} \ No newline at end of file diff --git a/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp b/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp new file mode 100644 index 0000000..f45c475 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/resources/deadlocktest.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp b/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp new file mode 100644 index 0000000..bf7e82c --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/resources/deadlocktest_1.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java b/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java new file mode 100644 index 0000000..4d348b0 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/srcs/DeadlockTest.java @@ -0,0 +1,58 @@ +/* DeadlockTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class DeadlockTest { + + private static final int DEADLOCK_TEST_TIME_OF_LIFE=30000; + + public static void main(String[] args) throws Exception { + long startTime = System.nanoTime() / 1000000l; + System.out.println("Deadlock test started"); + int i=0; + while (true) { + long now = System.nanoTime() / 1000000l; + Thread.sleep(3500); + i++; + System.out.println(i+" Deadlock sleeping"); + if (now - startTime > DEADLOCK_TEST_TIME_OF_LIFE) { + System.out.println("This process is hanging more then "+DEADLOCK_TEST_TIME_OF_LIFE/1000+"s. Should be killed"); + System.out.flush(); + System.exit(5); + } + } + } +} diff --git a/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java b/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java new file mode 100644 index 0000000..b2e0a48 --- /dev/null +++ b/tests/reproducers/simple/deadlocktest/testcases/DeadLockTestTest.java @@ -0,0 +1,267 @@ +/* DeadLockTestTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import java.util.ArrayList; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.ServerAccess.ProcessResult; +import org.junit.Assert; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.junit.BeforeClass; + +import org.junit.Test; + +public class DeadLockTestTest { + + private static ServerAccess server = new ServerAccess(); + private static String deadlocktest_1 = "/deadlocktest_1.jnlp"; + private static String deadlocktest = "/deadlocktest.jnlp"; + + @BeforeClass + public static void printJavas() throws Exception { + ServerAccess.logOutputReprint("Currently runnng javas1 " + countJavaInstances()); + + } + + @Test + public void testDeadLockTestTerminated() throws Exception { + testDeadLockTestTerminatedBody(deadlocktest); + testDeadLockTestTerminatedBody(deadlocktest); + ServerAccess.logOutputReprint("Currently running javas12 " + countJavaInstances()); + } + + @Test + public void testDeadLockTestTerminated2() throws Exception { + testDeadLockTestTerminatedBody(deadlocktest_1); + testDeadLockTestTerminatedBody(deadlocktest_1); + /** + * this happens, when p.p.destroy is called before p.interrupt. and destroyed variable is removedI have no idea why, but it is incorrect. + Assert.assertNotNull("return can not be null in no fork process. Was ",pr.returnValue);//in this case forking is forbiden, and sojava throws an exception after destroy + */ + ServerAccess.logOutputReprint("Currently running javas13 " + countJavaInstances()); + } + + public void testDeadLockTestTerminatedBody(String jnlp) throws Exception { + List before = countJavaInstances(); + ServerAccess.logOutputReprint("java1 " + jnlp + " : " + before.size()); + ServerAccess.ProcessResult pr = server.executeJavawsHeadless(null, jnlp); + assertDeadlockTestLaunched(pr); + List after = countJavaInstances(); + ServerAccess.logOutputReprint("java2 " + jnlp + " : " + after.size()); + String ss = "This process is hanging more than 30s. Should be killed"; + Assert.assertFalse("stdout should not contains: " + ss + ", but did", pr.stdout.contains(ss)); +// Assert.assertTrue(pr.stderr.contains("xception"));, exception is thrown by engine,not by application + Assert.assertTrue("testDeadLockTestTerminated should be terminated, but wasn't", pr.wasTerminated); + Assert.assertNull("Killed process must have null return value. Have not - ", pr.returnValue); + killDiff(before, after); + List afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java3 " + jnlp + " : " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + } + + @Test + public void ensureAtLeasOneJavaIsRunning() throws Exception { + Assert.assertTrue("at least one java should be running, but isn't! Javas are probably counted badly", countJavaInstances().size() > 0); + + } + + @Test + public void testSimpletest1lunchFork() throws Exception { + List before = countJavaInstances(); + ServerAccess.logOutputReprint("java4: " + before.size()); + BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, null); + bd.start(); + Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); + List during = countJavaInstances(); + ServerAccess.logOutputReprint("java5: " + during.size()); + waitForBackgroundDeadlock(bd); + List after = countJavaInstances(); + ServerAccess.logOutputReprint("java6: " + after.size()); + Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); + assertDeadlockTestLaunched(bd.getPr()); + killDiff(before, during); + List afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java66: " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + // div by two is caused by jav in java process hierarchy + Assert.assertEquals("launched JVMs must be exactly 2, was " + (during.size() - before.size()) / 2, 2, (during.size() - before.size()) / 2); + } + + @Test + public void testSimpletest1lunchNoFork() throws Exception { + List before = countJavaInstances(); + ServerAccess.logOutputReprint("java7: " + before.size()); + BackgroundDeadlock bd = new BackgroundDeadlock(deadlocktest_1, Arrays.asList(new String[]{"-Xnofork"})); + bd.start(); + Thread.sleep(ServerAccess.PROCESS_TIMEOUT * 2 / 3); + List during = countJavaInstances(); + ServerAccess.logOutputReprint("java8: " + during.size()); + waitForBackgroundDeadlock(bd); + List after = countJavaInstances(); + ServerAccess.logOutputReprint("java9: " + after.size()); + Assert.assertNotNull("proces inside background deadlock cant be null. It was.", bd.getPr()); + assertDeadlockTestLaunched(bd.getPr()); + killDiff(before, during); + List afterKill = countJavaInstances(); + ServerAccess.logOutputReprint("java99: " + afterKill.size()); + Assert.assertEquals("assert that just old javas remians", 0, (before.size() - afterKill.size())); + // div by two is caused by jav in java process hierarchy + Assert.assertEquals("launched JVMs must be exactly 1, was " + (during.size() - before.size()) / 2, 1, (during.size() - before.size()) / 2); + } + + /** + * by process assasin destroyed processes are hanging random amount of time as zombies. + * Kill -9 is handling zombies pretty well. + * + * This function kills or processes which are in nw but are not in old + * (eq.to killing new zombies:) ) + * + * @param old + * @param nw + * @return + * @throws Exception + */ + private static List killDiff(List old, List nw) throws Exception { + ensureLinux(); + List result = new ArrayList(); + for (String string : nw) { + if (old.contains(string)) { + continue; + } + ServerAccess.logOutputReprint("Killing " + string); + ServerAccess.PROCESS_LOG = false; + try { + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"kill", "-9", string})); + } finally { + ServerAccess.PROCESS_LOG = true; + } + result.add(string); + ServerAccess.logOutputReprint("Killed " + string); + } + return result; + } + + private static List countJavaInstances() throws Exception { + ensureLinux(); + List result = new ArrayList(); + ServerAccess.PROCESS_LOG = false; + try { + ServerAccess.ProcessResult pr = ServerAccess.executeProcess(Arrays.asList(new String[]{"ps", "-eo", "pid,ppid,stat,fname"})); + Matcher m = Pattern.compile("\\s*\\d+\\s+\\d+ .+ java\\s*").matcher(pr.stdout); + int i = 0; + while (m.find()) { + i++; + String ss = m.group(); + //ServerAccess.logOutputReprint(i+": "+ss); + result.add(ss.trim().split("\\s+")[0]); + } + } finally { + ServerAccess.PROCESS_LOG = true; + } + return result; + + } + + public static void main(String[] args) throws Exception { + ServerAccess.logOutputReprint("" + countJavaInstances()); + } + + private void assertDeadlockTestLaunched(ProcessResult pr) { + String s = "Deadlock test started"; + Assert.assertTrue("Deadlock test should print out " + s + ", but did not", pr.stdout.contains(s)); + String ss = "xception"; + Assert.assertFalse("Deadlock test should not stderr " + ss + " but did", pr.stderr.contains(ss)); + //each 3500 seconds deadlock test stdout something + //timeout is 20s + //so it should write out FIVE sentences, but is mostly just three or four. Last is nearly always consumed by termination + for (int i = 1; i <= 3; i++) { + String sentence = i + " Deadlock sleeping"; + Assert.assertTrue( + "stdout should contains: " + sentence + ", didn't, so framework have consumed to much during termination", + pr.stdout.contains(sentence)); + } + } + + private void waitForBackgroundDeadlock(final BackgroundDeadlock bd) throws InterruptedException { + while (!bd.isFinished()) { + Thread.sleep(500); + + } + } + + private static class BackgroundDeadlock extends Thread { + + private boolean finished = false; + private ProcessResult pr = null; + String jnlp; + List args; + + public BackgroundDeadlock(String jnlp, List args) { + this.jnlp = jnlp; + this.args = args; + } + + @Override + public void run() { + try { + pr = server.executeJavawsHeadless(args, jnlp); + } catch (Exception ex) { + ServerAccess.logException(ex); + } finally { + finished = true; + } + + } + + public ProcessResult getPr() { + return pr; + } + + public boolean isFinished() { + return finished; + } + } + + private static void ensureLinux() { + String os = System.getProperty("os.name").toLowerCase(); + if (!(os.contains("linux") || os.contains("unix"))) { + throw new IllegalStateException("This test can be procesed only on linux like machines"); + } + } +} diff --git a/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp new file mode 100644 index 0000000..d7d0b85 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletest1.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp new file mode 100644 index 0000000..66eb519 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestCustomSplash.jnlp @@ -0,0 +1,55 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp new file mode 100644 index 0000000..7e319d3 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestMegaSlow.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp new file mode 100644 index 0000000..905cf7c --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlow.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest1 + IcedTea + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp new file mode 100644 index 0000000..0b09c5b --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlowBrokenCustomSplash.jnlp @@ -0,0 +1,54 @@ + + + + + simpletest1 + IcedTea + + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp b/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp new file mode 100644 index 0000000..99ad0b0 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/resources/simpletestSlowSlowCustomSplash.jnlp @@ -0,0 +1,54 @@ + + + + + simpletest1 + IcedTea + + + simpletest1 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java b/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java new file mode 100644 index 0000000..0957480 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/srcs/SimpleTest1.java @@ -0,0 +1,43 @@ +/* SimpleTest1.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SimpleTest1{ + + public static void main(String[] args){ + System.out.println("Good simple javaws exapmle"); + } +} diff --git a/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java b/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java new file mode 100644 index 0000000..abc1592 --- /dev/null +++ b/tests/reproducers/simple/simpletest1/testcases/SimpleTest1Test.java @@ -0,0 +1,61 @@ +/* SimpleTest1Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class SimpleTest1Test { + + private static ServerAccess server = new ServerAccess(); + + + + @Test + public void testSimpletest1lunchOk() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest1.jnlp"); + String s="Good simple javaws exapmle"; + Assert.assertTrue("testSimpletest1lunchOk stdout should contains "+s+" bud didn't",pr.stdout.contains(s)); + String ss="xception"; + Assert.assertFalse("testSimpletest1lunchOk stderr should not contains "+ss+" but did",pr.stderr.contains(ss)); + Assert.assertFalse(pr.wasTerminated); + Assert.assertEquals((Integer)0, pr.returnValue); + } + + } diff --git a/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp b/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp new file mode 100644 index 0000000..cc6e11a --- /dev/null +++ b/tests/reproducers/simple/simpletest2/resources/simpletest2.jnlp @@ -0,0 +1,53 @@ + + + + + simpletest2 + IcedTea + + simpletest2 + + + + + + + + + diff --git a/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java b/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java new file mode 100644 index 0000000..9160c62 --- /dev/null +++ b/tests/reproducers/simple/simpletest2/srcs/SimpleTest2.java @@ -0,0 +1,44 @@ +/* SimpleTest2.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +public class SimpleTest2{ + + public static void main(String[] args){ +throw new RuntimeException("Correct exception"); + + } +} diff --git a/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java new file mode 100644 index 0000000..9a77da4 --- /dev/null +++ b/tests/reproducers/simple/simpletest2/testcases/SimpleTest2Test.java @@ -0,0 +1,62 @@ +/* SimpleTest2Test.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Assert; + +import org.junit.Test; + +public class SimpleTest2Test { + + private static ServerAccess server = new ServerAccess(); + + + @Test + public void testSimpletest2lunchException() throws Exception { + ServerAccess.ProcessResult pr=server.executeJavawsHeadless(null,"/simpletest2.jnlp"); + Assert.assertTrue("stdout should be < 1 , but was "+pr.stdout.trim().length(),pr.stdout.trim().length() < 1); + String s="Correct exception"; + Assert.assertTrue("stderr should contains "+s+" but didn't",pr.stderr.contains(s)); + String ss="Exception"; + Assert.assertTrue("stderr should contains "+ss+" but did not",pr.stderr.contains(ss)); + Assert.assertFalse("testSimpletest2lunchException should not be terminated, but was",pr.wasTerminated); + //Assert.assertFalse(0==pr.returnValue);exception and still returned 0? + } + + + + } diff --git a/tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java b/tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java new file mode 100644 index 0000000..0116152 --- /dev/null +++ b/tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java @@ -0,0 +1,379 @@ +/* ResourcesTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +package net.sourceforge.jnlp; + +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.browsertesting.Browser; +import net.sourceforge.jnlp.browsertesting.BrowserFactory; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.browsers.LinuxBrowser; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class ResourcesTest extends BrowserTest{ + + + @Test + @NeedsDisplay + public void testNonExisitngBrowserWillNotDeadlock() throws Exception { + server.setCurrentBrowser(Browsers.none); + ServerAccess.ProcessResult pr = server.executeBrowser("simpletest1.jnlp"); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + public void testUnexistingProcessWillFailRecognizedly() throws Exception { + server.setCurrentBrowser(Browsers.none); + List al=Arrays.asList(new String[] {"definietly_not_Existing_process"}); + ServerAccess.ProcessResult pr = server.executeProcess(al); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + @TestInBrowsers(testIn=Browsers.none) + public void testNonExisitngBrowserWillNotCauseMess() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("simpletest1.jnlp"); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + public void testBrowsers2() throws Exception { + List a = BrowserFactory.getFactory().getAllBrowsers(); + Assert.assertNotNull("returned browsers array must not be null", a); + Assert.assertTrue("at least one browser must be configured", a.size() > 0); + for (Browser b : a) { + testBrowser(b); + } + + } + + @Test + @TestInBrowsers(testIn = Browsers.all) + public void testBrowser3() throws Exception { + testBrowser(server.getCurrentBrowser()); + + + } + + @Test + public void testBrowsers1() throws Exception { + BrowserFactory bf = new BrowserFactory(null); + int expected = 0; + Assert.assertTrue("Created from null there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + bf = new BrowserFactory(""); + expected = 0; + Assert.assertTrue("Created from empty there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + String s = "dsgrdg"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "sgrg/jkik"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox + "/jkik"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "sgrg/jkik:sege"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from two nonsenses " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + Browsers.firefox; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec(); + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec(); + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec(); + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec() + ":" + Browsers.chromiumBrowser; + bf = new BrowserFactory(s); + expected = 3; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + "vfdgf" + ":" + Browsers.googleChrome.toExec(); + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + Browsers.chromiumBrowser + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 4; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + testFullFactory(bf); + + s = "fgfd/" + Browsers.firefox.toExec() + ":" + "/fgfd/" + Browsers.chromiumBrowser + ":" + "fgfd/dfsdf/" + Browsers.googleChrome.toExec() + ":" + "/g/fgfd/" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 4; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + testFullFactory(bf); + + s = Browsers.firefox.toExec() + ":" + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 3; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + ":" + ":" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = ":" + ":" + Browsers.googleChrome.toExec() + ":"; + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = ":" + Browsers.firefox.toExec() + ":bfgbfg/fddf/" + Browsers.googleChrome.toExec() + ":"; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + + + + } + + @Test + public void testResourcesExists() throws Exception { + File[] simpleContent = server.getDir().listFiles(new FileFilter() { + + public boolean accept(File file) { + if (!file.isDirectory()) { + return true; + } else { + return false; + } + } + }); + Assert.assertNotNull(simpleContent); + Assert.assertTrue(simpleContent.length > 5); + + for (int i = 0; i < simpleContent.length; i++) { + File file = simpleContent[i]; + ServerAccess.logOutputReprint(file.getName()); + //server port have in fact no usage in converting filename to uri-like-filename. + //But if there is null, instead if some number, then nullpointer exception is thrown (Integer->int). + //So I'm using "real" currently used port, instead of some random value. + URI u = new URI((String) null, (String) null, (String) null, server.getPort(), file.getName(), (String) null, null); + ServerAccess.logOutputReprint(" ("+u.toString()+")"); + String fname = u.toString(); + if (file.getName().toLowerCase().endsWith(".jnlp")) { + String c = server.getResourceAsString("/" + fname); + Assert.assertTrue(c.contains("<")); + Assert.assertTrue(c.contains(">")); + Assert.assertTrue(c.contains("jnlp")); + Assert.assertTrue(c.contains("resources")); + Assert.assertTrue(c.replaceAll("\\s*", "").contains("")); + + } else { + byte[] c = server.getResourceAsBytes("/" + fname).toByteArray(); + Assert.assertEquals(c.length, file.length()); + } + + } + + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn = Browsers.one) + public void testListeners() throws Exception { + final StringBuilder o1 = new StringBuilder(); + final StringBuilder e1 = new StringBuilder(); + final StringBuilder o2 = new StringBuilder(); + final StringBuilder e2 = new StringBuilder(); + final ContentReaderListener lo = new ContentReaderListener() { + + @Override + public void charReaded(char ch) { + //ServerAccess.logOutputReprint("OO recieved char: "+ch); + o1.append(ch); + } + + @Override + public void lineReaded(String s) { + //ServerAccess.logOutputReprint("OO recieved line: "+s); + o2.append(s).append("\n"); + } + }; + ContentReaderListener le = new ContentReaderListener() { + + @Override + public void charReaded(char ch) { + //ServerAccess.logOutputReprint("EE recieved char: "+ch); + e1.append(ch); + } + + @Override + public void lineReaded(String s) { + //ServerAccess.logOutputReprint("EE recieved line: "+s); + e2.append(s).append("\n"); + } + }; + ServerAccess.ProcessResult pr=server.executeBrowser("simpletest1.jnlp",le,lo); + server.setCurrentBrowser(BrowserFactory.getFactory().getFirst().getID()); + Assert.assertNotNull(server.getCurrentBrowsers()); + Assert.assertNotNull(server.getCurrentBrowser()); +// ServerAccess.logOutputReprint("total o"); +// ServerAccess.logOutputReprint(pr.stdout); +// ServerAccess.logOutputReprint("total e"); +// ServerAccess.logOutputReprint(pr.stderr); + Assert.assertEquals(pr.stdout, o1.toString()); + Assert.assertEquals(pr.stderr, e1.toString()); + //the last \n is mandatory as las tline is flushed also when proces dies + Assert.assertEquals(pr.stdout.replace("\n", ""), o2.toString().replace("\n", "")); + Assert.assertEquals(pr.stderr.replace("\n", ""), e2.toString().replace("\n", "")); + + } + + private void testFullFactory(BrowserFactory bf) { + Assert.assertEquals(bf.getBrowser(Browsers.chromiumBrowser).getID(), Browsers.chromiumBrowser); + Assert.assertEquals(bf.getBrowser(Browsers.googleChrome).getID(), Browsers.googleChrome); + Assert.assertEquals(bf.getBrowser(Browsers.firefox).getID(), Browsers.firefox); + Assert.assertEquals(bf.getBrowser(Browsers.opera).getID(), Browsers.opera); + } + + private void testBrowser(Browser browser) throws IOException { + File f1 = null; + if (browser.getDefaultPluginExpectedLocation() != null) { + f1 = new File(browser.getDefaultPluginExpectedLocation()); + } + File f2 = null; + if (browser.getUserDefaultPluginExpectedLocation() != null) { + f2 = new File(browser.getUserDefaultPluginExpectedLocation()); + } + if (f1 != null) { + Assert.assertTrue("browser's plugins location should exist " + f1.toString() + " for " + browser.getID().toString(), f1.exists()); + } + if (f2 != null) { + Assert.assertTrue("browser's users-plugins location should exist " + f2.toString() + " for " + browser.getID().toString(), f2.exists()); + } + + File[] ff1 = new File[0]; + if (f1 != null) { + ff1 = f1.listFiles(); + } + + File[] ff2 = new File[0]; + if (f2 != null) { + ff2 = f2.listFiles(); + } + + Assert.assertTrue("at least one of browser's plugins directory should contains at least one file didn't. For " + browser.getID().toString(), ff1.length + ff2.length > 0); + + ff1 = new File[0]; + if (f1 != null) { + ff1 = f1.listFiles(new FileFilter() { + + @Override + public boolean accept(File pathname) { + return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); + } + }); + } + + ff2 = new File[0]; + if (f2 != null) { + ff2 = f2.listFiles(new FileFilter() { + + @Override + public boolean accept(File pathname) { + return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); + } + }); + } + + Assert.assertTrue("browser's plugins directories should contains exactly one " + LinuxBrowser.DEFAULT_PLUGIN_NAME + ", but didnt for " + browser.getID().toString(), + ff1.length + ff2.length == 1); + String currentPath = server.getJavawsFile().getParentFile().getParentFile().getAbsolutePath(); + + File[] ff; + if (ff1.length == 1) { + ff = ff1; + } else { + ff = ff2; + } + String s = ServerAccess.getContentOfStream(new FileInputStream(ff[0]), "ASCII"); + Assert.assertTrue("browser's plugins shoud points to" + currentPath + ", but didnt", + s.contains(s)); + } +} diff --git a/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java b/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java new file mode 100644 index 0000000..25415be --- /dev/null +++ b/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java @@ -0,0 +1,233 @@ +/* ServerAccessTest.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +package net.sourceforge.jnlp; + +import java.io.File; +import java.io.FileInputStream; +import java.net.URL; +import org.junit.Assert; +import org.junit.Test; + +/** + * + * This class provides access to virtual server and stuff around. + * It can find unoccupied port, start server, provides its singleton instantiation, lunch parallel instantiations, + * read location of installed (tested javaws) see javaws.build.bin java property, + * location of server www root on file system (see test.server.dir java property), + * stubs for lunching javaws and for locating resources and read resources. + * + * It can also execute processes with timeout (@see PROCESS_TIMEOUT) (used during lunching javaws) + * Some protected apis are exported because public classes in this package are put to be tested by makefile. + * + * There are included test cases which show some basic usages. + * + * + */ +public class ServerAccessTest { + + ServerAccess serverAccess = new ServerAccess(); + + @Test + public void testsProcessResultFiltering() throws Exception { + ProcessResult pn = new ProcessResult(null, null, null, true, 0, null); + Assert.assertNull(pn.notFilteredStdout); + Assert.assertNull(pn.stdout); + Assert.assertNull(pn.stderr); + String fakeOut2 = + "EMMA: processing instrumentation path ...\n" + + "EMMA: package [net.sourceforge.filebrowser] contains classes [ArrayOfString] without full debug info\n" + + "EMMA: instrumentation path processed in 1407 ms\n" + + "test stage 1\n" + + "test stage 2\n" + + "EMMA: The intruder!\n" + + "test stage 3\n" + + "EMMA: [45 class(es) instrumented, 13 resource(s) copied]\n" + + "EMMA: metadata merged into [icedtea-web/inc] {in 105 ms}\n" + + "EMMA: processing instrumentation path ..."; + String filteredOut2 = + "test stage 1\n" + + "test stage 2\n" + + "test stage 3\n"; + ProcessResult p2 = new ProcessResult(fakeOut2, fakeOut2, null, true, 0, null); + Assert.assertEquals(p2.notFilteredStdout, fakeOut2); + Assert.assertEquals(p2.stdout, filteredOut2); + Assert.assertEquals(p2.stderr, fakeOut2); + fakeOut2 += "\n"; + p2 = new ProcessResult(fakeOut2, fakeOut2, null, true, 0, null); + Assert.assertEquals(p2.notFilteredStdout, fakeOut2); + Assert.assertEquals(p2.stdout, filteredOut2); + Assert.assertEquals(p2.stderr, fakeOut2); + String fakeOut = + "test string\n" + + "EMMA: processing instrumentation path ...\n" + + "EMMA: package [net.sourceforge.filebrowser] contains classes [ArrayOfString] without full debug info\n" + + "EMMA: instrumentation path processed in 1407 ms\n" + + "test stage 1\n" + + "test stage 2\n" + + "test stage 3\n" + + "EMMA: [45 class(es) instrumented, 13 resource(s) copied]\n" + + "EMMA: metadata merged into [icedtea-web/inc] {in 105 ms}\n" + + "EMMA: processing instrumentation path ...\n" + + "test ends"; + String filteredOut = + "test string\n" + + "test stage 1\n" + + "test stage 2\n" + + "test stage 3\n" + + "test ends"; + ProcessResult p = new ProcessResult(fakeOut, fakeOut, null, true, 0, null); + Assert.assertEquals(p.notFilteredStdout, fakeOut); + Assert.assertEquals(p.stdout, filteredOut); + Assert.assertEquals(p.stderr, fakeOut); + fakeOut += "\n"; + filteredOut += "\n"; + p = new ProcessResult(fakeOut, fakeOut, null, true, 0, null); + Assert.assertEquals(p.notFilteredStdout, fakeOut); + Assert.assertEquals(p.stdout, filteredOut); + Assert.assertEquals(p.stderr, fakeOut); + } + + @Test + public void ensureJavaws() throws Exception { + String javawsValue = serverAccess.getJavawsLocation(); + Assert.assertNotNull(javawsValue); + Assert.assertTrue(javawsValue.trim().length() > 2); + File javawsFile = serverAccess.getJavawsFile(); + Assert.assertTrue(javawsFile.exists()); + Assert.assertFalse(javawsFile.isDirectory()); + } + + @Test + public void ensureServer() throws Exception { + ServerLauncher server = ServerAccess.getInstance(); + Assert.assertNotNull(server.getPort()); + Assert.assertNotNull(server.getDir()); + Assert.assertTrue(server.getPort() > 999); + Assert.assertTrue(server.getDir().toString().trim().length() > 2); + + Assert.assertTrue(server.getDir().exists()); + Assert.assertTrue(server.getDir().isDirectory()); + + File portFile = new File(server.getDir(), "server.port"); + File dirFile = new File(server.getDir(), "server.dir"); + + ServerAccess.saveFile(server.getDir().getAbsolutePath(), dirFile); + ServerAccess.saveFile(server.getPort().toString(), portFile); + ServerAccess.saveFile(server.getPort().toString(), portFile); + + Assert.assertTrue(portFile.exists()); + Assert.assertTrue(dirFile.exists()); + Assert.assertTrue(server.getDir().listFiles().length > 1); + + String portFileContent = ServerAccess.getContentOfStream(new FileInputStream(portFile)); + String dirFileContent = ServerAccess.getContentOfStream(new FileInputStream(dirFile)); + + URL portUrl = new URL("http", "localhost", server.getPort(), "/server.port"); + URL dirUrl = new URL("http", "localhost", server.getPort(), "/server.dir"); + + String portUrlContent = ServerAccess.getContentOfStream(portUrl.openConnection().getInputStream()); + String dirUrlContent = ServerAccess.getContentOfStream(dirUrl.openConnection().getInputStream()); + + Assert.assertEquals(portUrlContent.trim(), portFileContent.trim()); + Assert.assertEquals(dirUrlContent.trim(), dirFileContent.trim()); + Assert.assertEquals(new File(dirUrlContent.trim()), server.getDir()); + Assert.assertEquals(new Integer(portUrlContent.trim()), server.getPort()); + + URL fastUrl = new URL("http", "localhost", server.getPort(), "/simpletest1.jnlp"); + URL slowUrl = new URL("http", "localhost", server.getPort(), "/XslowXsimpletest1.jnlp"); + + String fastUrlcontent = ServerAccess.getContentOfStream(fastUrl.openConnection().getInputStream()); + String slowUrlContent = ServerAccess.getContentOfStream(slowUrl.openConnection().getInputStream()); + Assert.assertEquals(fastUrlcontent, slowUrlContent); + + } + + @Test + public void splitArrayTest0() throws Exception { + byte[] b = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; + byte[][] bb = TinyHttpdImpl.splitArray(b, 3); + //printArrays(bb); + byte[] b1 = {1, 2, 3, 4, 5}; + byte[] b2 = {6, 7, 8, 9, 10}; + byte[] b3 = {11, 12, 13, 14}; + Assert.assertEquals(3, bb.length); + Assert.assertArrayEquals(b1, bb[0]); + Assert.assertArrayEquals(b2, bb[1]); + Assert.assertArrayEquals(b3, bb[2]); + } + + @Test + public void splitArrayTest1() throws Exception { + byte[] b = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; + byte[][] bb = TinyHttpdImpl.splitArray(b, 3); + //printArrays(bb); + byte[] b1 = {1, 2, 3, 4, 5}; + byte[] b2 = {6, 7, 8, 9, 10}; + byte[] b3 = {11, 12, 13}; + Assert.assertEquals(3, bb.length); + Assert.assertArrayEquals(b1, bb[0]); + Assert.assertArrayEquals(b2, bb[1]); + Assert.assertArrayEquals(b3, bb[2]); + } + + @Test + public void splitArrayTest2() throws Exception { + byte[] b = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + byte[][] bb = TinyHttpdImpl.splitArray(b, 3); + //printArrays(bb); + byte[] b1 = {1, 2, 3, 4}; + byte[] b2 = {5, 6, 7, 8}; + byte[] b3 = {9, 10, 11, 12}; + Assert.assertEquals(3, bb.length); + Assert.assertArrayEquals(b1, bb[0]); + Assert.assertArrayEquals(b2, bb[1]); + Assert.assertArrayEquals(b3, bb[2]); + } + + private void printArrays(byte[][] bb) { + System.out.println("[][] l=" + bb.length); + for (int i = 0; i < bb.length; i++) { + byte[] bs = bb[i]; + System.out.println(i + ": l=" + bs.length); + for (int j = 0; j < bs.length; j++) { + byte c = bs[j]; + System.out.print(" " + j + ":" + c + " "); + } + System.out.println(""); + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java b/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java new file mode 100644 index 0000000..464b778 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ContentReader.java @@ -0,0 +1,133 @@ +/* ContentReader.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + +/** + * Class to read content of stdout/stderr of process, and to cooperate with its running/terminated/finished statuses. + */ +class ContentReader implements Runnable { + + StringBuilder sb = new StringBuilder(); + private final InputStream is; + private boolean done; + ContentReaderListener listener; + + public String getContent() { + return sb.toString(); + } + + public ContentReader(InputStream is) throws IOException { + this.is = is; + } + + public ContentReader(InputStream is, ContentReaderListener l) throws IOException { + this.is = is; + this.listener = l; + } + + public void setListener(ContentReaderListener listener) { + this.listener = listener; + } + + public ContentReaderListener getListener() { + return listener; + } + + /** + * Blocks until the copy is complete, or until the thread is interrupted + */ + public synchronized void waitUntilDone() throws InterruptedException { + boolean interrupted = false; + // poll interrupted flag, while waiting for copy to complete + while (!(interrupted = Thread.interrupted()) && !done) { + wait(1000); + } + if (interrupted) { + ServerAccess.logNoReprint("Stream copier: throwing InterruptedException"); + //throw new InterruptedException(); + } + } + + @Override + public void run() { + try { + Reader br = new InputStreamReader(is, "UTF-8"); + StringBuilder line = new StringBuilder(); + while (true) { + int s = br.read(); + if (s < 0) { + if (line.length() > 0 && listener != null) { + listener.lineReaded(line.toString()); + } + break; + } + char ch = (char) s; + sb.append(ch); + line.append(ch); + if (ch == '\n') { + if (listener != null) { + listener.lineReaded(line.toString()); + } + line = new StringBuilder(); + } + if (listener != null) { + listener.charReaded(ch); + } + } + //do not want to bother output with terminations + //mostly compaling when assassin kill the process about StreamClosed + //do not want to bother output with terminations + //mostly compaling when assassin kill the process about StreamClosed + } catch (Exception ex) { + // logException(ex); + } finally { + try { + is.close(); + } catch (Exception ex) { + // ex.printStackTrace(); + } finally { + done = true; + } + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ContentReaderListener.java b/tests/test-extensions/net/sourceforge/jnlp/ContentReaderListener.java new file mode 100644 index 0000000..4427d84 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ContentReaderListener.java @@ -0,0 +1,45 @@ +/* ContentReaderListener.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +public interface ContentReaderListener { + + public void charReaded(char ch); + public void lineReaded(String s); + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/LogItem.java b/tests/test-extensions/net/sourceforge/jnlp/LogItem.java new file mode 100644 index 0000000..dd99c04 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/LogItem.java @@ -0,0 +1,71 @@ +/* LogItem.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.util.Date; + +class LogItem { + + public final Date timeStamp = new Date(); + public final StackTraceElement[] fullTrace = Thread.currentThread().getStackTrace(); + public final String text; + private static final String ITEM_ELEMENT = "item"; + private static final String ITEM_ID_ATTRIBUTE = "id"; + private static final String STAMP_ELEMENT = "stamp"; + private static final String TEXT_ELEMENT = "text"; + private static final String FULLTRACE_ELEMENT = "fulltrace"; + + public LogItem(String text) { + this.text = text; + } + + public StringBuilder toStringBuilder(int id) { + StringBuilder sb = new StringBuilder(); + sb.append(" <" + ITEM_ELEMENT + " " + ITEM_ID_ATTRIBUTE + "=\"").append(id).append("\">\n"); + sb.append(" <" + STAMP_ELEMENT + ">\n"); + sb.append(" <" + TEXT_ELEMENT + ">\n"); + sb.append(" <" + FULLTRACE_ELEMENT + "> \n"); + sb.append(" \n"); + return sb; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java new file mode 100644 index 0000000..3f4de4b --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/LoggingBottleneck.java @@ -0,0 +1,215 @@ +/* LoggingBottleneck.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class LoggingBottleneck { + + /** + * default singleton + */ + private static LoggingBottleneck loggingBottleneck; + private static final File DEFAULT_LOG_FILE = new File("ServerAccess-logs.xml"); + private static final File DEFAULT_STDERR_FILE = new File("stderr.log"); + private static final File DEFAULT_STDOUT_FILE = new File("stdout.log"); + private static final File DEFAULT_STDLOGS_FILE = new File("all.log"); + private static final String LOGS_ELEMENT = "logs"; + private static final String CLASSLOG_ELEMENT = "classlog"; + private static final String CLASSNAME_ATTRIBUTE = "className"; + private static final String TESTLOG_ELEMENT = "testLog"; + private static final String TESTMETHOD_ATTRIBUTE = "testMethod"; + private static final String FULLID_ATTRIBUTE = "fullId"; + private BufferedWriter DEFAULT_STDERR_WRITER; + private BufferedWriter DEFAULT_STDOUT_WRITER; + private BufferedWriter DEFAULT_STDLOGS_WRITER; + /** + * This is static copy of name of id of currentBrowser for logging purposes + */ + private String loggedBrowser = Browsers.none.toString(); + /** + * map of classes, each have map of methods, each have errorlist, outLIst, and allList (allist contains also not std or err messages) + * class.testMethod.logs + */ + final Map> processLogs = new HashMap>(100); + private boolean added = false; + + public static LoggingBottleneck getDefaultLoggingBottleneck() { + if (loggingBottleneck == null) { + loggingBottleneck = new LoggingBottleneck(); + } + return loggingBottleneck; + + } + + private LoggingBottleneck() { + try { + DEFAULT_STDOUT_WRITER = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDOUT_FILE))); + DEFAULT_STDERR_WRITER = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDERR_FILE))); + DEFAULT_STDLOGS_WRITER = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(DEFAULT_STDLOGS_FILE))); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + void writeXmlLog() throws FileNotFoundException, IOException { + writeXmlLog(DEFAULT_LOG_FILE); + } + + void writeXmlLog(File f) throws FileNotFoundException, IOException { + Writer w = new OutputStreamWriter(new FileOutputStream(f)); + Set>> classes = processLogs.entrySet(); + w.write("<" + LOGS_ELEMENT + ">"); + for (Entry> classLog : classes) { + String className = classLog.getKey(); + w.write("<" + CLASSLOG_ELEMENT + " " + CLASSNAME_ATTRIBUTE + "=\"" + className + "\">"); + Set> testsLogs = classLog.getValue().entrySet(); + for (Entry testLog : testsLogs) { + String testName = testLog.getKey(); + String testLogs = testLog.getValue().toString(); + w.write("<" + TESTLOG_ELEMENT + " " + TESTMETHOD_ATTRIBUTE + "=\"" + testName + "\" " + FULLID_ATTRIBUTE + "=\"" + className + "." + testName + "\" >"); + w.write(testLogs); + w.write(""); + } + w.write(""); + } + w.write(""); + w.flush(); + w.close(); + } + + void addToXmlLog(String message, boolean printToOut, boolean printToErr, StackTraceElement ste) { + Map classLog = processLogs.get(ste.getClassName()); + if (classLog == null) { + classLog = new HashMap(50); + processLogs.put(ste.getClassName(), classLog); + } + String methodBrowseredName = ste.getMethodName(); + methodBrowseredName = modifyMethodWithForBrowser(methodBrowseredName, ste.getClassName()); + TestsLogs methodLog = classLog.get(methodBrowseredName); + if (methodLog == null) { + methodLog = new TestsLogs(); + classLog.put(methodBrowseredName, methodLog); + } + if (!added) { + Runtime.getRuntime().addShutdownHook(new Thread() { + + @Override + public void run() { + try { + LoggingBottleneck.getDefaultLoggingBottleneck().writeXmlLog(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + }); + added = true; + } + methodLog.add(printToErr, printToOut, message); + } + + public String modifyMethodWithForBrowser(String methodBrowseredName, String className) { + try { + Class clazz = Class.forName(className); + /* + * By using this isAssignable to ensure corect class before invocation, + * then we lost possibility to track manualy set browsers, but it is correct, + * as method description is set only when annotation is used + */ + if (clazz != null && BrowserTest.class.isAssignableFrom(clazz)) { + Method testMethod = clazz.getMethod(methodBrowseredName); + if (testMethod != null) { + TestInBrowsers tib = testMethod.getAnnotation(TestInBrowsers.class); + if (tib != null) { + methodBrowseredName = methodBrowseredName + " - " + loggedBrowser; + } + } + } + } catch (Throwable ex) { + ex.printStackTrace(); + } + return methodBrowseredName; + } + + public void setLoggedBrowser(String loggedBrowser) { + this.loggedBrowser = loggedBrowser; + } + + public void logIntoPlaintextLog(String message, boolean printToOut, boolean printToErr) { + try { + if (printToOut) { + LoggingBottleneck.getDefaultLoggingBottleneck().stdout(message); + } + if (printToErr) { + LoggingBottleneck.getDefaultLoggingBottleneck().stderr(message); + } + LoggingBottleneck.getDefaultLoggingBottleneck().stdeall(message); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + private void stdout(String idded) throws IOException { + DEFAULT_STDOUT_WRITER.write(idded); + DEFAULT_STDOUT_WRITER.newLine(); + } + + private void stderr(String idded) throws IOException { + DEFAULT_STDERR_WRITER.write(idded); + DEFAULT_STDERR_WRITER.newLine(); + } + + private void stdeall(String idded) throws IOException { + DEFAULT_STDLOGS_WRITER.write(idded); + DEFAULT_STDLOGS_WRITER.newLine(); + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java new file mode 100644 index 0000000..c910311 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessAssasin.java @@ -0,0 +1,159 @@ +/* ProcessAssasin.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +/** + * class which timeout any ThreadedProcess. This killing of 'thread with process' replaced not working process.destroy(). + */ +class ProcessAssasin extends Thread { + + long timeout; + private final ThreadedProcess p; + //false == is disabled:( + private boolean canRun = true; + private boolean wasTerminated = false; + /** + * if this is true, then process is not destroyed after timeout, but just left to its own destiny. + * Its stdout/err is no longer recorded, and it is leaking system resources until it dies by itself + * The contorl is returned to main thread with all informations recorded untill now. + * You will be able to listen to std out from listeners still + */ + private boolean skipInstedOfDesroy = false; + + public ProcessAssasin(ThreadedProcess p, long timeout) { + this.p = (p); + this.timeout = timeout; + } + + public ProcessAssasin(ThreadedProcess p, long timeout, boolean skipInstedOfDesroy) { + this.p = (p); + this.timeout = timeout; + this.skipInstedOfDesroy = skipInstedOfDesroy; + } + + public void setCanRun(boolean canRun) { + this.canRun = canRun; + if (p != null) { + if (p.getP() != null) { + ServerAccess.logNoReprint("Stopping assassin for" + p.toString() + " " + p.getP().toString() + " " + p.getCommandLine() + ": "); + } else { + ServerAccess.logNoReprint("Stopping assassin for" + p.toString() + " " + p.getCommandLine() + ": "); + } + } else { + ServerAccess.logNoReprint("Stopping assassin for null job: "); + } + } + + public boolean isCanRun() { + return canRun; + } + + public boolean wasTerminated() { + return wasTerminated; + } + + public void setSkipInstedOfDesroy(boolean skipInstedOfDesroy) { + this.skipInstedOfDesroy = skipInstedOfDesroy; + } + + public boolean isSkipInstedOfDesroy() { + return skipInstedOfDesroy; + } + + @Override + public void run() { + long startTime = System.nanoTime() / ServerAccess.NANO_TIME_DELIMITER; + while (canRun) { + try { + long time = System.nanoTime() / ServerAccess.NANO_TIME_DELIMITER; + //ServerAccess.logOutputReprint(time - startTime); + //ServerAccess.logOutputReprint((time - startTime) > timeout); + if ((time - startTime) > timeout) { + try { + if (p != null) { + if (p.getP() != null) { + ServerAccess.logErrorReprint("Timed out " + p.toString() + " " + p.getP().toString() + " .. killing " + p.getCommandLine() + ": "); + } else { + ServerAccess.logErrorReprint("Timed out " + p.toString() + " " + "null .. killing " + p.getCommandLine() + ": "); + } + wasTerminated = true; + p.interrupt(); + while (!ServerAccess.terminated.contains(p)) { + Thread.sleep(100); + } + if (p.getP() != null) { + try { + if (!skipInstedOfDesroy) { + p.getP().destroy(); + } + } catch (Throwable ex) { + if (p.deadlyException == null) { + p.deadlyException = ex; + } + ex.printStackTrace(); + } + } + if (p.getP() != null) { + ServerAccess.logErrorReprint("Timed out " + p.toString() + " " + p.getP().toString() + " .. killed " + p.getCommandLine()); + } else { + ServerAccess.logErrorReprint("Timed out " + p.toString() + " null .. killed " + p.getCommandLine()); + } + } else { + ServerAccess.logErrorReprint("Timed out null job"); + } + break; + } finally { + p.setDestoyed(true); + } + } + Thread.sleep(100); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + if (p != null) { + if (p.getP() != null) { + ServerAccess.logNoReprint("assassin for" + p.toString() + " " + p.getP().toString() + " .. done " + p.getCommandLine() + " termination " + wasTerminated); + } else { + ServerAccess.logNoReprint("assassin for" + p.toString() + " null .. done " + p.getCommandLine() + " termination " + wasTerminated); + } + } else { + ServerAccess.logNoReprint("assassin for non existing job termination " + wasTerminated); + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ProcessResult.java b/tests/test-extensions/net/sourceforge/jnlp/ProcessResult.java new file mode 100644 index 0000000..d436f72 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ProcessResult.java @@ -0,0 +1,69 @@ +/* ProcessResult.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +/** + * artefacts what are left by finished process + */ +public class ProcessResult { + + public final String stdout; + public final String notFilteredStdout; + public final String stderr; + public final Process process; + public final Integer returnValue; + public final boolean wasTerminated; + /* + * possible exception which caused Process not to be launched + */ + public final Throwable deadlyException; + + public ProcessResult(String stdout, String stderr, Process process, boolean wasTerminated, Integer r, Throwable deadlyException) { + this.notFilteredStdout = stdout; + if (stdout == null) { + this.stdout = null; + } else { + this.stdout = stdout.replaceAll("EMMA:.*\n?", ""); + } + this.stderr = stderr; + this.process = process; + this.wasTerminated = wasTerminated; + this.returnValue = r; + this.deadlyException = deadlyException; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ResourcesTest.java b/tests/test-extensions/net/sourceforge/jnlp/ResourcesTest.java new file mode 100644 index 0000000..097ac4f --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ResourcesTest.java @@ -0,0 +1,389 @@ +/* ResourcesTestl.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +package net.sourceforge.jnlp; + +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.browsertesting.Browser; +import net.sourceforge.jnlp.browsertesting.BrowserFactory; +import net.sourceforge.jnlp.browsertesting.BrowserTest; +import net.sourceforge.jnlp.browsertesting.Browsers; +import net.sourceforge.jnlp.annotations.NeedsDisplay; +import net.sourceforge.jnlp.browsertesting.browsers.LinuxBrowser; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import org.junit.Assert; + +import org.junit.Test; + +public class ResourcesTest extends BrowserTest{ + + + @Test + @NeedsDisplay + public void testNonExisitngBrowserWillNotDeadlock() throws Exception { + server.setCurrentBrowser(Browsers.none); + ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp"); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + public void testUnexistingProcessWillFailRecognizedly() throws Exception { + server.setCurrentBrowser(Browsers.none); + List al=Arrays.asList(new String[] {"definietly_not_Existing_process"}); + ServerAccess.ProcessResult pr = server.executeProcess(al); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + public void testGetUrlUponThisInstance() throws MalformedURLException{ + URL u1=server.getUrlUponThisInstance("simple.jsp"); + URL u2=server.getUrlUponThisInstance("/simple.jsp"); + Assert.assertEquals(u1, u2); + } + + @Test + @TestInBrowsers(testIn=Browsers.none) + public void testNonExisitngBrowserWillNotCauseMess() throws Exception { + ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp"); + Assert.assertNull(pr.process); + Assert.assertEquals(pr.stderr, ""); + Assert.assertEquals(pr.stdout, ""); + Assert.assertTrue(pr.wasTerminated); + Assert.assertTrue(pr.returnValue < 0); + junit.framework.Assert.assertNotNull(pr.deadlyException); + } + + @Test + public void testBrowsers2() throws Exception { + List a = BrowserFactory.getFactory().getAllBrowsers(); + Assert.assertNotNull("returned browsers array must not be null", a); + Assert.assertTrue("at least one browser must be configured", a.size() > 0); + for (Browser b : a) { + testBrowser(b); + } + + } + + @Test + @TestInBrowsers(testIn = Browsers.all) + public void testBrowser3() throws Exception { + testBrowser(server.getCurrentBrowser()); + + + } + + @Test + public void testBrowsers1() throws Exception { + BrowserFactory bf = new BrowserFactory(null); + int expected = 0; + Assert.assertTrue("Created from null there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + bf = new BrowserFactory(""); + expected = 0; + Assert.assertTrue("Created from empty there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + String s = "dsgrdg"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "sgrg/jkik"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + " there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox + "/jkik"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from nonsense " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "sgrg/jkik:sege"; + bf = new BrowserFactory(s); + expected = 0; + Assert.assertTrue("Created from two nonsenses " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + Browsers.firefox; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec(); + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec(); + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec(); + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = "something/somewhere/" + Browsers.firefox.toExec() + ":" + "something/somewhere/" + Browsers.opera.toExec() + ":" + Browsers.chromiumBrowser; + bf = new BrowserFactory(s); + expected = 3; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + "vfdgf" + ":" + Browsers.googleChrome.toExec(); + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + Browsers.chromiumBrowser + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera + ":" + Browsers.epiphany + ":" + Browsers.midori; + bf = new BrowserFactory(s); + expected = 6; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + testFullFactory(bf); + + s = "fgfd/" + Browsers.firefox.toExec() + ":" + "/fgfd/" + Browsers.chromiumBrowser + ":" + "fgfd/dfsdf/" + Browsers.googleChrome.toExec() + ":" + "/g/fgfd/" + Browsers.opera + ":" + Browsers.epiphany + ":" + Browsers.midori; + bf = new BrowserFactory(s); + expected = 6; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + testFullFactory(bf); + + s = Browsers.firefox.toExec() + ":" + ":" + Browsers.googleChrome.toExec() + ":" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 3; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = Browsers.firefox.toExec() + ":" + ":" + ":" + Browsers.opera; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = ":" + ":" + Browsers.googleChrome.toExec() + ":"; + bf = new BrowserFactory(s); + expected = 1; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + s = ":" + Browsers.firefox.toExec() + ":bfgbfg/fddf/" + Browsers.googleChrome.toExec() + ":"; + bf = new BrowserFactory(s); + expected = 2; + Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); + + + + + } + + @Test + public void testResourcesExists() throws Exception { + File[] simpleContent = server.getDir().listFiles(new FileFilter() { + + public boolean accept(File file) { + if (!file.isDirectory()) { + return true; + } else { + return false; + } + } + }); + Assert.assertNotNull(simpleContent); + Assert.assertTrue(simpleContent.length > 5); + + for (int i = 0; i < simpleContent.length; i++) { + File file = simpleContent[i]; + ServerAccess.logOutputReprint(file.getName()); + //server port have in fact no usage in converting filename to uri-like-filename. + //But if there is null, instead if some number, then nullpointer exception is thrown (Integer->int). + //So I'm using "real" currently used port, instead of some random value. + URI u = new URI((String) null, (String) null, (String) null, server.getPort(), file.getName(), (String) null, null); + ServerAccess.logOutputReprint(" ("+u.toString()+")"); + String fname = u.toString(); + if (file.getName().toLowerCase().endsWith(".jnlp")) { + String c = server.getResourceAsString("/" + fname); + Assert.assertTrue(c.contains("<")); + Assert.assertTrue(c.contains(">")); + Assert.assertTrue(c.contains("jnlp")); + Assert.assertTrue(c.contains("resources")); + Assert.assertTrue(c.replaceAll("\\s*", "").contains("")); + + } else { + byte[] c = server.getResourceAsBytes("/" + fname).toByteArray(); + Assert.assertEquals(c.length, file.length()); + } + + } + + } + + @Test + @NeedsDisplay + @TestInBrowsers(testIn = Browsers.one) + public void testListeners() throws Exception { + final StringBuilder o1 = new StringBuilder(); + final StringBuilder e1 = new StringBuilder(); + final StringBuilder o2 = new StringBuilder(); + final StringBuilder e2 = new StringBuilder(); + final ContentReaderListener lo = new ContentReaderListener() { + + @Override + public void charReaded(char ch) { + //ServerAccess.logOutputReprint("OO recieved char: "+ch); + o1.append(ch); + } + + @Override + public void lineReaded(String s) { + //ServerAccess.logOutputReprint("OO recieved line: "+s); + o2.append(s).append("\n"); + } + }; + ContentReaderListener le = new ContentReaderListener() { + + @Override + public void charReaded(char ch) { + //ServerAccess.logOutputReprint("EE recieved char: "+ch); + e1.append(ch); + } + + @Override + public void lineReaded(String s) { + //ServerAccess.logOutputReprint("EE recieved line: "+s); + e2.append(s).append("\n"); + } + }; + ServerAccess.ProcessResult pr = server.executeBrowser("/simpletest1.jnlp", le, lo); + server.setCurrentBrowser(BrowserFactory.getFactory().getFirst().getID()); + Assert.assertNotNull(server.getCurrentBrowsers()); + Assert.assertNotNull(server.getCurrentBrowser()); +// ServerAccess.logOutputReprint("total o"); +// ServerAccess.logOutputReprint(pr.stdout); +// ServerAccess.logOutputReprint("total e"); +// ServerAccess.logOutputReprint(pr.stderr); + Assert.assertEquals(pr.stdout, o1.toString()); + Assert.assertEquals(pr.stderr, e1.toString()); + //the last \n is mandatory as las tline is flushed also when proces dies + Assert.assertEquals(pr.stdout.replace("\n", ""), o2.toString().replace("\n", "")); + Assert.assertEquals(pr.stderr.replace("\n", ""), e2.toString().replace("\n", "")); + + } + + private void testFullFactory(BrowserFactory bf) { + Assert.assertEquals(bf.getBrowser(Browsers.chromiumBrowser).getID(), Browsers.chromiumBrowser); + Assert.assertEquals(bf.getBrowser(Browsers.googleChrome).getID(), Browsers.googleChrome); + Assert.assertEquals(bf.getBrowser(Browsers.firefox).getID(), Browsers.firefox); + Assert.assertEquals(bf.getBrowser(Browsers.opera).getID(), Browsers.opera); + Assert.assertEquals(bf.getBrowser(Browsers.epiphany).getID(), Browsers.epiphany); + Assert.assertEquals(bf.getBrowser(Browsers.midori).getID(), Browsers.midori); + } + + private void testBrowser(Browser browser) throws IOException { + File f1 = null; + if (browser.getDefaultPluginExpectedLocation() != null) { + f1 = new File(browser.getDefaultPluginExpectedLocation()); + } + File f2 = null; + if (browser.getUserDefaultPluginExpectedLocation() != null) { + f2 = new File(browser.getUserDefaultPluginExpectedLocation()); + } + if (f1 != null) { + Assert.assertTrue("browser's plugins location should exist " + f1.toString() + " for " + browser.getID().toString(), f1.exists()); + } + if (f2 != null) { + Assert.assertTrue("browser's users-plugins location should exist " + f2.toString() + " for " + browser.getID().toString(), f2.exists()); + } + + File[] ff1 = new File[0]; + if (f1 != null) { + ff1 = f1.listFiles(); + } + + File[] ff2 = new File[0]; + if (f2 != null) { + ff2 = f2.listFiles(); + } + + Assert.assertTrue("at least one of browser's plugins directory should contains at least one file didn't. For " + browser.getID().toString(), ff1.length + ff2.length > 0); + + ff1 = new File[0]; + if (f1 != null) { + ff1 = f1.listFiles(new FileFilter() { + + @Override + public boolean accept(File pathname) { + return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); + } + }); + } + + ff2 = new File[0]; + if (f2 != null) { + ff2 = f2.listFiles(new FileFilter() { + + @Override + public boolean accept(File pathname) { + return (pathname.getName().equals(LinuxBrowser.DEFAULT_PLUGIN_NAME)); + } + }); + } + + Assert.assertTrue("browser's plugins directories should contains exactly one " + LinuxBrowser.DEFAULT_PLUGIN_NAME + ", but didnt for " + browser.getID().toString(), + ff1.length + ff2.length == 1); + String currentPath = server.getJavawsFile().getParentFile().getParentFile().getAbsolutePath(); + + File[] ff; + if (ff1.length == 1) { + ff = ff1; + } else { + ff = ff2; + } + String s = ServerAccess.getContentOfStream(new FileInputStream(ff[0]), "ASCII"); + Assert.assertTrue("browser's plugins shoud points to" + currentPath + ", but didnt", + s.contains(s)); + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java new file mode 100644 index 0000000..353d208 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java @@ -0,0 +1,828 @@ +/* ServerAccess.java +Copyright (C) 2011 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ +package net.sourceforge.jnlp; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import net.sourceforge.jnlp.browsertesting.Browser; +import net.sourceforge.jnlp.browsertesting.BrowserFactory; +import net.sourceforge.jnlp.browsertesting.Browsers; +import org.junit.Assert; + +/** + * + * This class provides access to virtual server and stuff around. + * It can find unoccupied port, start server, provides its singleton instantiation, lunch parallel instantiations, + * read location of installed (tested javaws) see javaws.build.bin java property, + * location of server www root on file system (see test.server.dir java property), + * stubs for lunching javaws and for locating resources and read resources. + * + * It can also execute processes with timeout (@see PROCESS_TIMEOUT) (used during lunching javaws) + * Some protected apis are exported because public classes in this package are put to be tested by makefile. + * + * There are included test cases which show some basic usages. + * + * + */ +public class ServerAccess { + + public static final long NANO_TIME_DELIMITER=1000000l; + /** + * java property which value containing path to default (makefile by) directory with deployed resources + */ + public static final String TEST_SERVER_DIR = "test.server.dir"; + /** + * java property which value containing path to installed (makefile by) javaws binary + */ + public static final String JAVAWS_BUILD_BIN = "javaws.build.bin"; + /** property to set the different then default browser + */ + public static final String USED_BROWSERS = "used.browsers"; + public static final String DEFAULT_LOCALHOST_NAME = "localhost"; + /** + * server instance singleton + */ + private static ServerLauncher server; + /** + * inner version of engine + */ + private static final String version = "5"; + /** + * timeout to read 'remote' resources + * This can be changed in runtime, but will affect all following tasks + */ + public static int READ_TIMEOUT = 1000; + /** + * timeout in ms to let process to finish, before assassin will kill it. + * This can be changed in runtime, but will affect all following tasks + */ + public static long PROCESS_TIMEOUT = 20 * 1000;//ms + /** + * all terminated processes are stored here. As wee need to 'wait' to termination to be finished. + */ + static Set terminated = new HashSet(); + /** + * this flag is indicating whether output of executeProcess should be logged. By default true. + */ + public static boolean PROCESS_LOG = true; + public static boolean LOGS_REPRINT = false; + + private Browser currentBrowser; + public static final String UNSET_BROWSER="unset_browser"; + + /** + * main method of this class prints out random free port + * or runs server + * param "port" prints out the port + * nothing or number will run server on random(or on number specified) + * port in -Dtest.server.dir + */ + public static void main(String[] args) throws Exception { + if (args.length > 0 && args[0].equalsIgnoreCase("port")) { + int i = findFreePort(); + System.out.println(i); + System.exit(0); + } else { + int port = 44321; + if (args.length > 0) { + port=new Integer(args[0]); + } + getIndependentInstance(port); + while (true) { + Thread.sleep(1000); + } + + } + } + + /** + * utility method to find random free port + * + * @return - found random free port + * @throws IOException - if socket can't be opened or no free port exists + */ + public static int findFreePort() + throws IOException { + ServerSocket findPortTestingSocket = new ServerSocket(0); + int port = findPortTestingSocket.getLocalPort(); + findPortTestingSocket.close(); + return port; + } + public static final String HEADLES_OPTION="-headless"; + + /** + * we would like to have an singleton instance ASAP + */ + public ServerAccess() { + + getInstance(); + + + } + + /** + * + * @return cached instance. If none, then creates new + */ + public static ServerLauncher getInstance() { + if (server == null) { + server = getIndependentInstance(); + } + return server; + } + + /** + * + * @return new not cached iserver instance on random port, + * useful for testing application loading from different url then base + */ + public static ServerLauncher getIndependentInstance() { + return getIndependentInstance(true); + } + public static ServerLauncher getIndependentInstance(boolean daemon) { + String dir = (System.getProperty(TEST_SERVER_DIR)); + try{ + return getIndependentInstance(dir, findFreePort(),daemon); + }catch (Exception ex){ + throw new RuntimeException(ex); + } + } + + + /** + * + * @return new not cached iserver instance on random port, + * useful for testing application loading from different url then base + */ + + public static ServerLauncher getIndependentInstance(int port) { + return getIndependentInstance(port, true); + } + public static ServerLauncher getIndependentInstance(int port,boolean daemon) { + String dir = (System.getProperty(TEST_SERVER_DIR)); + return getIndependentInstance(dir,port,daemon); + } + + /** + * + * @return new not cached iserver instance on random port upon custom www root directory, + * useful for testing application loading from different url then base + */ + + public static ServerLauncher getIndependentInstance(String dir, int port) { + return getIndependentInstance(dir, port, true); + } + public static ServerLauncher getIndependentInstance(String dir, int port,boolean daemon) { + + + if (dir == null || dir.trim().length() == 0 || !new File(dir).exists() || !new File(dir).isDirectory()) { + throw new RuntimeException("test.server.dir property must be set to valid directory!"); + } + try { + ServerLauncher lServerLuncher = new ServerLauncher(port, new File(dir)); + Thread r=new Thread(lServerLuncher); + r.setDaemon(daemon); + r.start(); + return lServerLuncher; + } catch (Exception ex) { + throw new RuntimeException(ex); + } + + } + + /** + * + * @return - value passed inside as javaws binary location. See JAVAWS_BUILD_BIN + */ + public String getJavawsLocation() { + return System.getProperty(JAVAWS_BUILD_BIN); + } + + /** + * + * @return - bianry from where to lunch current browser + */ + public String getBrowserLocation() { + if (this.currentBrowser==null) return UNSET_BROWSER; + return this.currentBrowser.getBin(); + } + + public List getBrowserParams() { + if (this.currentBrowser==null) return null; + List l1=this.currentBrowser.getComaptibilitySwitches(); + List l2=this.currentBrowser.getDefaultSwitches(); + List l= new ArrayList(); + if (l1!=null)l.addAll(l1); + if (l2!=null)l.addAll(l2); + return l; + + } + + public Browsers getCurrentBrowsers() { + if (currentBrowser==null) return null; + return currentBrowser.getID(); + } + public Browser getCurrentBrowser() { + return currentBrowser; + } + + public void setCurrentBrowser(Browsers currentBrowser) { + this.currentBrowser = BrowserFactory.getFactory().getBrowser(currentBrowser); + if (this.currentBrowser == null) { + LoggingBottleneck.getDefaultLoggingBottleneck().setLoggedBrowser(UNSET_BROWSER); + } else { + LoggingBottleneck.getDefaultLoggingBottleneck().setLoggedBrowser(this.currentBrowser.getID().toString()); + } + } + + public void setCurrentBrowser(Browser currentBrowser) { + this.currentBrowser = currentBrowser; + if (this.currentBrowser == null) { + LoggingBottleneck.getDefaultLoggingBottleneck().setLoggedBrowser(UNSET_BROWSER); + } else { + LoggingBottleneck.getDefaultLoggingBottleneck().setLoggedBrowser(this.currentBrowser.getID().toString()); + } + } + + + + /** + * + * @return - value passed inside as javaws binary location as file. See JAVAWS_BUILD_BIN + */ + public File getJavawsFile() { + return new File(System.getProperty(JAVAWS_BUILD_BIN)); + } + + /** + * + * @return port on which is running cached server. If non singleton instance is running, new is created. + */ + public int getPort() { + if (server == null) { + getInstance(); + } + //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); + return server.getPort(); + + } + + /** + * + * @return directory upon which is running cached server. If non singleton instance is running, new is created. + */ + public File getDir() { + if (server == null) { + getInstance(); + } + // if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); + return server.getDir(); + } + + /** + * + * @return url pointing to cached server resource. If non singleton instance is running, new is created. + */ + public URL getUrl(String resource) throws MalformedURLException { + if (server == null) { + getInstance(); + } + //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); + return server.getUrl(resource); + } + + /** + * + * @return url pointing to cached server . If non singleton instance is running, new is created. + */ + public URL getUrl() throws MalformedURLException { + return getUrl(""); + + } + + /** + * + * @return whether cached server is alive. If non singleton instance is running, new is created. + */ + public boolean isRunning() { + if (server == null) { + getInstance(); + } + //if (!server.isRunning()) throw new RuntimeException("Server mysteriously died"); + return server.isRunning(); + + } + + /** + * Return resource from cached server + * + * @param resource to be located on cached server + * @return individual bytes of resource + * @throws IOException if connection can't be established or resource does not exist + */ + public ByteArrayOutputStream getResourceAsBytes(String resource) throws IOException { + return getResourceAsBytes(getUrl(resource)); + } + + /** + * Return resource from cached server + * + * @param resource to be located on cached server + * @return string constructed from resource + * @throws IOException if connection can't be established or resource does not exist + */ + public String getResourceAsString(String resource) throws IOException { + return getResourceAsString(getUrl(resource)); + } + + /** + * utility method which can read bytes of any stream + * + * @param input stream to be read + * @return individual bytes of resource + * @throws IOException if connection can't be established or resource does not exist + */ + public static ByteArrayOutputStream getBytesFromStream(InputStream is) throws IOException { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + int nRead; + byte[] data = new byte[16384]; + while ((nRead = is.read(data, 0, data.length)) != -1) { + buffer.write(data, 0, nRead); + } + buffer.flush(); + return buffer; + } + + /** + * utility method which can read from any stream as one long String + * + * @param input stream + * @return stream as string + * @throws IOException if connection can't be established or resource does not exist + */ + public static String getContentOfStream(InputStream is,String encoding) throws IOException { + try { + BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); + StringBuilder sb = new StringBuilder(); + while (true) { + String s = br.readLine(); + if (s == null) { + break; + } + sb.append(s).append("\n"); + + } + return sb.toString(); + } finally { + is.close(); + } + + } + + /** + * utility method which can read from any stream as one long String + * + * @param input stream + * @return stream as string + * @throws IOException if connection can't be established or resource does not exist + */ + public static String getContentOfStream(InputStream is) throws IOException { + return getContentOfStream(is, "UTF-8"); + + } + + /** + * utility method which can read bytes of resource from any url + * + * @param resource to be located on any url + * @return individual bytes of resource + * @throws IOException if connection can't be established or resource does not exist + */ + public static ByteArrayOutputStream getResourceAsBytes(URL u) throws IOException { + HttpURLConnection connection = (HttpURLConnection) u.openConnection(); + connection = (HttpURLConnection) u.openConnection(); + connection.setRequestMethod("GET"); + connection.setDoOutput(true); + connection.setReadTimeout(READ_TIMEOUT); + connection.connect(); + return getBytesFromStream(connection.getInputStream()); + + } + + /** + * utility method which can read string of resource from any url + * + * @param resource to be located on any url + * @return resource as string + * @throws IOException if connection can't be established or resource does not exist + */ + public static String getResourceAsString(URL u) throws IOException { + HttpURLConnection connection = (HttpURLConnection) u.openConnection(); + connection = (HttpURLConnection) u.openConnection(); + connection.setRequestMethod("GET"); + connection.setDoOutput(true); + connection.setReadTimeout(READ_TIMEOUT); + connection.connect(); + return getContentOfStream(connection.getInputStream()); + } + + /** + * helping dummy method to save String as file + * + * @param content + * @param f + * @throws IOException + */ + public static void saveFile(String content, File f) throws IOException { + saveFile(content, f, "utf-8"); + } + public static void saveFile(String content, File f,String encoding) throws IOException { + Writer output = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),encoding)); + output.write(content); + output.flush(); + output.close(); + } + + /** + * wrapping method to executeProcess (eg: javaws -headless http://localhost:port/resource) + * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) + * with parameter -headless (no gui, no asking) + * @param resource name of resource + * @return result what left after running this process + * @throws Exception + */ + public ProcessResult executeJavawsHeadless(String resource) throws Exception { + return executeJavawsHeadless(null, resource); + } + public ProcessResult executeJavawsHeadless(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeJavawsHeadless(null, resource,stdoutl,stderrl); + } + + /** + * wrapping method to executeProcess (eg: javaws arg arg -headless http://localhost:port/resource) + * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) + * with parameter -headless (no gui, no asking) + * @param resource name of resource + * @param otherargs other arguments to be added to headless one + * @return result what left after running this process + * @throws Exception + */ + public ProcessResult executeJavawsHeadless(List otherargs, String resource) throws Exception { + return executeJavawsHeadless(otherargs, resource,null,null); + } + public ProcessResult executeJavawsHeadless(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + if (otherargs == null) { + otherargs = new ArrayList(1); + } + List headlesList = new ArrayList(otherargs); + headlesList.add(HEADLES_OPTION); + return executeJavaws(headlesList, resource,stdoutl,stderrl); + } + + + /** + * wrapping method to executeProcess (eg: javaws http://localhost:port/resource) + * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance()) + * @param resource name of resource + * @return result what left after running this process + * @throws Exception + */ + public ProcessResult executeJavaws(String resource) throws Exception { + return executeJavaws(null, resource); + } + public ProcessResult executeJavaws(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeJavaws(null, resource,stdoutl,stderrl); + } + public ProcessResult executeBrowser(String resource) throws Exception { + return executeBrowser(getBrowserParams(), resource); + } + public ProcessResult executeBrowser(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeBrowser(getBrowserParams(), resource,stderrl,stdoutl); + } + + /** + * wrapping method to executeProcess (eg: javaws arg arg http://localhost:port/resource) + * will execute default javaws (@see JAVAWS_BUILD_BIN) upon default url upon cached server (@see SERVER_NAME @see getPort(), @see getInstance())) + * @param resource name of resource + * @param otherargs other arguments to be added + * @return result what left after running this process + * @throws Exception + */ + public ProcessResult executeJavaws(List otherargs, String resource) throws Exception { + return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource)); + } + public ProcessResult executeJavaws(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeProcessUponURL(getJavawsLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); + } + + public ProcessResult executeBrowser(List otherargs, String resource) throws Exception { + return executeProcessUponURL(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource)); + } + public ProcessResult executeBrowser(List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeProcessUponURL(getBrowserLocation(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); + } + + public ProcessResult executeBrowser(Browser b,List otherargs, String resource) throws Exception { + return executeProcessUponURL(b.getBin(), otherargs, getUrlUponThisInstance(resource)); + } + public ProcessResult executeBrowser(Browser b,List otherargs, String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeProcessUponURL(b.getBin(), otherargs, getUrlUponThisInstance(resource),stdoutl,stderrl); + } + + /** + * Ctreate resource on http, on 'localhost' on port on which this instance is running + * @param resource + * @return + * @throws MalformedURLException + */ + public URL getUrlUponThisInstance(String resource) throws MalformedURLException { + if (!resource.startsWith("/")) { + resource = "/" + resource; + } + return new URL("http", server.getServerName(), getPort(), resource); + } + + /** + * wrapping method to executeProcess (eg: javaws arg arg arg url) + * will execute default javaws (@see JAVAWS_BUILD_BIN) upon any server + * @param u url of resource upon any server + * @param javaws arguments + * @return result what left after running this process + * @throws Exception + */ + public ProcessResult executeJavawsUponUrl(List otherargs, URL u) throws Exception { + return executeProcessUponURL(getJavawsLocation(), otherargs, u); + } + public ProcessResult executeJavawsUponUrl(List otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeProcessUponURL(getJavawsLocation(), otherargs, u,stdoutl,stderrl); + } + + /** + * wrapping utility method to executeProcess (eg: any_binary arg arg arg url) + * + * will execute any process upon url upon any server + * @param u url of resource upon any server + * @param javaws arguments + * @return result what left after running this process + * @throws Exception + */ + public static ProcessResult executeProcessUponURL(String toBeExecuted, List otherargs, URL u) throws Exception { + return executeProcessUponURL(toBeExecuted, otherargs, u,null,null); + } + + public static ProcessResult executeProcessUponURL(String toBeExecuted, List otherargs, URL u,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + Assert.assertNotNull(u); + Assert.assertNotNull(toBeExecuted); + Assert.assertTrue(toBeExecuted.trim().length() > 1); + if (otherargs == null) { + otherargs = new ArrayList(1); + } + List urledArgs = new ArrayList(otherargs); + urledArgs.add(0, toBeExecuted); + urledArgs.add(u.toString()); + return executeProcess(urledArgs, stdoutl, stderrl); + } + + public static ProcessResult executeProcess(final List args) throws Exception { + return executeProcess(args, null); + } + public static ProcessResult executeProcess(final List args,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { + return executeProcess(args, null,stdoutl,stderrl); + } + /** + * utility method to lunch process, get its stdout/stderr, its return value and to kill it if running to long (@see PROCESS_TIMEOUT) + * + * + * Small bacground: + * This method creates thread inside which exec will be executed. Then creates assassin thread with given timeout to kill the previously created thread if necessary. + * Starts assassin thread, starts process thread. Wait until process is running, then starts content readers. + * Closes input of process. + * Wait until process is running (no matter if it terminate itself (correctly or badly), or is terminated by its assassin. + * Construct result from readed stdout, stderr, process return value, assassin successfully + * + * @param args binary with args to be executed + * @param dir optional, directory where this process will run + * @return what left from process - process itself, its stdout, stderr and return value and whether it was terminated by assassin. + * @throws Exception + */ + public static ProcessResult executeProcess(final List args,File dir) throws Exception { + return executeProcess(args, dir, null, null); + } + + private static String createConnectionMessage(ThreadedProcess t) { + return "Connecting " + t.getCommandLine(); + } + + /** + * Proceed message s to logging with request to reprint to System.err + * @param s + */ + public static void logErrorReprint(String s) { + log(s, false, true); + } + + /** + * Proceed message s to logging with request to reprint to System.out + * @param s + */ + public static void logOutputReprint(String s) { + log(s, true, false); + } + + /** + * Proceed message s to logging withhout request to reprint + * @param s + */ + public static void logNoReprint(String s) { + log(s, false, false); + } + + private static void log(String message, boolean printToOut, boolean printToErr) { + String idded; + StackTraceElement ste = getTestMethod(); + String fullId = ste.getClassName() + "." + ste.getMethodName(); + fullId = LoggingBottleneck.getDefaultLoggingBottleneck().modifyMethodWithForBrowser(ste.getMethodName(), ste.getClassName()); + if (message.contains("\n")) { + idded = fullId + ": \n" + message + "\n" + fullId + " ---"; + } else { + idded = fullId + ": " + message; + + } + if (LOGS_REPRINT) { + if (printToOut) { + System.out.println(idded); + } + if (printToErr) { + System.err.println(idded); + } + } + LoggingBottleneck.getDefaultLoggingBottleneck().logIntoPlaintextLog(idded, printToOut,printToErr); + LoggingBottleneck.getDefaultLoggingBottleneck().addToXmlLog(message,printToOut,printToErr,ste); + } + + public static void logException(Throwable t){ + logException(t, true); + } + public static void logException(Throwable t, boolean print){ + try{ + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + log(sw.toString(), false, print); + pw.close(); + sw.close(); + }catch(Exception ex){ + throw new RuntimeException(ex); + } + } + + private static StackTraceElement getTestMethod() { + return getTestMethod(Thread.currentThread().getStackTrace()); + } + + private static StackTraceElement getTestMethod(StackTraceElement[] stack) { + //0 is always thread + //1 is net.sourceforge.jnlp.ServerAccess + StackTraceElement result = stack[1]; + String baseClass = stack[1].getClassName(); + int i = 2; + for (; i < stack.length; i++) { + result = stack[i];//at least moving up + if(stack[i].getClassName().contains("$")){ + continue; + } + if (!baseClass.equals(stack[i].getClassName())) { + break; + } + } + //if nothing left in stack then we have been in ServerAccess already + //so the target method is the highest form it and better to return it + //rather then die to ArrayOutOfBounds + if(i >= stack.length){ + return result; + } + //now we are out of net.sourceforge.jnlp.ServerAccess + //method we need (the test) is highest from following class + baseClass = stack[i].getClassName(); + for (; i < stack.length; i++) { + if(stack[i].getClassName().contains("$")){ + continue; + } + if (!baseClass.equals(stack[i].getClassName())) { + break; + } + result = stack[i]; + } + + return result; + } + + public static ProcessResult executeProcess(final List args, File dir, ContentReaderListener stdoutl, ContentReaderListener stderrl) throws Exception { + ThreadedProcess t = new ThreadedProcess(args, dir); + if (PROCESS_LOG) { + String connectionMesaage = createConnectionMessage(t); + log(connectionMesaage, true, true); + } + ProcessAssasin pa = new ProcessAssasin(t, PROCESS_TIMEOUT); + pa.start(); + t.start(); + while (t.getP() == null && t.deadlyException == null) { + Thread.sleep(100); + } + if (t.deadlyException != null) { + pa.setCanRun(false); + return new ProcessResult("", "", null, true, Integer.MIN_VALUE, t.deadlyException); + } + ContentReader crs = new ContentReader(t.getP().getInputStream(),stdoutl); + ContentReader cre = new ContentReader(t.getP().getErrorStream(),stderrl); + + OutputStream out = t.getP().getOutputStream(); + if (out != null) { + out.close(); + } + + new Thread(crs).start(); + new Thread(cre).start(); + while (t.isRunning()) { + Thread.sleep(100); + } + + while (!t.isDestoyed()) { + Thread.sleep(100); + } + pa.setCanRun(false); + // ServerAccess.logOutputReprint(t.getP().exitValue()); when process is killed, this throws exception + + ProcessResult pr=new ProcessResult(crs.getContent(), cre.getContent(), t.getP(), pa.wasTerminated(), t.getExitCode(), null); + if (PROCESS_LOG) { + log(pr.stdout, true, false); + log(pr.stderr, false, true); + } + return pr; + } + + /** + * this is temprary solution until refactoring is fully done + * Use net.sourceforge.jnlp.ProcessResult instead + */ + @Deprecated + public static class ProcessResult extends net.sourceforge.jnlp.ProcessResult { + + public ProcessResult(String stdout, String stderr, Process process, boolean wasTerminated, Integer r, Throwable deadlyException) { + super(stdout, stderr, process, wasTerminated, r, deadlyException); + } + } + } diff --git a/tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java b/tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java new file mode 100644 index 0000000..92634cc --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerLauncher.java @@ -0,0 +1,120 @@ +/* ServerLauncher.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.URL; + +/** + * wrapper around tiny http server to separate lunch configurations and servers. + * to allow terminations and stuff around. + */ +public class ServerLauncher implements Runnable { + + /** + * default url name part. + * This can be changed in runtime, but will affect all following tasks upon those server + */ + private String serverName = ServerAccess.DEFAULT_LOCALHOST_NAME; + private boolean running; + private final Integer port; + private final File dir; + + public String getServerName() { + return serverName; + } + + public void setServerName(String serverName) { + this.serverName = serverName; + } + + public ServerLauncher(Integer port, File dir) { + this.port = port; + this.dir = dir; + System.err.println("port: " + port); + System.err.println("dir: " + dir); + } + + public boolean isRunning() { + return running; + } + + public Integer getPort() { + return port; + } + + public File getDir() { + return dir; + } + + public ServerLauncher(File dir) { + this(8181, dir); + } + + public ServerLauncher(Integer port) { + this(port, new File(System.getProperty("user.dir"))); + } + + public ServerLauncher() { + this(8181, new File(System.getProperty("user.dir"))); + } + + public void run() { + running = true; + try { + ServerSocket s = new ServerSocket(port); + while (running) { + new TinyHttpdImpl(s.accept(), dir, port); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + running = false; + } + } + + public URL getUrl(String resource) throws MalformedURLException { + return new URL("http", getServerName(), getPort(), resource); + } + + public URL getUrl() throws MalformedURLException { + return getUrl(""); + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/TestsLogs.java b/tests/test-extensions/net/sourceforge/jnlp/TestsLogs.java new file mode 100644 index 0000000..3277dfe --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/TestsLogs.java @@ -0,0 +1,85 @@ +/* TestsLogs.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.util.LinkedList; +import java.util.List; + +class TestsLogs { + + public final List outs = new LinkedList(); + public final List errs = new LinkedList(); + public final List all = new LinkedList(); + private static final String LOG_ELEMENT = "log"; + private static final String LOG_ID_ATTRIBUTE = "id"; + + synchronized void add(boolean err, boolean out, String text) { + if (text == null) { + text = "null"; + } + LogItem li = new LogItem(text); + if (out) { + outs.add(li); + } + if (err) { + errs.add(li); + } + all.add(li); + + } + + @Override + public String toString() { + StringBuilder sb = listToStringBuilder(outs, "out"); + sb.append(listToStringBuilder(errs, "err")); + sb.append(listToStringBuilder(all, "all")); + return sb.toString(); + } + + private StringBuilder listToStringBuilder(List l, String id) { + StringBuilder sb = new StringBuilder(); + sb.append("<" + LOG_ELEMENT + " " + LOG_ID_ATTRIBUTE + "=\"").append(id).append("\">\n"); + int i = 0; + for (LogItem logItem : l) { + i++; + sb.append(logItem.toStringBuilder(i)); + } + sb.append("\n"); + return sb; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java new file mode 100644 index 0000000..c37d842 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/ThreadedProcess.java @@ -0,0 +1,140 @@ +/* ThreadedProcess.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.io.File; +import java.util.List; + +/** + * + * wrapper around Runtime.getRuntime().exec(...) which ensures that process is run inside its own, by us controlled, thread. + * Process builder caused some unexpected and weird behavior :/ + */ +class ThreadedProcess extends Thread { + + Process p = null; + List args; + Integer exitCode; + Boolean running; + File dir; + Throwable deadlyException = null; + /* + * before removing this "useless" variable + * check DeadLockTestTest.testDeadLockTestTerminated2 + */ + private boolean destoyed = false; + + public boolean isDestoyed() { + return destoyed; + } + + public void setDestoyed(boolean destoyed) { + this.destoyed = destoyed; + } + + public Boolean isRunning() { + return running; + } + + public Integer getExitCode() { + return exitCode; + } + + public ThreadedProcess(List args) { + this.args = args; + } + + public ThreadedProcess(List args, File dir) { + this.args = args; + this.dir = dir; + } + + public String getCommandLine() { + String commandLine = "unknown command"; + try { + if (args != null && args.size() > 0) { + commandLine = ""; + for (String string : args) { + commandLine = commandLine + " " + string; + } + } + } catch (Exception ex) { + ex.printStackTrace(); + } finally { + return commandLine; + } + } + + public Process getP() { + return p; + } + + @Override + public void run() { + try { + running = true; + Runtime r = Runtime.getRuntime(); + if (dir == null) { + p = r.exec(args.toArray(new String[0])); + } else { + p = r.exec(args.toArray(new String[0]), new String[0], dir); + } + try { + exitCode = p.waitFor(); + Thread.sleep(500); //this is giving to fast done proecesses's e/o readers time to read all. I would like to know better solution :-/ + } finally { + destoyed = true; + } + } catch (Exception ex) { + if (ex instanceof InterruptedException) { + //add to the set of terminated threaded processes + deadlyException = ex; + ServerAccess.logException(deadlyException, false); + ServerAccess.terminated.add(this); + } else { + //happens when non-existing process is launched, is causing p null! + ServerAccess.terminated.add(this); + deadlyException = ex; + ServerAccess.logException(deadlyException, false); + throw new RuntimeException(ex); + } + } finally { + running = false; + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java b/tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java new file mode 100644 index 0000000..34870ab --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/TinyHttpdImpl.java @@ -0,0 +1,174 @@ +/* TinyHttpdImpl.java +Copyright (C) 2011,2012 Red Hat, Inc. + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 2. + +IcedTea is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + */ + +package net.sourceforge.jnlp; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.net.Socket; +import java.net.SocketException; +import java.net.URLDecoder; +import java.util.StringTokenizer; + +/** + * based on http://www.mcwalter.org/technology/java/httpd/tiny/index.html + * Very small implementation of http return headers for our served resources + * Originally Licenced under GPLv2.0 + * + * When resource starts with XslowX prefix, then resouce (without XslowX) + * is returned, but its delivery is delayed + */ +class TinyHttpdImpl extends Thread { + + Socket c; + private final File dir; + private final int port; + private boolean canRun = true; + private static final String XSX = "/XslowX"; + + public TinyHttpdImpl(Socket s, File f, int port) { + c = s; + this.dir = f; + this.port = port; + start(); + } + + public void setCanRun(boolean canRun) { + this.canRun = canRun; + } + + public int getPort() { + return port; + } + + @Override + public void run() { + try { + BufferedReader i = new BufferedReader(new InputStreamReader(c.getInputStream())); + DataOutputStream o = new DataOutputStream(c.getOutputStream()); + try { + while (canRun) { + String s = i.readLine(); + if (s.length() < 1) { + break; + } + if (s.startsWith("GET")) { + StringTokenizer t = new StringTokenizer(s, " "); + t.nextToken(); + String op = t.nextToken(); + String p = op; + if (p.startsWith(XSX)) { + p = p.replace(XSX, "/"); + } + ServerAccess.logNoReprint("Getting: " + p); + p = URLDecoder.decode(p, "UTF-8"); + ServerAccess.logNoReprint("Serving: " + p); + p = (".".concat((p.endsWith("/")) ? p.concat("index.html") : p)).replace('/', File.separatorChar); + File pp = new File(dir, p); + int l = (int) pp.length(); + byte[] b = new byte[l]; + FileInputStream f = new FileInputStream(pp); + f.read(b); + String content = ""; + String ct = "Content-Type: "; + if (p.toLowerCase().endsWith(".jnlp")) { + content = ct + "application/x-java-jnlp-file\n"; + } else if (p.toLowerCase().endsWith(".html")) { + content = ct + "text/html\n"; + } else if (p.toLowerCase().endsWith(".jar")) { + content = ct + "application/x-jar\n"; + } + o.writeBytes("HTTP/1.0 200 OK\nConten" + "t-Length:" + l + "\n" + content + "\n"); + if (op.startsWith(XSX)) { + byte[][] bb = splitArray(b, 10); + for (int j = 0; j < bb.length; j++) { + Thread.sleep(2000); + byte[] bs = bb[j]; + o.write(bs, 0, bs.length); + } + } else { + o.write(b, 0, l); + } + } + } + } catch (SocketException e) { + ServerAccess.logException(e, false); + } catch (Exception e) { + o.writeBytes("HTTP/1.0 404 ERROR\n\n\n"); + ServerAccess.logException(e, false); + } + o.close(); + } catch (Exception e) { + ServerAccess.logException(e, false); + } + } + + /** + * This function splits input array to severasl pieces + * from byte[length] splitt to n pieces s is retrunrd byte[n][length/n], except + * last piece which contains length%n + * + * @param input - array to be splitted + * @param pieces - to how many pieces it should be broken + * @return inidividual pices of original array, which concatet again givs original array + */ + public static byte[][] splitArray(byte[] input, int pieces) { + int rest = input.length; + int rowLength = rest / pieces; + if (rest % pieces > 0) { + rowLength++; + } + if (pieces * rowLength >= rest + rowLength) { + pieces--; + } + int i = 0, j = 0; + byte[][] array = new byte[pieces][]; + array[0] = new byte[rowLength]; + for (byte b : input) { + if (i >= rowLength) { + i = 0; + array[++j] = new byte[Math.min(rowLength, rest)]; + } + array[j][i++] = b; + rest--; + } + return array; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/annotations/Bug.java b/tests/test-extensions/net/sourceforge/jnlp/annotations/Bug.java new file mode 100644 index 0000000..ac157d9 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/annotations/Bug.java @@ -0,0 +1,32 @@ +package net.sourceforge.jnlp.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * When declare for suite class or for Test-marked method, + * should be interpreted by report generating tool to links. + * Known shortcuts are + * SX - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=X + * PRX - http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=X + * RHX - https://bugzilla.redhat.com/show_bug.cgi?id=X + * DX - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=X + * GX - http://bugs.gentoo.org/show_bug.cgi?id=X + * CAX - http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id=X + * LPX - https://bugs.launchpad.net/bugs/X + * + * http://mail.openjdk.java.net/pipermail/distro-pkg-dev/ + * and http://mail.openjdk.java.net/pipermail/ are proceed differently + * You just put eg @Bug(id="RH12345",id="http:/my.bukpage.com/terribleNew") + * and RH12345 will be transalated as + *
123456 or + * similar, the url will be inclueded as is. Both added to proper tests or suites + * + */ +@Target({ElementType.METHOD,ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Bug { + public String[] id(); +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java b/tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java new file mode 100644 index 0000000..e7c2464 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/annotations/KnownToFail.java @@ -0,0 +1,24 @@ +package net.sourceforge.jnlp.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + *

+ * This annotation marks a test as a known failure (as opposed to a + * regression). A test that is a known failure will not hold of a release, + * nor should developers hold off a fix if they run the unit tests and a + * test marked as a known failure fails. + *

+ * This annotation is meant for adding tests for bugs before the fix is + * implemented. + *

+ */ + +@Target({ElementType.METHOD,ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface KnownToFail { + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/annotations/NeedsDisplay.java b/tests/test-extensions/net/sourceforge/jnlp/annotations/NeedsDisplay.java new file mode 100644 index 0000000..e8b9d49 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/annotations/NeedsDisplay.java @@ -0,0 +1,18 @@ + +package net.sourceforge.jnlp.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation should be declared for each test which requires DISPALY defined. + * If no display is defined, then those test will not be run + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface NeedsDisplay { + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/annotations/TestInBrowsers.java b/tests/test-extensions/net/sourceforge/jnlp/annotations/TestInBrowsers.java new file mode 100644 index 0000000..b4ea2a3 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/annotations/TestInBrowsers.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package net.sourceforge.jnlp.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import net.sourceforge.jnlp.browsertesting.Browsers; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface TestInBrowsers { + public Browsers[] testIn(); +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browser.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browser.java new file mode 100644 index 0000000..81db960 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browser.java @@ -0,0 +1,19 @@ +package net.sourceforge.jnlp.browsertesting; + +import java.util.List; + +/** + * interface which represents individual browsers + */ +public interface Browser { + public String getDefaultBin(); + public String getDefaultPluginExpectedLocation(); + public String getBin(); + //public void setBin(String bin); + public String getUserDefaultPluginExpectedLocation(); + public Browsers getID(); + public List getComaptibilitySwitches(); + public List getDefaultSwitches(); + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserFactory.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserFactory.java new file mode 100644 index 0000000..7171afc --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserFactory.java @@ -0,0 +1,189 @@ +package net.sourceforge.jnlp.browsertesting; + +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import net.sourceforge.jnlp.ServerAccess; +import net.sourceforge.jnlp.browsertesting.browsers.Chrome; +import net.sourceforge.jnlp.browsertesting.browsers.Chromium; +import net.sourceforge.jnlp.browsertesting.browsers.Epiphany; +import net.sourceforge.jnlp.browsertesting.browsers.Firefox; +import net.sourceforge.jnlp.browsertesting.browsers.Midory; +import net.sourceforge.jnlp.browsertesting.browsers.Opera; + +public class BrowserFactory { + + private static final BrowserFactory factory = new BrowserFactory(System.getProperty(ServerAccess.USED_BROWSERS)); + private List configuredBrowsers; + Random oneGenerator = new Random(); + + public static BrowserFactory getFactory() { + return factory; + } + + /** + * This is public just for testing purposes! + */ + public BrowserFactory(String browsers) { + if (browsers == null) { + configuredBrowsers = new ArrayList(0); + } else { + String[] s = browsers.split(File.pathSeparator); + configuredBrowsers = new ArrayList(s.length); + for (int i = 0; i < s.length; i++) { + String string = s[i]; + String[] p = string.split("/"); + if (p.length > 1) { + string = p[p.length - 1]; + } + if (string.equals(Browsers.chromiumBrowser.toString())) { + configuredBrowsers.add(new Chromium(s[i])); + } + if (string.equals(Browsers.googleChrome.toString())) { + configuredBrowsers.add(new Chrome(s[i])); + } + if (string.equals(Browsers.opera.toString())) { + configuredBrowsers.add(new Opera(s[i])); + } + if (string.equals(Browsers.firefox.toString())) { + configuredBrowsers.add(new Firefox(s[i])); + } + if (string.equals(Browsers.epiphany.toString())) { + configuredBrowsers.add(new Epiphany(s[i])); + } + if (string.equals(Browsers.midori.toString())) { + configuredBrowsers.add(new Midory(s[i])); + } + } + } + + } + + public Browser getBrowser(Browsers id) { + for (int i = 0; i < configuredBrowsers.size(); i++) { + Browser browser = configuredBrowsers.get(i); + if (browser.getID() == id) { + return browser; + } + + } + return null; + + } + + public Browser getFirst() { + for (int i = 0; i < configuredBrowsers.size(); i++) { + Browser browser = configuredBrowsers.get(i); + return browser; + + } + return null; + + } + + public Browser getRandom() { + if (configuredBrowsers.isEmpty()){ + return null; + } + return configuredBrowsers.get(oneGenerator.nextInt(configuredBrowsers.size())); + } + + public List getAllBrowsers() { + return Collections.unmodifiableList(configuredBrowsers); + } + + public List getBrowsers(TestInBrowsers tib) { + return getBrowsers(tib.testIn()); + } + public List getBrowsers(Browsers[] testIn) { + List q = translateAnnotationSilently(testIn); + if (q==null || q.isEmpty()){ + List qq = new ArrayList(0); + qq.add(Browsers.none); + return qq; + } + List qq = new ArrayList(q.size()); + for (Browser browser : q) { + qq.add(browser.getID()); + } + return qq; + + } + /** + * + * @param testIn Bbrowsers which should be transformed to list of Browser + * @return all matching browser, if browser do not exists, this is ignored and run is silently continued + */ + public List translateAnnotationSilently(Browsers[] testIn) { + if (testIn==null) { + return null; + } + List r = new ArrayList(configuredBrowsers.size()); + for (Browsers b : testIn) { + if (b == Browsers.all) { + if (getAllBrowsers().isEmpty()) { + ServerAccess.logErrorReprint("You try to add all browsers, but there is none"); + } else { + r.addAll(getAllBrowsers()); + } + } else if (b == Browsers.one) { + Browser bb = getRandom(); + if (bb == null) { + ServerAccess.logErrorReprint("You try to add random browser, but there is none"); + } else { + r.add(bb); + } + } else { + Browser bb = getBrowser(b); + if (bb == null) { + ServerAccess.logErrorReprint("You try to add " + b.toString() + " browser, but it do not exists"); + } else { + r.add(bb); + } + + } + } + + return r; + + } + + /** + * + * @param tib + * @return all matching browser, if browser do not exists, exception is thrown + */ + public List translateAnnotationLaudly(TestInBrowsers tib) { + return translateAnnotationLaudly(tib.testIn()); + } + public List translateAnnotationLaudly(Browsers[] testIn) { + List r = new ArrayList(configuredBrowsers.size()); + for (Browsers b :testIn) { + if (b == Browsers.all) { + if (getAllBrowsers().isEmpty()) { + throw new IllegalStateException("You try to add all browsers, but there is none"); + } + r.addAll(getAllBrowsers()); + } else if (b == Browsers.one) { + Browser bb = getRandom(); + if (bb == null) { + throw new IllegalStateException("You try to add random browser, but there is none"); + } + r.add(bb); + } else { + Browser bb = getBrowser(b); + if (bb == null) { + throw new IllegalStateException("You try to add " + b.toString() + " browser, but it do not exists"); + } + r.add(bb); + + } + } + + return r; + + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTest.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTest.java new file mode 100644 index 0000000..232b63a --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTest.java @@ -0,0 +1,23 @@ +package net.sourceforge.jnlp.browsertesting; + +import net.sourceforge.jnlp.ServerAccess; +import org.junit.runner.RunWith; + + +@RunWith(value = BrowserTestRunner.class) +public abstract class BrowserTest { + + public static Browsers browser=null; + public static final ServerAccess server = new ServerAccess(); + + public static void setBrowser(Browsers b) { + browser = b; + server.setCurrentBrowser(browser); + } + + public static Browsers getBrowser() { + return browser; + } + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java new file mode 100644 index 0000000..36350e8 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/BrowserTestRunner.java @@ -0,0 +1,148 @@ +package net.sourceforge.jnlp.browsertesting; + +import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; +import net.sourceforge.jnlp.annotations.TestInBrowsers; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import net.sourceforge.jnlp.ServerAccess; +import org.junit.Ignore; +import org.junit.internal.AssumptionViolatedException; +import org.junit.internal.runners.model.EachTestNotifier; +import org.junit.runner.Description; +import org.junit.runner.notification.RunNotifier; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.FrameworkMethod; +import org.junit.runners.model.InitializationError; +import org.junit.runners.model.Statement; + +public class BrowserTestRunner extends BlockJUnit4ClassRunner { + + public BrowserTestRunner(java.lang.Class testClass) throws InitializationError { + super(testClass); + } + + @Override + protected void runChild(FrameworkMethod method, RunNotifier notifier) { + Method mm = method.getMethod(); + TestInBrowsers tib = mm.getAnnotation(TestInBrowsers.class); + injectBrowserCatched(method, Browsers.none); + boolean browserIgnoration = false; + if (tib != null) { + try { + List testableBrowsers = BrowserFactory.getFactory().getBrowsers(tib); + String mbr = System.getProperty("modified.browsers.run"); + if (mbr != null) { + if (mbr.equalsIgnoreCase("all")) { + if (!isBrowsersNoneSet(tib)) { + testableBrowsers = BrowserFactory.getFactory().getBrowsers(new Browsers[]{Browsers.all}); + } + } else if (mbr.equalsIgnoreCase("one")) { + //this complication here is for case like + // namely enumerated concrete browsers, so we want to pick up + // random one from those already enumerated + if (isBrowsersNoneSet(tib)) { + testableBrowsers = Arrays.asList(new Browsers[]{testableBrowsers.get(new Random().nextInt(testableBrowsers.size()))}); + } + } else if (mbr.equalsIgnoreCase("ignore")) { + testableBrowsers = BrowserFactory.getFactory().getBrowsers(new Browsers[]{Browsers.none}); + browserIgnoration = true; + } else { + ServerAccess.logErrorReprint("unrecognized value of modified.browsers.run - " + mbr); + } + } + for (Browsers browser : testableBrowsers) { + try { + injcetBrowser(method, browser); + runChildX(method, notifier, browser, browserIgnoration); + } catch (Exception ex) { + //throw new RuntimeException("unabled to inject browser", ex); + ServerAccess.logException(ex, true); + } + } + } finally { + injectBrowserCatched(method, Browsers.none); + } + } else { + runChildX(method, notifier, null, false); + } + } + + private boolean isBrowsersNoneSet(TestInBrowsers tib) { + if (tib.testIn().length == 1 && tib.testIn()[0] == Browsers.none) { + return true; + } + return false; + } + + private void injectBrowserCatched(FrameworkMethod method, Browsers browser) { + try { + injcetBrowser(method, browser); + } catch (Exception ex) { + //throw new RuntimeException("unabled to inject browser", ex); + ServerAccess.logException(ex, true); + } + } + + private void injcetBrowser(FrameworkMethod method, Browsers browser) throws IllegalAccessException, SecurityException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException { + Method ff = method.getMethod().getDeclaringClass().getMethod("setBrowser", Browsers.class); + ff.invoke(null, browser); + } + + protected void runChildX(final FrameworkMethod method, RunNotifier notifier, Browsers browser, boolean browserIgnoration) { + Description description = describeChild(method, browser); + if (method.getAnnotation(Ignore.class) != null) { + notifier.fireTestIgnored(description); + } else { + try { + runLeaf(methodBlock(method), description, notifier, browserIgnoration); +// ServerAccess.logOutputReprint("trying leaf"); +// Method m = this.getClass().getMethod("runLeaf", Statement.class, Description.class, RunNotifier.class); +// m.setAccessible(true); +// m.invoke(this, methodBlock(method), description, notifier); +// ServerAccess.logOutputReprint("leaf invoked"); + } catch (Exception ex) { + //throw new RuntimeException("unabled to lunch test on leaf", ex); + ServerAccess.logException(ex, true); + } + } + } + + /** + * Runs a {@link Statement} that represents a leaf (aka atomic) test. + */ + protected final void runLeaf(Statement statement, Description description, + RunNotifier notifier, boolean ignore) { + EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description); + eachNotifier.fireTestStarted(); + if (ignore) { + eachNotifier.fireTestIgnored(); + return; + } + try { + statement.evaluate(); + } catch (AssumptionViolatedException e) { + eachNotifier.addFailedAssumption(e); + } catch (Throwable e) { + eachNotifier.addFailure(e); + } finally { + eachNotifier.fireTestFinished(); + } + } + + protected Description describeChild(FrameworkMethod method, Browsers browser) { + if (browser == null) { + return super.describeChild(method); + } else { + try { + return Description.createTestDescription(getTestClass().getJavaClass(), + testName(method) + " - " + browser.toString(), method.getAnnotations()); + } catch (Exception ex) { + ServerAccess.logException(ex, true); + return super.describeChild(method); + } + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browsers.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browsers.java new file mode 100644 index 0000000..8d85241 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/Browsers.java @@ -0,0 +1,46 @@ +package net.sourceforge.jnlp.browsertesting; + +/** + * When all represent all configured browser, one represens one random + * (the first found) configured browser. Each other represents inidivdual browsers + * + */ +public enum Browsers { + + none, all, one, opera, googleChrome, chromiumBrowser, firefox, midori,epiphany; + + public String toExec() { + switch (this) { + case opera: + return "opera"; + case googleChrome: + return "google-chrome"; + case chromiumBrowser: + return "chromium-browser"; + case firefox: + return "firefox"; + case midori: + return "midori"; + case epiphany: + return "epiphany"; + default: + return null; + + } + } + + @Override + public String toString() { + if (toExec()!=null) return toExec(); + switch (this) { + case all: + return "all"; + case one: + return "one"; + case none: + return "unset_browser"; + default: return "unknown"; + + } + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java new file mode 100644 index 0000000..2668d65 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chrome.java @@ -0,0 +1,15 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Chrome extends MozillaFamilyLinuxBrowser { + + public Chrome(String bin) { + super(bin); + } + + @Override + public Browsers getID() { + return Browsers.googleChrome; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java new file mode 100644 index 0000000..616d38a --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Chromium.java @@ -0,0 +1,15 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Chromium extends MozillaFamilyLinuxBrowser { + + public Chromium(String bin) { + super(bin); + } + + @Override + public Browsers getID() { + return Browsers.chromiumBrowser; + } +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java new file mode 100644 index 0000000..3adc3d8 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Epiphany.java @@ -0,0 +1,18 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Epiphany extends MozillaFamilyLinuxBrowser { + + public Epiphany(String bin) { + super(bin); + } + + @Override + public Browsers getID() { + return Browsers.epiphany; + } + + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java new file mode 100644 index 0000000..8458bce --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Firefox.java @@ -0,0 +1,29 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Firefox extends MozillaFamilyLinuxBrowser { + + public Firefox(String bin) { + super(bin); + } + + String[] cs={"-no-remote", "-new-tab"}; + + @Override + public Browsers getID() { + return Browsers.firefox; + } + + @Override + public List getComaptibilitySwitches() { + return Arrays.asList(cs); + } + + + + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java new file mode 100644 index 0000000..edc95e0 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/LinuxBrowser.java @@ -0,0 +1,60 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import net.sourceforge.jnlp.browsertesting.Browser; + + +public abstract class LinuxBrowser implements Browser{ + public static final String DEFAULT_PLUGIN_NAME="libjavaplugin.so"; + public static final String DEFAULT_BIN_PATH="/usr/bin/"; + + protected final String bin; + protected String fsdir="unknown"; + + public LinuxBrowser(String bin) { + this.bin = bin; + } + + + + @Override + public String getBin() { + return bin; + } + +// @Override +// public void setBin(String bin) { +// this.bin=bin; +// } + + @Override + public String getDefaultBin() { + return DEFAULT_BIN_PATH+getID().toExec(); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Browser)) return false; + Browser b=(Browser) obj; + return b.getBin().equals(getBin()); + } + + @Override + public int hashCode() { + int hash = 5; + hash = 59 * hash + (this.bin != null ? this.bin.hashCode() : 0); + return hash; + } + + @Override + public String getDefaultPluginExpectedLocation() { + if (System.getProperty("os.arch").contains("64")) { + return "/usr/lib64/"+fsdir+"/plugins"; + } else { + return "/usr/lib/"+fsdir+"/plugins"; + + } + } + + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Midory.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Midory.java new file mode 100644 index 0000000..fc563fb --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Midory.java @@ -0,0 +1,18 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Midory extends MozillaFamilyLinuxBrowser { + + public Midory(String bin) { + super(bin); + } + + @Override + public Browsers getID() { + return Browsers.midori; + } + + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java new file mode 100644 index 0000000..c8d1e85 --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/MozillaFamilyLinuxBrowser.java @@ -0,0 +1,29 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import java.util.List; + +public abstract class MozillaFamilyLinuxBrowser extends LinuxBrowser{ + + public MozillaFamilyLinuxBrowser(String bin) { + super(bin); + fsdir="mozilla"; + } + + + @Override + public List getComaptibilitySwitches() { + return null; + } + + @Override + public List getDefaultSwitches() { + return null; + } + + @Override + public String getUserDefaultPluginExpectedLocation() { + return System.getProperty("user.home")+"/.mozilla/plugins"; + } + + +} diff --git a/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Opera.java b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Opera.java new file mode 100644 index 0000000..edbf57f --- /dev/null +++ b/tests/test-extensions/net/sourceforge/jnlp/browsertesting/browsers/Opera.java @@ -0,0 +1,37 @@ +package net.sourceforge.jnlp.browsertesting.browsers; + +import java.util.Arrays; +import java.util.List; +import net.sourceforge.jnlp.browsertesting.Browsers; + +public class Opera extends LinuxBrowser { + + public Opera(String bin) { + super(bin); + fsdir="opera"; + } + + @Override + public Browsers getID() { + return Browsers.opera; + } + + @Override + public String getUserDefaultPluginExpectedLocation() { + return null; + } + + + String[] cs={"-nosession", "-nomail", "-nolirc", "-newtab"}; + + @Override + public List getComaptibilitySwitches() { + return Arrays.asList(cs); + } + + @Override + public List getDefaultSwitches() { + return null; + } + +} \ No newline at end of file -- cgit v1.2.3