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

8289508: Improve test coverage for XPath Axes: ancestor, ancestor-or-self, preceding, and preceding-sibling #10211

Closed
wants to merge 11 commits into from

Conversation

Ruprabhu25
Copy link
Contributor

@Ruprabhu25 Ruprabhu25 commented Sep 8, 2022

Created two files for testing XPath Axes: XPathAncestors.java tests the ancestor and ancestor-or-self axes, while XPathPrecedingTest.java tests the preceding and preceding-sibling axes.


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-8289508: Improve test coverage for XPath Axes: ancestor, ancestor-or-self, preceding, and preceding-sibling

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10211

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

Using diff file

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

Ruprabhu25 and others added 6 commits September 2, 2022 00:13
…self, preceding, and preceding-sibling, separated tests and labeled testing between ancestor and preceding
Separated Ancestors and Preceding axes into two separate files for easier viewing and management.
@Ruprabhu25 Ruprabhu25 marked this pull request as ready for review September 8, 2022 06:21
@bridgekeeper
Copy link

bridgekeeper bot commented Sep 8, 2022

👋 Welcome back Ruprabhu25! 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
Copy link

openjdk bot commented Sep 8, 2022

⚠️ @Ruprabhu25 This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk
Copy link

openjdk bot commented Sep 8, 2022

@Ruprabhu25 The following label will be automatically applied to this pull request:

  • core-libs

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

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Sep 8, 2022
@rhalade
Copy link
Member

rhalade commented Sep 8, 2022

Please fix jcheck issues. Code has trailing whitespaces on several lines.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 8, 2022
@Ruprabhu25
Copy link
Contributor Author

@rhalade should be good for review now.

@mlbridge
Copy link

mlbridge bot commented Sep 8, 2022

Webrevs

@rhalade
Copy link
Member

rhalade commented Sep 12, 2022

@rhalade should be good for review now.

Thanks! Someone in core-libs team should do the final review and approval.

Copy link
Member

@JoeWang-Java JoeWang-Java left a comment

Choose a reason for hiding this comment

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

It would be nice to cover some of the assertions made in the spec, e.g.:
2.2 Axes
... if the context node is an attribute node or namespace node, the preceding-sibling axis is empty

3.3 Node-sets
...
NOTE: The meaning of a Predicate depends crucially on which axis applies.
For example, preceding::foo[1] returns the first foo element in reverse document order, because the axis that applies to the [1] predicate is the preceding axis; by contrast, (preceding::foo)[1] returns the first foo element in document order, because the axis that applies to the [1] predicate is the child axis.

5.7 Text Nodes
... a text node never has an immediately following or preceding sibling that is a text node

}

/*
* DataProvider:provides XPath expression using ancestor/ancestor-or-self and the expected node(s) from the expression
Copy link
Member

Choose a reason for hiding this comment

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

We still like to limit to about 80 characters (slightly longer is ok), easier for people who like the Sdiffs.

{"/store/book[1]/author/preceding::*", "//book[1]/title"},

// abbreviated text
{"//author/preceding::title", "//title"},
Copy link
Member

Choose a reason for hiding this comment

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

Note that both expressions return nodeset while the test calls for the 1st node. When performing node comparison, it would be good to select unique node.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 15, 2022
@openjdk-notifier
Copy link

@Ruprabhu25 Please do not rebase or force-push to an active PR as it invalidates existing review comments. All changes will be squashed into a single commit automatically when integrating. See OpenJDK Developers’ Guide for more information.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 15, 2022
@Ruprabhu25
Copy link
Contributor Author

@JoeWang-Java Added the tests you recommended, thanks for the suggestion.

Copy link
Member

@JoeWang-Java JoeWang-Java 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.

Note that if the editor you use is prone to add whitespaces, running the normalizer before commit would do the trick.

<author id="1"/>
<isbn>1234</isbn>
</book>
<book id="2" lang="en">
<title/>
<book id="2" lang="en" xlmns="www.foo.com">
Copy link
Member

Choose a reason for hiding this comment

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

typo: s/xlmns/xmlns. There's no namespace due to the typo. The test still passed since there's no namespace.

}

/*
* DataProvider: provides XPath expressions that return null
Copy link
Member

Choose a reason for hiding this comment

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

... expressions that return empty NodeSet.

Note that the test called to evaluate to a Node though the expressions themselves return an empty NodeSet.

* DataProvider: provides XPath expressions that return null
*/
@DataProvider(name = "noResults")
public Object[][] getNoResults() {
Copy link
Member

Choose a reason for hiding this comment

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

s/noResults/emptyNodeSet. Refer to the above, it's therefore not that it returns "no result" but the processor treats requesting Node on an empty NodeSet as null.

@Ruprabhu25
Copy link
Contributor Author

@JoeWang-Java The test names/descriptions have been updated and the namespace test works after correcting the typo.

Copy link
Member

@JoeWang-Java JoeWang-Java left a comment

Choose a reason for hiding this comment

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

Thanks for the update.

@openjdk
Copy link

openjdk bot commented Sep 19, 2022

⚠️ @Ruprabhu25 the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout 8289508
$ git commit --author='Preferred Full Name <you@example.com>' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

openjdk bot commented Sep 19, 2022

@Ruprabhu25 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:

8289508: Improve test coverage for XPath Axes: ancestor, ancestor-or-self, preceding, and preceding-sibling

Reviewed-by: joehw

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

  • 4020ed5: 8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure
  • 8ff2c26: 8293942: [JVMCI] data section entries must be 4-byte aligned on AArch64
  • 6e23b43: 8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux
  • 1f9ff41: 8292297: Fix up loading of override java.security properties file
  • 64b96e5: 8293811: Provide a reason for PassFailJFrame.forceFail
  • f91762f: 8293965: Code signing warnings after JDK-8293550
  • 8082c24: 8054572: [macosx] JComboBox paints the border incorrectly
  • b920d29: 8271328: User is able to choose the color after disabling the color chooser.
  • 5725a93: 8293879: Remove unnecessary castings in jdk.hotspot.agent
  • ab7f58a: 6286501: JTabbedPane throws NPE from its stateChanged listener in particular case
  • ... and 182 more: https://git.openjdk.org/jdk/compare/3ac91b08cbe16bc1a347178f853513f930ffeaf3...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 (@JoeWang-Java) 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 Sep 19, 2022
@openjdk
Copy link

openjdk bot commented Sep 19, 2022

@rhalade The change author (@Ruprabhu25) must issue an integrate command before the integration can be sponsored.

@Ruprabhu25
Copy link
Contributor Author

/integrate

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

openjdk bot commented Sep 20, 2022

@Ruprabhu25
Your change (at version 2925d34) is now ready to be sponsored by a Committer.

@rhalade
Copy link
Member

rhalade commented Sep 20, 2022

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 20, 2022

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

  • cb5771d: 8294006: Avoid hardcoding object file suffixes in make
  • 5002eaa: 8293828: JFR: jfr/event/oldobject/TestClassLoaderLeak.java still fails when GC cycles are not happening
  • e3358e7: 8294008: Grapheme implementation of setText() throws IndexOutOfBoundsException
  • df8ec09: 8294046: Newly added test test/jdk/javax/swing/JTabbedPane/TestNPEStateChgListener.java fails in macos
  • 09af637: 8294012: RISC-V: get/put_native_u8 missing the case when address&7 is 6
  • 584de68: 8294058: Early use of lambda introduced in JDK-8285263 cause startup regressions in 20-b02
  • bb422f5: 8293595: tstrings::any() is missing an overload
  • 0f28cb0: 8294014: Remove redundant UseCompiler conditions
  • 84ee1a2: 8293781: RISC-V: Clarify types of calls
  • 1b49606: 8293922: Extend barrier-less Java thread transitions to native transitions
  • ... and 195 more: https://git.openjdk.org/jdk/compare/3ac91b08cbe16bc1a347178f853513f930ffeaf3...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 20, 2022

@rhalade @Ruprabhu25 Pushed as commit caae53f.

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

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
3 participants