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

Expand xslt-saxon test coverage #5173

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

zhfeng
Copy link
Contributor

@zhfeng zhfeng commented Aug 11, 2023

Fix #5139

@zhfeng zhfeng force-pushed the issue_5139_xslt_saxon_tests branch from 311a48c to ee43443 Compare August 11, 2023 09:53
Copy link
Contributor

@jamesnetherton jamesnetherton left a comment

Choose a reason for hiding this comment

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

I left a comment for a potential future improvement. The rest looks ok to me.

@@ -18,6 +18,10 @@

import io.quarkus.runtime.annotations.RegisterForReflection;

@RegisterForReflection(targets = { org.apache.camel.quarkus.test.support.xslt.Functions.class })
@RegisterForReflection(targets = {
org.apache.camel.quarkus.test.support.xslt.Functions.class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't have to be part of this PR, but I wonder if we can make the UX nicer and register these automatically? E.g find anything that extends ExtensionFunctionDefinition or related classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but currently the saxon extension function does not support in native mode. It throws some error mesage during at build time if we want to generate an class for the template. Something like

2023-08-14 13:18:24,583 ERROR [org.apa.cam.qua.com.xsl.CamelXsltErrorListener] (build-2) The first argument to the non-static Java function 'myExtensionFunction1' is not a valid object reference.: javax.xml.transform.TransformerException: The first argument to the non-static Java function 'myExtensionFunction1' is not a valid object reference.
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(TransformerFactoryImpl.java:661)
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:836)
	at org.apache.camel.quarkus.support.xalan.XalanTransformerFactory.newTemplates(XalanTransformerFactory.java:70)
	at org.apache.camel.quarkus.component.xslt.deployment.XsltProcessor.xsltResources(XsltProcessor.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

2023-08-14 13:18:24,586 ERROR [org.apa.cam.qua.com.xsl.CamelXsltErrorListener] (build-2) The first argument to the non-static Java function 'myExtensionFunction2' is not a valid object reference.: javax.xml.transform.TransformerException: The first argument to the non-static Java function 'myExtensionFunction2' is not a valid object reference.
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(TransformerFactoryImpl.java:661)
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:836)
	at org.apache.camel.quarkus.support.xalan.XalanTransformerFactory.newTemplates(XalanTransformerFactory.java:70)
	at org.apache.camel.quarkus.component.xslt.deployment.XsltProcessor.xsltResources(XsltProcessor.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

2023-08-14 13:18:24,586 ERROR [org.apa.cam.qua.com.xsl.CamelXsltErrorListener] (build-2) The first argument to the non-static Java function 'myExtensionFunction2' is not a valid object reference.: javax.xml.transform.TransformerException: The first argument to the non-static Java function 'myExtensionFunction2' is not a valid object reference.
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.passErrorsToListener(TransformerFactoryImpl.java:661)
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:836)
	at org.apache.camel.quarkus.support.xalan.XalanTransformerFactory.newTemplates(XalanTransformerFactory.java:70)
	at org.apache.camel.quarkus.component.xslt.deployment.XsltProcessor.xsltResources(XsltProcessor.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

2023-08-14 13:18:24,587 ERROR [org.apa.cam.qua.com.xsl.CamelXsltErrorListener] (build-2) Could not compile stylesheet: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:832)
	at org.apache.camel.quarkus.support.xalan.XalanTransformerFactory.newTemplates(XalanTransformerFactory.java:70)
	at org.apache.camel.quarkus.component.xslt.deployment.XsltProcessor.xsltResources(XsltProcessor.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at java.base/java.lang.Thread.run(Thread.java:833)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

@@ -79,10 +108,26 @@ public void xsltExtensionFunction() {
}

@Test
public void xsltCustomURIResolver() {
@DisabledOnIntegrationTest("xslt-saxon extension function does not be supported in native mode")
Copy link
Contributor

Choose a reason for hiding this comment

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

So xslt-saxon does not support extension function in native-mode. Is there an open issue ? Or maybe something by design that can't be changed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will create an issue later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #5189

poms/bom/pom.xml Outdated Show resolved Hide resolved
@aldettinger
Copy link
Contributor

aldettinger commented Aug 11, 2023

Are xsl:params and xsl:include covered ? Like https://camel.apache.org/components/3.21.x/xslt-saxon-component.html#_getting_useable_parameters_into_the_xslt
Maybe there is no need to add such coverage for native mode ?

@zhfeng
Copy link
Contributor Author

zhfeng commented Aug 14, 2023

xsl:include is test by XsltTest::xsltInclude and it does not support native mode because it needs to generate the template dynamically.

xsl:params should be covered by XsltAggregateTest and yes it does not support native mode.

@zhfeng zhfeng force-pushed the issue_5139_xslt_saxon_tests branch from ee43443 to e48d940 Compare August 14, 2023 06:01
@zhfeng zhfeng merged commit 63433e3 into apache:main Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand test coverage on xslt-saxon
3 participants