Skip to content

[CXF-8361] Added support for jakarta NS in AnnotationHandlerChainBuilder#718

Merged
reta merged 2 commits intoapache:3.3.x-fixesfrom
ropalka:CXF-8361
Dec 5, 2020
Merged

[CXF-8361] Added support for jakarta NS in AnnotationHandlerChainBuilder#718
reta merged 2 commits intoapache:3.3.x-fixesfrom
ropalka:CXF-8361

Conversation

@ropalka
Copy link
Contributor

@ropalka ropalka commented Nov 2, 2020

@reta
Copy link
Member

reta commented Nov 3, 2020

Thanks for the PR, @ropalka , could you please add test cases for the change to AnnotationHandlerChainBuilderTest, thank you

@ropalka
Copy link
Contributor Author

ropalka commented Dec 3, 2020

Hello @reta - it is not possible to add test for that because Apache CXF is using javax JAXB impl
and if I would provide test for that parsing, then jakarta JAXB impl should be used.

@reta
Copy link
Member

reta commented Dec 4, 2020

Hello @reta - it is not possible to add test for that because Apache CXF is using javax JAXB impl
and if I would provide test for that parsing, then jakarta JAXB impl should be used.

Sadly full-fledged tests would be difficult to introduce, at least we could verify the namespace element is properly handled in case of empty handler chain, not idea but better than nothing. A few changes in AnnotationHandlerChainBuilderTest.java:

    @Test
    public void testJakartaFindEmptyHandlerChainAnnotation() {
        JakartaHandlerTestImpl handlerTestImpl = new JakartaHandlerTestImpl();
        AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
        @SuppressWarnings("rawtypes")
        List<Handler> handlers = chainBuilder
            .buildHandlerChainFromClass(handlerTestImpl.getClass(),
                                        null,
                                        null,
                                        null);
        assertNotNull(handlers);
        assertEquals(0, handlers.size());
    }

    @WebService()
    @HandlerChain(file = "./handlers-jakarta.xml", name = "TestHandlerChain")
    public class JakartaHandlerTestImpl {
    }

Resource file handlers-jakarta.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--
                Licensed to the Apache Software Foundation (ASF) under one or more
                contributor license agreements. See the NOTICE file distributed with
                this work for additional information regarding copyright ownership.
                The ASF licenses this file to you under the Apache License, Version
                2.0 (the "License"); you may not use this file except in compliance
                with the License. You may obtain a copy of the License at

                http://www.apache.org/licenses/LICENSE-2.0 Unless required by
                applicable law or agreed to in writing, software distributed under the
                License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
                CONDITIONS OF ANY KIND, either express or implied. See the License for
                the specific language governing permissions and limitations under the
                License.
        -->
<handler-chains xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:cfg="http://cxf.apache.org/configuration/cfg" xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee">
    <handler-chain />
</handler-chains>

Plus the cases you have added:

                if (!isJavaEENamespace && !isJakartaEENamespace) {
                    throw new WebServiceException(
                        BundleUtils.getFormattedString(BUNDLE,
                                                       "NOT_VALID_NAMESPACE",
                                                       el.getNamespaceURI()));
                }

@ropalka
Copy link
Contributor Author

ropalka commented Dec 4, 2020

Done @reta - should I also prepare pull requests against 3.4.x-fixes & master branches ?

@reta
Copy link
Member

reta commented Dec 4, 2020

Thank you @ropalka , for other branches we are going to backport the change, thanks!

@reta reta merged commit 122f14b into apache:3.3.x-fixes Dec 5, 2020
reta pushed a commit that referenced this pull request Dec 5, 2020
…der (#718)

* [CXF-8361] Added support for jakarta NS in AnnotationHandlerChainBuilder

* [CXF-8361] Adding simple test case
reta pushed a commit that referenced this pull request Dec 5, 2020
…der (#718)

* [CXF-8361] Added support for jakarta NS in AnnotationHandlerChainBuilder

* [CXF-8361] Adding simple test case
@ropalka ropalka deleted the CXF-8361 branch December 7, 2020 07:10
rnetuka pushed a commit to rnetuka/cxf that referenced this pull request Oct 3, 2022
…der (apache#718)

* [CXF-8361] Added support for jakarta NS in AnnotationHandlerChainBuilder

* [CXF-8361] Adding simple test case

(cherry picked from commit 122f14b)
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.

2 participants