cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [03/21] git commit: Update test to specify the namespace prefixes to use to it works with different JAXB providers
Date Wed, 02 Apr 2014 06:25:59 GMT
Update test to specify the namespace prefixes to use to it works with different JAXB providers


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

Branch: refs/heads/2.7.x-fixes
Commit: 9d9c311ca64965ac6edc98c285eb14ede90fc291
Parents: c6060bf
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Mar 26 14:56:55 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Apr 2 02:08:40 2014 -0400

----------------------------------------------------------------------
 .../jaxrs/provider/JAXBElementProviderTest.java | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9d9c311c/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
index 9257a86..2b11471 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
@@ -461,6 +461,12 @@ public class JAXBElementProviderTest extends Assert {
         throws Exception {
         JAXBElementProvider<List<org.apache.cxf.jaxrs.fortest.jaxb.SuperBook>>
provider 
             = new JAXBElementProvider<List<org.apache.cxf.jaxrs.fortest.jaxb.SuperBook>>();
+
+        Map<String, String> prefixes = new HashMap<String, String>();
+        prefixes.put("http://superbooks", "ns1");
+        prefixes.put("http://books", "ns2");
+        provider.setNamespacePrefixes(prefixes);
+
         provider.setCollectionWrapperName("{http://superbooks}SuperBooks");
         provider.setJaxbElementClassMap(Collections.singletonMap(
                 org.apache.cxf.jaxrs.fortest.jaxb.SuperBook.class.getName(), 
@@ -947,6 +953,11 @@ public class JAXBElementProviderTest extends Assert {
     @Test
     public void testOutAppendElementsDiffNs() throws Exception {
         JAXBElementProvider<TagVO2> provider = new JAXBElementProvider<TagVO2>();
+        
+        Map<String, String> prefixes = new HashMap<String, String>();
+        prefixes.put("http://tags", "ns2");
+        provider.setNamespacePrefixes(prefixes);
+
         Map<String, String> map = new HashMap<String, String>();
         map.put("{http://tags}thetag", "{http://tagsvo2}t");
         provider.setOutAppendElements(map);
@@ -992,6 +1003,11 @@ public class JAXBElementProviderTest extends Assert {
     @Test
     public void testOutAppendElementsSameNs() throws Exception {
         JAXBElementProvider<TagVO2> provider = new JAXBElementProvider<TagVO2>();
+        
+        Map<String, String> prefixes = new HashMap<String, String>();
+        prefixes.put("http://tags", "ns2");
+        provider.setNamespacePrefixes(prefixes);
+
         Map<String, String> map = new HashMap<String, String>();
         map.put("{http://tags}thetag", "{http://tags}t");
         provider.setOutAppendElements(map);
@@ -1009,6 +1025,9 @@ public class JAXBElementProviderTest extends Assert {
     @Test
     public void testOutElementsMapLocalNsToLocalNs() throws Exception {
         JAXBElementProvider<TagVO2> provider = new JAXBElementProvider<TagVO2>();
+        Map<String, String> prefixes = new HashMap<String, String>();
+        prefixes.put("http://tags", "ns2");
+        provider.setNamespacePrefixes(prefixes);
         Map<String, String> map = new HashMap<String, String>();
         map.put("{http://tags}thetag", "{http://tagsvo2}t");
         provider.setOutTransformElements(map);
@@ -1018,6 +1037,8 @@ public class JAXBElementProviderTest extends Assert {
                        new Annotation[0], MediaType.TEXT_XML_TYPE, new MetadataMap<String,
Object>(), bos);
         String expected = "<?xml version='1.0' encoding='UTF-8'?>"
             + "<ns2:t xmlns:ns2=\"http://tagsvo2\"><group>B</group><name>A</name></ns2:t>";
+        System.out.println(expected);
+        System.out.println(bos.toString());
         assertEquals(expected, bos.toString());
         
     }
@@ -1057,6 +1078,11 @@ public class JAXBElementProviderTest extends Assert {
     @Test
     public void testOutElementsMapLocalNsToLocalWildcard2() throws Exception {
         JAXBElementProvider<TagVO2Holder> provider = new JAXBElementProvider<TagVO2Holder>();
+        
+        Map<String, String> prefixes = new HashMap<String, String>();
+        prefixes.put("http://tags", "ns2");
+        provider.setNamespacePrefixes(prefixes);
+
         Map<String, String> map = new HashMap<String, String>();
         map.put("{http://tags}*", "{http://tags2}*");
         provider.setOutTransformElements(map);


Mime
View raw message