-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
[bugfix] registered import-uris have precedence #5576
base: develop
Are you sure you want to change the base?
Conversation
f0c6961
to
401ac6e
Compare
I don't think this works... What about the catalog? |
@adamretter If you have a test case that shows an issue please post it here. Otherwise, I can only judge by the tests that are already present and I can come up with. |
At least now the registered import uri is really resolved against the repo instead of trying to resolve it via http request. |
You're missing the point of the test, please restore the original test |
@adamretter could you please explain to us the point that we missing, instead of just telling us to restore a test as it was that we did no understand in the fist place. As from #5574
I personally would like to learn from that. Just rolling back will not help me (and may others in the future) in getting reasoning behind the current test. as the discussion seems to prove already. I would like see this issue as a chance to improve the test and the understanding for regression it wants to cover. |
The first test case is importing the stylesheet from the repo using the registered import-uri. So "the original test" is reinstated. @Test
public void fromRegisteredImportUri() throws XMLDBException {
final String xquery = getQuery("http://www.functx.com/functx.xsl");
final ResourceSet result = existXmldbEmbeddedServer.executeQuery(xquery);
assertTransformationResult(result);
} |
To better understand the current situation and the proposed solution: The feature, to be able to import stylesheets using an import-uri that is registered in the databases package repository, did not work. The order of URI resolvers prevented that from happening, as the first resolver captured the URI and resolved it as an external resource. By putting the |
@reinhapa But it doesn't improve the original test. Instead it removes the original test and adds different tests that prove something completely different.
@reinhapa You could just talk to me. Even after all the nonsense and abuse I have been shovelled lately, I am still here and trying to help. If you want to understand the original purpose of the test, then the obvious thing would be to have a conversation with me (the original author of the test).
@line-o That is not my impression. It looks to me like this test only started recently failing, before that it was passing just fine. |
@adamretter because of |
public void testImportNoScheme() throws XMLDBException { | ||
final String xquery = getQuery(moduleLocation); | ||
public void fromRegisteredImportUri() throws XMLDBException { | ||
final String xquery = getQuery("http://www.functx.com/functx.xsl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@line-o I found a working document here: https://www.datypic.com/xsl/functx-1.0.1-doc.xsl that we may should use instead...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely not. The test is about importing a locally available Stylesheet and the fact that it was resolved from an external source was the problem I fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just coincidentally was also available at that address and not just registered with that namespace URI in exist-db's package repository.
It is non-obvious to use HTTP-addresses to uniquely name packages without also guaranteeing the source is available there but this is the status-quo, not the use-case this test is about and also a different discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see also what @adamretter wrote:
This test was to ensure the loading of XSLT imports from within EXPath packages.
@line-o by default curl does not follow redirects; I think the -L flag will make tha happen...
(cant check right now) If so, we could consider if we can enforce the HTTP-resolver in the test to follow redirects too? |
But the test is clearly about importing the Stylesheet from within the db. The fact that an HTTP connection es even attempted is a failure. |
@line-o Nope! That is absolutely not what I wrote this test for. This test was to ensure the loading of XSLT imports from within EXPath packages. This PR deletes that work and important use-case and goes in a completely different direction. This PR is a regression. The correct approach would have been to fix this in the XML Resolver and/or EXPath package resolver. |
OK, so we are in agreement here, good. The test case to do that is back in now that this feature is fixed and more cases were added.
This is what I did, by changing the order of the resolvers everything is in order. |
The http-resolver should not be used for any of the test cases within |
When importing stylesheets the URIs are resolved in order - registered import-uris in package repo - XMLDB-locations (relative, absolute and with or without scheme) - any other location is treated as an exteranal source The test class and its cases were renamed to reflect their purpose. Some inline comments were added to help describing the intent.
401ac6e
to
adbb94b
Compare
Quality Gate passedIssues Measures |
When importing stylesheets the URIs are resolved in order
The test class and its cases were renamed to reflect their purpose. Some inline comments were added to help describing the intent.
follow-up for #5574