cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1349714 - in /cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs: fortest/jaxb/packageinfo/package-info.java model/wadl/WadlGeneratorTest.java
Date Wed, 13 Jun 2012 09:58:26 GMT
Author: sergeyb
Date: Wed Jun 13 09:58:26 2012
New Revision: 1349714

URL: http://svn.apache.org/viewvc?rev=1349714&view=rev
Log:
[CXF-4374] JSONProvider should not auto-allocate prefixes, let JAXB or users do it

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/packageinfo/package-info.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/packageinfo/package-info.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/packageinfo/package-info.java?rev=1349714&r1=1349713&r2=1349714&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/packageinfo/package-info.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/jaxb/packageinfo/package-info.java
Wed Jun 13 09:58:26 2012
@@ -16,6 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://superbooks")
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://superbooks",
+ xmlns = { @XmlNs(prefix = "os", namespaceURI = "http://superbooks") })
 package org.apache.cxf.jaxrs.fortest.jaxb.packageinfo;
 
+import javax.xml.bind.annotation.XmlNs;
+

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1349714&r1=1349713&r2=1349714&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
Wed Jun 13 09:58:26 2012
@@ -85,7 +85,7 @@ public class WadlGeneratorTest extends A
         Response r = wg.handleRequest(m, cri);
         checkResponse(r);
         Document doc = DOMUtils.readXml(new StringReader(r.getEntity().toString()));
-        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter");
+        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter", false);
         List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz",
1);
         checkBookStoreInfo(els.get(0), "prefix1:thebook", "prefix1:thebook2", "prefix1:thechapter");
     }
@@ -193,7 +193,7 @@ public class WadlGeneratorTest extends A
         Response r = wg.handleRequest(m, cri);
         checkResponse(r);
         Document doc = DOMUtils.readXml(new StringReader(r.getEntity().toString()));
-        checkGrammars(doc.getDocumentElement(), "book", "book2", "chapter");
+        checkGrammars(doc.getDocumentElement(), "book", "book2", "chapter", false);
         List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz",
1);
         checkBookStoreInfo(els.get(0), "prefix1:book", "prefix1:book2", "prefix1:chapter");
     }
@@ -211,7 +211,7 @@ public class WadlGeneratorTest extends A
         checkResponse(r);
         Document doc = DOMUtils.readXml(new StringReader(r.getEntity().toString()));
         checkDocs(doc.getDocumentElement(), "My Application", "", "");
-        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter");
+        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter", true);
         List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz",
1);
         checkBookStoreInfo(els.get(0), "ns1:thebook", "ns1:thebook2", "ns1:thechapter");
     }
@@ -267,7 +267,7 @@ public class WadlGeneratorTest extends A
         
         verifyParameters(resourceEls.get(0), 1, new Param("id", "template", "xs:int"));
         
-        checkGrammars(doc.getDocumentElement(), "thebook", null, "thechapter");
+        checkGrammars(doc.getDocumentElement(), "thebook", null, "thechapter", false);
     }
     
     private void checkResponse(Response r) throws Exception {
@@ -300,16 +300,16 @@ public class WadlGeneratorTest extends A
         assertEquals(WadlGenerator.WADL_TYPE.toString(),
                      r.getMetadata().getFirst(HttpHeaders.CONTENT_TYPE));
         String wadl = r.getEntity().toString();
-        //System.out.println(wadl);
         Document doc = DOMUtils.readXml(new StringReader(wadl));
-        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter");
+        checkGrammars(doc.getDocumentElement(), "thebook", "thebook2", "thechapter", true);
         List<Element> els = getWadlResourcesInfo(doc, "http://localhost:8080/baz",
2);
         checkBookStoreInfo(els.get(0), "prefix1:thebook", "prefix1:thebook2", "prefix1:thechapter");
         Element orderResource = els.get(1);
         assertEquals("/orders", orderResource.getAttribute("path"));
     }
 
-    private void checkGrammars(Element appElement, String bookEl, String book2El, String
chapterEl) {
+    private void checkGrammars(Element appElement, String bookEl, String book2El, String
chapterEl, 
+                               boolean customPrefix) {
         List<Element> grammarEls = DOMUtils.getChildrenWithName(appElement, WadlGenerator.WADL_NS,

                                                                 "grammars");
         assertEquals(1, grammarEls.size());
@@ -323,11 +323,12 @@ public class WadlGeneratorTest extends A
         int size = book2El == null ? 2 : 3;
         
         assertEquals(size, elementEls.size());
-        assertTrue(checkElement(elementEls, bookEl, "tns:book"));
+        String prefix = !customPrefix ? "tns" : "os";
+        assertTrue(checkElement(elementEls, bookEl, prefix + ":book"));
         if (book2El != null) {
-            assertTrue(checkElement(elementEls, book2El, "tns:book2"));
+            assertTrue(checkElement(elementEls, book2El, prefix + ":book2"));
         }
-        assertTrue(checkElement(elementEls, chapterEl, "tns:chapter"));
+        assertTrue(checkElement(elementEls, chapterEl, prefix + ":chapter"));
         
         List<Element> complexTypesEls = DOMUtils.getChildrenWithName(schemasEls.get(0),

                                         XmlSchemaConstants.XSD_NAMESPACE_URI, "complexType");



Mime
View raw message