From 1e0ca48079a284fa7153da64950d35cdd8b22fd3 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Thu, 13 Jun 2013 10:00:00 +0800 Subject: [PATCH] 8015274: TEST_BUG: Step2: After selecting 'View Warning Log', it is empty instead of FileNotFound 8015276: TEST_BUG: The 'ptool.test' can't be saved in the 'tmp' folder 8016158: Instruction is not clear on how to use keytool to create JKS store in case Reviewed-by: mullan --- .../sun/security/tools/policytool/Alias.sh | 5 ++ .../security/tools/policytool/ChangeUI.html | 9 ++- .../sun/security/tools/policytool/ChangeUI.sh | 7 +- .../security/tools/policytool/OpenPolicy.sh | 5 ++ .../sun/security/tools/policytool/SaveAs.sh | 5 ++ .../tools/policytool/UpdatePermissions.html | 17 ++--- .../tools/policytool/UpdatePermissions.sh | 6 ++ .../security/tools/policytool/UsePolicy.sh | 5 ++ .../sun/security/tools/policytool/i18n.html | 73 ++++++++++--------- .../sun/security/tools/policytool/i18n.sh | 23 +++++- 10 files changed, 105 insertions(+), 50 deletions(-) diff --git a/jdk/test/sun/security/tools/policytool/Alias.sh b/jdk/test/sun/security/tools/policytool/Alias.sh index 4db8c09b42a..ae1e4082004 100644 --- a/jdk/test/sun/security/tools/policytool/Alias.sh +++ b/jdk/test/sun/security/tools/policytool/Alias.sh @@ -52,6 +52,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" diff --git a/jdk/test/sun/security/tools/policytool/ChangeUI.html b/jdk/test/sun/security/tools/policytool/ChangeUI.html index d025716ea03..da22d7b8cf8 100644 --- a/jdk/test/sun/security/tools/policytool/ChangeUI.html +++ b/jdk/test/sun/security/tools/policytool/ChangeUI.html @@ -17,7 +17,8 @@ reading these instructions.

First, policytool will be invoked.

    -
  1. If testing on Windows, create a temporary directory. (Example: C:\foo\tmp) +
  2. Find (or create) a temporary directory that you have write access to. +(Example: 'C:\foo\tmp' on Windows or '/tmp' on other systems)
  3. Add new policy entry
  4. Add permission:
    @@ -63,9 +64,9 @@ First, policytool will be invoked.

  5. Confirm there are 2 entries in the permission list
  6. Press cancel
  7. Save as "/tmp/p"
    -If testing on Windows, save in the temporary directory created in Step 0. -(Example: Save as "C:\foo\tmp\p.policy") -
  8. Confirm that the file /tmp/p (or C:\foo\tmp\p.policy) looks like +(Or use the temporary directory mentioned in Step 0 if it's not '/tmp'. + For example, "C:\foo\tmp\p" on Windows) +
  9. Confirm that the file created in the previous step looks like
     /* AUTOMATICALLY GENERATED ON Tue Jul 19 16:27:30 CST 2005*/
     /* DO NOT EDIT */
    diff --git a/jdk/test/sun/security/tools/policytool/ChangeUI.sh b/jdk/test/sun/security/tools/policytool/ChangeUI.sh
    index 95e25af1227..1b6a7984087 100644
    --- a/jdk/test/sun/security/tools/policytool/ChangeUI.sh
    +++ b/jdk/test/sun/security/tools/policytool/ChangeUI.sh
    @@ -22,7 +22,7 @@
     #
     
     # @test
    -# @bug  6296772 6293981 6290216
    +# @bug  6296772 6293981 6290216 8015276
     # @summary FilePermission and DelegationPermission, and cancel button
     #
     # @run applet/manual=done ChangeUI.html
    @@ -51,6 +51,11 @@ case "$OS" in
         PS=":"
         FS="/"
         ;;
    +  CYGWIN* )
    +    NULL=/dev/null
    +    PS=";"
    +    FS="/"
    +    ;;
       Windows* )
         NULL=NUL
         PS=";"
    diff --git a/jdk/test/sun/security/tools/policytool/OpenPolicy.sh b/jdk/test/sun/security/tools/policytool/OpenPolicy.sh
    index 5aca3324661..325b817c3d2 100644
    --- a/jdk/test/sun/security/tools/policytool/OpenPolicy.sh
    +++ b/jdk/test/sun/security/tools/policytool/OpenPolicy.sh
    @@ -51,6 +51,11 @@ case "$OS" in
         PS=":"
         FS="/"
         ;;
    +  CYGWIN* )
    +    NULL=/dev/null
    +    PS=";"
    +    FS="/"
    +    ;;
       Windows* )
         NULL=NUL
         PS=";"
    diff --git a/jdk/test/sun/security/tools/policytool/SaveAs.sh b/jdk/test/sun/security/tools/policytool/SaveAs.sh
    index 661ebd99a3e..af18ad96c21 100644
    --- a/jdk/test/sun/security/tools/policytool/SaveAs.sh
    +++ b/jdk/test/sun/security/tools/policytool/SaveAs.sh
    @@ -52,6 +52,11 @@ case "$OS" in
         PS=":"
         FS="/"
         ;;
    +  CYGWIN* )
    +    NULL=/dev/null
    +    PS=";"
    +    FS="/"
    +    ;;
       Windows* )
         NULL=NUL
         PS=";"
    diff --git a/jdk/test/sun/security/tools/policytool/UpdatePermissions.html b/jdk/test/sun/security/tools/policytool/UpdatePermissions.html
    index 2a59b5908ae..31e6fcf7fc3 100644
    --- a/jdk/test/sun/security/tools/policytool/UpdatePermissions.html
    +++ b/jdk/test/sun/security/tools/policytool/UpdatePermissions.html
    @@ -10,8 +10,8 @@ reading these instructions.

    First, policytool will be invoked.

    Then, follow these steps:
    -0) If testing on Windows, create a temporary directory. -(Example: C:\foo\tmp)

    +0) Find (or create) a temporary directory that you have write access to. +(Example: 'C:\foo\tmp' on Windows or '/tmp' on other systems)

    1) Click on the "Add Policy Entry" button in the main policytool window.

    @@ -32,13 +32,10 @@ select "Save As".

    8) In the SaveAs window, enter "/tmp/ptool.test" as the file name and click "OK".
    -If testing on Windows, use the temporary directory created in Step 0. -(Example: Save as "C:\foo\tmp\ptool.test")

    - -9) cat /tmp/ptool.test
    -If testing on Windows, check the contents of the file created in the previous -step.

    +(Or use the temporary directory mentioned in Step 0 if it's not '/tmp'. +For example, "C:\foo\tmp\ptool.test" on Windows)

    +9) Check the content of the file created in the previous step

    10) check to make sure that the new entry is in the policy file.

    @@ -53,8 +50,8 @@ step.

    In the confirmation dialog pop-up, click "OK".

    -Exit policytool. If testing on Windows, delete the temporary directory and its -contents created during this test.

    +Exit policytool. Delete the files created during this test. If the +temporary directory is also newly created, empty and delete it.

    Press "Pass" if ... press "Fail" otherwise.

    diff --git a/jdk/test/sun/security/tools/policytool/UpdatePermissions.sh b/jdk/test/sun/security/tools/policytool/UpdatePermissions.sh index eada9d734cd..05978a38b57 100644 --- a/jdk/test/sun/security/tools/policytool/UpdatePermissions.sh +++ b/jdk/test/sun/security/tools/policytool/UpdatePermissions.sh @@ -23,6 +23,7 @@ # @test # @bug 4218206 +# @bug 8015276 # @summary missing or invalid permission target names in policy tool # # @run applet/manual=done UpdatePermissions.html @@ -51,6 +52,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" diff --git a/jdk/test/sun/security/tools/policytool/UsePolicy.sh b/jdk/test/sun/security/tools/policytool/UsePolicy.sh index 3422f2cfc15..c8412389a3b 100644 --- a/jdk/test/sun/security/tools/policytool/UsePolicy.sh +++ b/jdk/test/sun/security/tools/policytool/UsePolicy.sh @@ -51,6 +51,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" diff --git a/jdk/test/sun/security/tools/policytool/i18n.html b/jdk/test/sun/security/tools/policytool/i18n.html index 6c70d24398c..b358c50d2d9 100644 --- a/jdk/test/sun/security/tools/policytool/i18n.html +++ b/jdk/test/sun/security/tools/policytool/i18n.html @@ -15,10 +15,15 @@ If at any time an exception is thrown, or if any message is incomprehensible, then the test failed. Otherwise, the test passed.

    +Preparation: Find (or create) a temporary directory that you have write +access to (Example: 'C:\tmp' on Windows or '/tmp' on other systems) and copy +the files "ks", "good", "bad" from the scratch sub-directory of this test's +working directory (the -w argument of jtreg) into the temporary directory. +If 'policy1' or 'policy2' already exists in this directory, remove it. +

    Press "Pass" if ... press "Fail" otherwise.

    -

      -
    1. If testing on Windows, create a temporary directory. (Example: C:\foo\tmp) +
      1. Pull down the 'File' and 'KeyStore' menus and check values
      2. Pull down 'File' menu and select 'View Warning Log'. Confirm FileNotFound.
      3. Pull down 'File' menu and select 'New'. @@ -46,65 +51,65 @@ Press "Pass" if ... press "Fail" otherwise.
      4. Select "play" from Target menu.
      5. Click OK, confirm changed permission.
      6. Type "hello" for 'CodeBase', click on 'Done', and check error message +
      7. Clean up the 'CodeBase' textbox
      8. Type "hello" for 'SignedBy', click on 'Done', and check warning message -
      9. Click, on 'Edit Policy Entry' and 'Remove Policy Entry' +
      10. Click on 'Edit Policy Entry' and 'Remove Policy Entry' and check error messages -
      11. Select policy entry, click on 'Edit Policy Entry', and check pop-up window +
      12. Select policy entry, click on 'Edit Policy Entry', check pop-up window and close it
      13. Select policy entry, click on 'Remove Policy Entry', and check pop-up window
      14. Do not remove the entry, click 'Cancel'.
      15. Pull down 'File' menu and select 'Exit'. Confirm Save option. Click 'Cancel'. -
      16. Select 'File' menu value 'Save' and enter "/tmp/policy1" as the filename.
        - If testing on Windows, use the temporary directory created in Step 0. - (Example: Save as "C:\foo\tmp\policy1")
        - Check status message. +
      17. Select 'File' menu value 'Save' and save into file "policy1" in the + temporary directory. Check status message.
      18. Select 'File' menu value 'New'
      19. Click 'Add Policy Entry', type in "hello" for 'SignedBy' field, click 'Done'. Confirm warning.
      20. Select 'File' menu value 'Open' and confirm save option - (do not save changes) -
      21. Type "/tmp/policy1" (if Windows, "C:\foo\tmp\policy1") for the filename - and confirm warning message
        + (Click 'Cancel', do not save changes)
      22. Pull down 'File' menu, select 'View Warning Log' and confirm KeyStore alias warning
      23. Pull down 'KeyStore' menu and select 'Edit' -
      24. Enter 'foo' as KeyStore URL and check error -
      25. Using keytool create JKS keystore -
      26. Enter KeyStore URL but leave other fields empty. Should succeed. +
      27. Enter 'foo' as KeyStore URL, click 'OK', and check error +
      28. Enter KeyStore URL "file:/tmp/ks" (Or use the temporary directory mentioned + in the preparation if it's not '/tmp'. For example, "file:/C:/tmp/ks" on Windows) + but leave other fields empty. Click 'OK'. Should succeed.
      29. Pull down 'KeyStore' menu and select 'Edit' -
      30. Confirm URL and Type values. -
      31. Enter 'foo' as the provider and check error message. -
      32. Enter 'SUN' as the provider. Should succeed. +
      33. Confirm URL and Type values. The Type should be "jks" +
      34. Enter 'foo' as the provider, click 'OK' and check error message. +
      35. Enter 'SUN' as the provider, click 'OK'. Should succeed.
      36. Pull down 'KeyStore' menu and select 'Edit'
      37. Confirm URL, Type, and Provider values. -
      38. Enter 'foo' as the password URL and check error message. -
      39. Enter URL with bad password and check error message. -
      40. Enter URL with good password. Should succeed. +
      41. Enter 'foo' as the password URL, click 'OK' and check error message. +
      42. Enter URL "file:/tmp/bad" (Or use the temporary directory mentioned in + the preparation if it's not '/tmp'. For example, "file:/C:/tmp/bad" on Windows), + click 'OK' and check error message. +
      43. Enter URL "file:/tmp/good" (Or use the temporary directory mentioned in + the preparation if it's not '/tmp'. For example, "file:/C:/tmp/good" on Windows) + and click 'OK'. Should succeed.
      44. Pull down 'KeyStore' menu and select 'Edit'
      45. Confirm URL, Type, Provider, and Password URL values.
      46. Click OK -
      47. Pull down 'File' menu and select 'Save As'. Enter "/tmp/policy2" - (if Windows, "C:\foo\tmp\policy2"). - Confirm status message.
        +
      48. Pull down 'File' menu and select 'Save As' and save into file "policy2" + in the temporary directory. Confirm status message.
      49. Pull down 'File' menu and select 'New'. -
      50. Pull down 'File' menu and select 'Open'. Enter "/tmp/policy2" - (if Windows, "C:\foo\tmp\policy2"). - Confirm warning message.
        +
      51. Pull down 'File' menu and select 'Open' and open "policy2" in the + temporary directory.
      52. Click on 'Add Policy Entry', enter Codebase 'http://foo', SignedBy 'bar'. Click on 'Done' and confirm alias warning.
      53. Double-Click on just created policy entry, confirm edit window appears. -
      54. Change SignedBy to an alias in previously created keystore. +
      55. Change SignedBy to an 'hello'.
      56. Click on Done and confirm it worked with no warning.
      57. Double-Click on "SignedBy hello" policy entry and confirm edit window appears.
      58. Click on Edit/Remove Principal, confirm errors.
      59. Click on 'Add Principal' and check new window.
      60. Click on 'OK' and confirm error message (no principal name) -
      61. Enter valid KeyStore alias as principal name, click OK and +
      62. Enter 'hello' as principal name, click OK and confirm status message.
      63. Confirm new principal in Principals list. -
      64. Click on 'Done' (creating policy entry), confirm alias warning. +
      65. Click on 'Done' (creating policy entry).
      66. View warning log and confirm X500Principal/KeyStore alias message.
      67. Confirm principal added to policy entry in main window listing.
      68. Double click on that entry. @@ -116,14 +121,14 @@ Press "Pass" if ... press "Fail" otherwise. Confirm name cleared. Type 'foo' as name. Click OK. Confirm error. type 'cn=foo' as name. Click OK. should succeed.
      69. Confirm changed principal in list. -
      70. Click on 'Add Permission', and add any FilePermission. -
      71. Click on 'Done' in Policy Entry window. Confirm alias warning. +
      72. Click on 'Add Permission', and add a FilePermission, choose a target and + an action. Click OK. +
      73. Click on 'Done' in Policy Entry window.
      74. Confirm entries in main window listing.
      75. Select 'File' menu value 'Exit'
      76. Save Changes, confirm status message. -
      77. If testing on Windows, delete the temporary directory and its contents - created during this test. -
      +
    2. Delete all files created during this test. If the temporary directory + is also newly created, empty and delete it.

    diff --git a/jdk/test/sun/security/tools/policytool/i18n.sh b/jdk/test/sun/security/tools/policytool/i18n.sh index 8537d48c708..58b59e060b2 100644 --- a/jdk/test/sun/security/tools/policytool/i18n.sh +++ b/jdk/test/sun/security/tools/policytool/i18n.sh @@ -23,10 +23,13 @@ # @test # @bug 4348370 +# @bug 8015274 +# @bug 8015276 +# @bug 8016158 # @summary policytool not i18n compliant # # @run applet/manual=done i18n.html -# @run shell i18n.sh +# @run shell/timeout=1200 i18n.sh # @run applet/manual=yesno i18n.html # set a few environment variables so that the shell-script can run stand-alone @@ -51,6 +54,11 @@ case "$OS" in PS=":" FS="/" ;; + CYGWIN* ) + NULL=/dev/null + PS=";" + FS="/" + ;; Windows* ) NULL=NUL PS=";" @@ -66,6 +74,19 @@ esac echo "HELLO!" +echo "Checking for $HOME/.java.policy" + +# 8015274 +if [ -e $HOME/.java.policy ]; then + echo "You have a .java.policy file in your HOME directory" + echo "The file must be removed before running this test" + exit 1 +fi + +${TESTJAVA}${FS}bin${FS}keytool -genkeypair -alias hello -dname CN=Hello \ + -storepass changeit -keypass changeit -keystore ks +echo changeit > good +echo badpass > bad ${TESTJAVA}${FS}bin${FS}policytool exit $?