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-8292067 Convert test/sun/management/jmxremote/bootstrap shell tests to java version #9973

Closed
wants to merge 4 commits into from

Conversation

bwhuang-us
Copy link
Contributor

@bwhuang-us bwhuang-us commented Aug 22, 2022

This task convert 3 shell tests below to java version.
test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh
test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh


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-8292067: Convert test/sun/management/jmxremote/bootstrap shell tests to java version

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9973

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 22, 2022

👋 Welcome back bwhuang-us! 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 Aug 22, 2022
@openjdk
Copy link

openjdk bot commented Aug 22, 2022

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

  • jmx
  • serviceability

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 serviceability serviceability-dev@openjdk.org jmx jmx-dev@openjdk.org labels Aug 22, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 22, 2022

Webrevs

@bwhuang-us
Copy link
Contributor Author

@lmesnik Could you please review this PR?

static final String DEST_SSL = DEST + SEP + "ssl";
static final String TEST_SRC = "@TEST-SRC@";

static final boolean isWindows = System.getProperty("os.name").contains(
Copy link
Member

Choose a reason for hiding this comment

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

Check Platform.java.

}

static String getDefaultFileName(String basename) {
final StringBuffer defaultFileName =
Copy link
Member

Choose a reason for hiding this comment

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

Why don't just create
final String = System.getProperty(.._) + SEP + .... + basename;
or even make static final variable like defaultFileNamePrefix = ... and
return defaultFileNamePrefix + basename;

* @return ${JRE}/conf/management/${basename}
**/
static String getDefaultStoreName(String basename) {
final StringBuffer defaultFileName =
Copy link
Member

Choose a reason for hiding this comment

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

the same as previous

import java.util.HashMap;
import java.util.Map;
import java.util.Enumeration;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

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

wildcards in import are not welcome, please avoid them
not needed to replace existing, just don't introduce them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I didn't introduce this intentionally. It was automatically rearranged by IntelliJ. I will find out a way to disable that feature.

for (final Iterator i=names.iterator(); i.hasNext(); ) {
ObjectName name = (ObjectName)i.next();
log.trace("listMBeans","Got MBean: "+name);
final Set names = server.queryNames(pattern, query);
Copy link
Member

Choose a reason for hiding this comment

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

Since you change these lines, might add template parameters here?
Set names = ...
and simplify if it is possible.
Not a request, just a proposal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I didn't make changes to these lines. They were done by the IDEA auto formatter. I can simplify it and add template parameters.

public static void main(String args[]) throws Exception {
if (args.length == 0) {
throw new IllegalArgumentException("Argument is required for this" +
" test");
Copy link
Member

Choose a reason for hiding this comment

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

not needed to split lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The IDEA splits the lines for a line-length limit of 80 characters. Do I need to change that?

}
}
System.err.println("Cannot find a free port after " + MAX_GET_FREE_PORT_TRIES + " tries");
return "Failed: cannot find a free port after " + MAX_GET_FREE_PORT_TRIES + " tries";
System.err.println(
Copy link
Member

Choose a reason for hiding this comment

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

I think that the previous indentation was good enough. No need to change it.

* @return null if the test succeeds, an error message otherwise.
**/
private String testConfigurationKo(File conf) throws InterruptedException, IOException {
private String testConfigurationKo(File conf)
throws InterruptedException, IOException {
String errStr = null;
errStr = testConfiguration(conf);
Copy link
Member

Choose a reason for hiding this comment

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

Merge with errStr = null ?

if (isWindows) {
Utils.replaceFilesString(propertyFiles,
(s) -> s.replace(TEST_SRC, DEST)
.replaceAll("[/\\\\]", "\\\\\\\\"));
Copy link
Member

Choose a reason for hiding this comment

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

Could you please comment this replacement.

if (!thisEntry.principal().getName().contains("NULL SID")
&& thisEntry.type() != AclEntryType.ALLOW) {
if (!thisEntry.principal().getName().contains("NULL SID") &&
thisEntry.type() != AclEntryType.ALLOW) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the previous indentation was correct. We put "&&", "+" and "." in the beginning of next line usually.

FileInputStream fin = new FileInputStream(passwordFileName);
try {pws.load(fin);}finally{fin.close();}
for (Enumeration en=pws.propertyNames();en.hasMoreElements();) {
try {
Copy link
Member

Choose a reason for hiding this comment

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

You could use try with resources.

@openjdk
Copy link

openjdk bot commented Aug 30, 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:

8292067: Convert test/sun/management/jmxremote/bootstrap shell tests to java version

Reviewed-by: lmesnik

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 247 new commits pushed to the master branch:

  • 83a3408: 8293315: Add back logging for Placeholders
  • b6477fd: 8293288: bootcycle build failure after JDK-8173605
  • 0c6094e: 8293188: x86_64: Introduce stubGenerator_x86_64.hpp
  • 2baeebb: 8293006: sun/tools/jhsdb/JStackStressTest.java fails with "UnalignedAddressException: 8baadbabe"
  • da99e3e: 8289400: Improve com/sun/jdi/TestScaffold error reporting
  • 77e21c5: 8290529: C2: assert(BoolTest(btest).is_canonical()) failure
  • fcc0cf9: 8292375: Convert ProtectionDomainCacheTable to ResourceHashtable
  • 6fc58b8: 8293207: Add assert to JVM_ReferenceRefersTo to clarify its API
  • ce06a3b: 8293023: Change CardTable::is_in_young signature
  • 26cac08: 8293209: Parallel: Remove unused variables in PSParallelCompact::invoke
  • ... and 237 more: https://git.openjdk.org/jdk/compare/00decca46a77ea9390081655b069008aacfea525...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 (@lmesnik) 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 Aug 30, 2022
@bwhuang-us
Copy link
Contributor Author

/integrate

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

openjdk bot commented Aug 30, 2022

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

@lmesnik
Copy link
Member

lmesnik commented Sep 2, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 2, 2022

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

  • 83a3408: 8293315: Add back logging for Placeholders
  • b6477fd: 8293288: bootcycle build failure after JDK-8173605
  • 0c6094e: 8293188: x86_64: Introduce stubGenerator_x86_64.hpp
  • 2baeebb: 8293006: sun/tools/jhsdb/JStackStressTest.java fails with "UnalignedAddressException: 8baadbabe"
  • da99e3e: 8289400: Improve com/sun/jdi/TestScaffold error reporting
  • 77e21c5: 8290529: C2: assert(BoolTest(btest).is_canonical()) failure
  • fcc0cf9: 8292375: Convert ProtectionDomainCacheTable to ResourceHashtable
  • 6fc58b8: 8293207: Add assert to JVM_ReferenceRefersTo to clarify its API
  • ce06a3b: 8293023: Change CardTable::is_in_young signature
  • 26cac08: 8293209: Parallel: Remove unused variables in PSParallelCompact::invoke
  • ... and 237 more: https://git.openjdk.org/jdk/compare/00decca46a77ea9390081655b069008aacfea525...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 2, 2022
@openjdk openjdk bot closed this Sep 2, 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 Sep 2, 2022
@openjdk
Copy link

openjdk bot commented Sep 2, 2022

@lmesnik @bwhuang-us Pushed as commit 3993a1f.

💡 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-8292067 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
integrated Pull request has been integrated jmx jmx-dev@openjdk.org serviceability serviceability-dev@openjdk.org
2 participants