cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1162075 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/ tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/ tools/wadlto/jaxrs/src/test/resources/wadl/ tools/wadlto/jaxrs...
Date Fri, 26 Aug 2011 12:07:00 GMT
Author: sergeyb
Date: Fri Aug 26 12:06:59 2011
New Revision: 1162075

URL: http://svn.apache.org/viewvc?rev=1162075&view=rev
Log:
Merged revisions 1162074 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1162074 | sergeyb | 2011-08-26 13:04:49 +0100 (Fri, 26 Aug 2011) | 1 line
  
  [CXF-3756] Better support for multiple inlined schemas
........

Added:
    cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreInlinedSchemaWithImport.xml
      - copied unchanged from r1162074, cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreInlinedSchemaWithImport.xml
    cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreMultipleSchemas.xml
      - copied unchanged from r1162074, cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreMultipleSchemas.xml
    cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/schemas/chapter2.xsd
      - copied unchanged from r1162074, cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/schemas/chapter2.xsd
Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
    cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 26 12:06:59 2011
@@ -1 +1 @@
-/cxf/trunk:1161592
+/cxf/trunk:1161592,1162074

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java?rev=1162075&r1=1162074&r2=1162075&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
Fri Aug 26 12:06:59 2011
@@ -836,8 +836,12 @@ public class SourceGenerator {
         List<SchemaInfo> schemas = new ArrayList<SchemaInfo>();
         List<Element> schemasEls = DOMUtils.getChildrenWithName(grammarEls.get(0),

              XmlSchemaConstants.XSD_NAMESPACE_URI, "schema");
-        for (Element schemaEl : schemasEls) {
-            schemas.add(createSchemaInfo(schemaEl, app.getWadlPath()));
+        for (int i = 0; i < schemasEls.size(); i++) {
+            String systemId = app.getWadlPath();
+            if (schemasEls.size() > 1) {
+                systemId += "#grammar" + (i + 1);
+            }
+            schemas.add(createSchemaInfo(schemasEls.get(i), systemId));
         }
         List<Element> includeEls = DOMUtils.getChildrenWithName(grammarEls.get(0),

              WadlGenerator.WADL_NS, "include");

Modified: cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java?rev=1162075&r1=1162074&r2=1162075&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
(original)
+++ cxf/branches/2.4.x-fixes/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
Fri Aug 26 12:06:59 2011
@@ -106,6 +106,46 @@ public class JAXRSContainerTest extends 
     }
     
     @Test    
+    public void testCodeGenWithMultipleInlinedSchemas() {
+        doTestInlinedSchemasWithImport("/wadl/bookstoreMultipleSchemas.xml");
+    }
+    
+    @Test    
+    public void testCodeGenWithInlinedSchemaAndImport() {
+        doTestInlinedSchemasWithImport("/wadl/bookstoreInlinedSchemaWithImport.xml");
+    }
+    
+    private void doTestInlinedSchemasWithImport(String loc) {
+        try {
+            JAXRSContainer container = new JAXRSContainer(null);
+
+            ToolContext context = new ToolContext();
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+            context.put(WadlToolConstants.CFG_WADLURL, getLocation(loc));
+            context.put(WadlToolConstants.CFG_COMPILE, "true");
+
+            container.setContext(context);
+            container.execute();
+
+            assertNotNull(output.list());
+            
+            List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + "class"
+ "$");
+            assertEquals(7, files.size());
+            assertTrue(checkContains(files, "org.apache.cxf.jaxrs.model.wadl" + ".BookStore.class"));
+            assertTrue(checkContains(files, "superbooks" + ".Book.class"));
+            assertTrue(checkContains(files, "superbooks" + ".ObjectFactory.class"));
+            assertTrue(checkContains(files, "superbooks" + ".package-info.class"));
+            assertTrue(checkContains(files, "superchapters" + ".Chapter.class"));
+            assertTrue(checkContains(files, "superchapters" + ".ObjectFactory.class"));
+            assertTrue(checkContains(files, "superchapters" + ".package-info.class"));
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    @Test    
     public void testCodeGenWithImportedSchemaAndResourceSet() {
         try {
             JAXRSContainer container = new JAXRSContainer(null);



Mime
View raw message