[ 
https://issues.apache.org/jira/browse/CXF-4605?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vassilis Virvilis reopened CXF-4605:
------------------------------------


Thanks a bunch as usual,

I tested it with 2.7.1 snapshot 20121107 and it passes the provided test. 
However it still fails our internal test-suite. The only reason I bringing it 
up here and not another bug is that the one failure is a regression. If you 
want me to open it as new issue please tell me so.

So the purpose of the tests is to test inheritance of complex maps. So here are 
the objects we are trying pass through...

    public class ComplexMapResult extends
            HashMap<String, Map<Integer, Integer>> {
    }


 public class ComplexTreeMapResult extends
            HashMap<String, TreeMap<Integer, Integer>> {
    }


The interface is 
    // fail returns null map value in cxf-2.3.3
    // works in cxf-2.6.2
    // fails with exceptions in 2.7.1
    public ComplexMapResult testComplexMapResult();

    // this was always failing...
    public ComplexTreeMapResult testComplexTreeMapResult();

The server side code (implementation) is

    @Override
    public ComplexMapResult testComplexMapResult() {
        final ComplexMapResult result = new ComplexMapResult();
        final Map<Integer, Integer> map1 = new HashMap<Integer, Integer>();
        map1.put(1, 3);
        result.put("key1", map1);
        return result;
    }

    @Override
    public ComplexTreeMapResult testComplexTreeMapResult() {
        final ComplexTreeMapResult result = new ComplexTreeMapResult();
        final TreeMap<Integer, Integer> map1 = new TreeMap<Integer, Integer>();
        map1.put(1, 3);
        map1.put(0, 2);
        result.put("key1", map1);
        return result;
    }

The client side code is:

    @Test
    public void testComplexMapResult() {
        log.info(TestServiceFactory.getService().testComplexMapResult());
    }

    @Test
    public void testComplexTreeMapResult() {
        final Map map = TestServiceFactory.getService()
                .testComplexTreeMapResult();
        log.info(map);
        for (final Object vmap : map.values()) {
            Assert.assertTrue(vmap instanceof SortedMap);
        }
    }

I will update the test case...

           Vassilis
                
> SortedMap is not returned when another unrelated method exists in the 
> interface
> -------------------------------------------------------------------------------
>
>                 Key: CXF-4605
>                 URL: https://issues.apache.org/jira/browse/CXF-4605
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding
>    Affects Versions: 2.7.0
>         Environment: Debian unstable / tomcat7 / opennjdk7
>            Reporter: Vassilis Virvilis
>            Assignee: Daniel Kulp
>             Fix For: 2.7.1
>
>         Attachments: ws-test-issue-4605.tgz
>
>
>  During testing of bug 4534 I stumbled upon the following behavior. Subsets 
> of tests were passing when run standalone but failing when run in the full 
> test suite.
> So I have narrowed it down to one method that fails when another is 
> uncommented in the interface.
> Interface:
>     // uncomment this for the next method to fail
>     // public Map<String, Map<Integer, Integer>> testDirectComplexMapResult();
>     // fail -- puts data into a hashmap instead of a SortedMap if the above 
> is uncommented
>     public Map<String, SortedMap<Integer, Integer>> 
> testDirectComplexTreeMapResult();
> Implementation:
>     //@Override
>     public Map<String, Map<Integer, Integer>> testDirectComplexMapResult() {
>         final Map<String, Map<Integer, Integer>> result = new HashMap<String, 
> Map<Integer, Integer>>();
>         final TreeMap<Integer, Integer> map1 = new TreeMap<Integer, 
> Integer>();
>         map1.put(1, 3);
>         result.put("key1", map1);
>         return result;
>     }
>     @Override
>     public Map<String, SortedMap<Integer, Integer>> 
> testDirectComplexTreeMapResult() {
>         final Map<String, SortedMap<Integer, Integer>> result = new 
> HashMap<String, SortedMap<Integer, Integer>>();
>         final TreeMap<Integer, Integer> map1 = new TreeMap<Integer, 
> Integer>();
>         map1.put(1, 3);
>         map1.put(0, 2);
>         result.put("key1", map1);
>         return result;
>     }
> Client:
>     @Test
>     public void testDirectComplexTreeMapResult() {
>         final Map map = TestServiceFactory.getService()
>                 .testDirectComplexTreeMapResult();
>         log.info(map);
>         for (final Object vmap : map.values()) {
>             Assert.assertTrue(vmap instanceof SortedMap);
>         }
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to