reta edited a comment on pull request #718:
URL: https://github.com/apache/cxf/pull/718#issuecomment-738478861


   > 
   > 
   > 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()));
                   }
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to