Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8294994: Update Jarsigner and Keytool i18n tests to validate i18n compliance #10635

Closed
wants to merge 4 commits into from

Conversation

bwhuang-us
Copy link
Contributor

@bwhuang-us bwhuang-us commented Oct 10, 2022

The jarsigner and keytool are localized into English, German, Japanese and Simplified Chinese. This task is to modify the existing i18n tests to validate i18n compliance in these tools.

In addition, this task also contains changes for manual test enhancement and simplification which originated from JDK-8292663.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8294994: Update Jarsigner and Keytool i18n tests to validate i18n compliance

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10635/head:pull/10635
$ git checkout pull/10635

Update a local copy of the PR:
$ git checkout pull/10635
$ git pull https://git.openjdk.org/jdk pull/10635/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10635

View PR using the GUI difftool:
$ git pr show -t 10635

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10635.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 10, 2022

👋 Welcome back bhuang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 10, 2022
@openjdk
Copy link

openjdk bot commented Oct 10, 2022

@bwhuang-us The following labels will be automatically applied to this pull request:

  • core-libs
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added security security-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Oct 10, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 10, 2022

Webrevs

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Some minor suggestions.

Comment on lines 34 to 62
/*
* @test
* @bug 4348369 8076069 8294994
* @summary keytool i18n compliant
* @author charlie lai
* @modules java.base/sun.security.tools.keytool
* @library /test/lib
* @run main/manual/othervm i18n de
*/

/*
* @test
* @bug 4348369 8076069 8294994
* @summary keytool i18n compliant
* @author charlie lai
* @modules java.base/sun.security.tools.keytool
* @library /test/lib
* @run main/manual/othervm i18n ja
*/

/*
* @test
* @bug 4348369 8076069 8294994
* @summary keytool i18n compliant
* @author charlie lai
* @modules java.base/sun.security.tools.keytool
* @library /test/lib
* @run main/manual/othervm i18n zh CN
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to triplicate these @test tags? Would 3-lines of @run suffice?
Also setting the locale by -Duser.language/country and getProperty them in the main would be preferable to passing them as the test case arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can make a change to use the system property.
Regarding your first question, a test with multiple 'run' fails and terminates on the first test failure. So I would prefer to have multiple tests rather than multiple 'run' in a single test that it allows jtreg to run all the tests independently.

private volatile boolean aborted = false;
private Thread currentThread = null;

public static class DialogBuilder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a boilerplate for displaying the panel. Could this be separated from the test and converted into some library?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we can move this code to the library as there is no test code in it.

Comment on lines 330 to 334
if (args.length == 1) {
Locale.setDefault(Locale.of(args[0]));
} else if (args.length == 2) {
Locale.setDefault(Locale.of(args[0], args[1]));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be eliminated with the suggestion above.

} else if (args.length == 2) {
Locale.setDefault(Locale.of(args[0], args[1]));
}
final String LANG = Locale.getDefault().getDisplayLanguage();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of getDisplayLanguage(), it should issue getDisplayName(), as for zh-CN case, it simply displays Chinese in the current impl. It's ambiguous whether it is simplified or traditional.
Also, LANG should be lowercase, as it is not a constant.

@wangweij
Copy link
Contributor

I have a question, why must this test be manual? Can't we compare the localized texts?

@naotoj
Copy link
Member

naotoj commented Oct 11, 2022

I have a question, why must this test be manual? Can't we compare the localized texts?

Thought about that, but it could be a nuisance if we compared word-to-word translations, considering the situation if an engineer made some changes in the English resource bundle, but l10n may not come at the same time which is guaranteed to fail.

@bwhuang-us
Copy link
Contributor Author

I have a question, why must this test be manual? Can't we compare the localized texts?

@wangweij Good question. We can definitely compare the localized texts at least some keywords. The fact that automation is one of the goals of this task. In terms of localization, perhaps in our tests we can reuse the resource bundles implemented in these tools to turn english texts into localized texts.

@bwhuang-us
Copy link
Contributor Author

Hi @wangweij, I have a discussion with @naotoj about automating this test. Here is a summary.

  1. We can't hard code localized texts into the test and compare to the localized message form the tool. The main reason is mentioned above by @naotoj. Another reason is that localization sometimes may come in slightly different, correctness of translation is not the goal of this test.

  2. We can't do a word-to-word comparison. But even so, we can't rely on the same resource bundle used by the tools for localization validation. It provokes a risk that test may fail to detect any localization error in the tool as they use the same mechanism.

  3. It makes a bit more sense for this test being a manual test because it matches the look-and-feel criteria. With someone looking into the result, at least it can raise a flag if something doesn’t look right. And only engineers can do this.

Copy link
Member

@naotoj naotoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much better now. A minor comment on the library.

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TestUI {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect some class description for this library. Also, could the library name be more descriptive than "TestUI"?

@openjdk
Copy link

openjdk bot commented Oct 12, 2022

@bwhuang-us This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8294994: Update Jarsigner and Keytool i18n tests to validate i18n compliance

Reviewed-by: naoto

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 47 new commits pushed to the master branch:

  • 1961e81: 8289509: Improve test coverage for XPath Axes: descendant, descendant-or-self, following, following-sibling
  • 5699041: 8294772: Remove workaround in os::dll_address_to_library_name
  • d125265: 8277970: Test jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java fails with "tag mismatch"
  • 0475c34: 8292386: jvmti/thread/SuspendThread/suspendthrd03 failed with "FAIL: Status is 2"
  • 760a260: 8295213: Run GHA manually with user-specified make and configure arguments
  • 8402260: 8295198: Update more openjdk.java.net => openjdk.org URLs
  • c357b59: 8295211: Fix autoconf 2.71 warning "AC_CHECK_HEADERS: you should use literals"
  • 8607842: 8295205: Add jcheck whitespace checking for markdown files
  • cb62f1c: 8295218: New KeepAliveTest.java has invalid copyright notice
  • 9cf6651: 8294238: ZGC: Move CLD claimed mark clearing
  • ... and 37 more: https://git.openjdk.org/jdk/compare/4df4a1f8e238ebf49d4b0e1e102ccdc3cdb82de9...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@naotoj) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 12, 2022
@bwhuang-us
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 12, 2022
@openjdk
Copy link

openjdk bot commented Oct 12, 2022

@bwhuang-us
Your change (at version 4c08a3e) is now ready to be sponsored by a Committer.

@naotoj
Copy link
Member

naotoj commented Oct 12, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 12, 2022

Going to push as commit ac19414.
Since your change was applied there have been 47 commits pushed to the master branch:

  • 1961e81: 8289509: Improve test coverage for XPath Axes: descendant, descendant-or-self, following, following-sibling
  • 5699041: 8294772: Remove workaround in os::dll_address_to_library_name
  • d125265: 8277970: Test jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java fails with "tag mismatch"
  • 0475c34: 8292386: jvmti/thread/SuspendThread/suspendthrd03 failed with "FAIL: Status is 2"
  • 760a260: 8295213: Run GHA manually with user-specified make and configure arguments
  • 8402260: 8295198: Update more openjdk.java.net => openjdk.org URLs
  • c357b59: 8295211: Fix autoconf 2.71 warning "AC_CHECK_HEADERS: you should use literals"
  • 8607842: 8295205: Add jcheck whitespace checking for markdown files
  • cb62f1c: 8295218: New KeepAliveTest.java has invalid copyright notice
  • 9cf6651: 8294238: ZGC: Move CLD claimed mark clearing
  • ... and 37 more: https://git.openjdk.org/jdk/compare/4df4a1f8e238ebf49d4b0e1e102ccdc3cdb82de9...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 12, 2022
@openjdk openjdk bot closed this Oct 12, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Oct 12, 2022
@openjdk
Copy link

openjdk bot commented Oct 12, 2022

@naotoj @bwhuang-us Pushed as commit ac19414.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@bwhuang-us bwhuang-us deleted the JDK-8294994 branch March 1, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants