cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5970] Adding a test confirming the order of the providers with the same properties is preserved
Date Tue, 26 Aug 2014 12:47:35 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 6d6ce1326 -> 45cacadd1


[CXF-5970] Adding a test confirming the order of the providers with the same properties is
preserved


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/45cacadd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/45cacadd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/45cacadd

Branch: refs/heads/3.0.x-fixes
Commit: 45cacadd102dc20d79c0c8d366e2f8c96da381fc
Parents: 6d6ce13
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Aug 26 13:40:16 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Aug 26 13:46:43 2014 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/provider/ProviderFactoryTest.java | 50 +++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/45cacadd/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
index 150a07d..b95c2a8 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
@@ -86,6 +86,19 @@ public class ProviderFactoryTest extends Assert {
     }
     
     @Test
+    public void testOrderOfProvidersWithSameProperties() {
+        ProviderFactory pf = ServerProviderFactory.getInstance();
+        WildcardReader reader1 = new WildcardReader();
+        pf.registerUserProvider(reader1);
+        WildcardReader2 reader2 = new WildcardReader2();
+        pf.registerUserProvider(reader2);
+        List<ProviderInfo<MessageBodyReader<?>>> readers = pf.getMessageReaders();
+        assertEquals(2, readers.size());
+        assertSame(reader1, readers.get(0).getProvider());
+        assertSame(reader2, readers.get(1).getProvider());
+    }
+    
+    @Test
     public void testCustomJaxbProvider() {
         ProviderFactory pf = ServerProviderFactory.getInstance();
         JAXBElementProvider<Book> provider = new JAXBElementProvider<Book>();
@@ -709,7 +722,42 @@ public class ProviderFactoryTest extends Assert {
         }
         
     }
-            
+    
+    @Produces("*/*")
+    @Consumes("*/*")
+    private static class WildcardReader implements MessageBodyReader<Object> {
+
+        public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations,

+                                  MediaType mediaType) {
+            return true;
+        }
+
+        public Object readFrom(Class<Object> arg0, Type arg1, Annotation[] arg2, MediaType
arg3, 
+                                  MultivaluedMap<String, String> arg4, InputStream
arg5) 
+            throws IOException, WebApplicationException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+        
+    }
+    @Produces("*/*")
+    @Consumes("*/*")
+    private static class WildcardReader2 implements MessageBodyReader<Object> {
+
+        public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations,

+                                  MediaType mediaType) {
+            return true;
+        }
+
+        public Object readFrom(Class<Object> arg0, Type arg1, Annotation[] arg2, MediaType
arg3, 
+                                  MultivaluedMap<String, String> arg4, InputStream
arg5) 
+            throws IOException, WebApplicationException {
+            // TODO Auto-generated method stub
+            return null;
+        }
+        
+    }
+    
     private static class RuntimeExceptionMapper1 
         extends AbstractTestExceptionMapper<RuntimeException> {
         


Mime
View raw message