Author: sergeyb
Date: Mon May  9 17:00:52 2011
New Revision: 1101111

URL: http://svn.apache.org/viewvc?rev=1101111&view=rev
Log:
[CXF-3498] Updating generator to create interfaces and impl files if configured

Added:
    
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
   (with props)
Modified:
    
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
    
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
    
cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java

Modified: 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java?rev=1101111&r1=1101110&r2=1101111&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
 (original)
+++ 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/SourceGenerator.java
 Mon May  9 17:00:52 2011
@@ -107,6 +107,7 @@ public class SourceGenerator {
 
     private Comparator<String> importsComparator;
     private boolean generateInterfaces = true;
+    private boolean generateImpl;
     
     private Map<String, String> properties; 
     
@@ -162,7 +163,10 @@ public class SourceGenerator {
         
         GrammarInfo gInfo = getGrammarInfo(appElement, schemaElements);
         for (Element resource : resourceEls) {
-            writeResourceClass(resource, typeClassNames, gInfo, src);
+            writeResourceClass(resource, typeClassNames, gInfo, src, 
generateInterfaces);
+            if (generateInterfaces && generateImpl) {
+                writeResourceClass(resource, typeClassNames, gInfo, src, 
false);
+            }
         }
         
         generateMainClass(resourcesEls.get(0), src);
@@ -205,7 +209,7 @@ public class SourceGenerator {
     }
     
     private void writeResourceClass(Element rElement, Set<String> 
typeClassNames, 
-                                    GrammarInfo gInfo, File src) {
+                                    GrammarInfo gInfo, File src, boolean 
interfaceIsGenerated) {
         String resourceId = rElement.getAttribute("id");
         String path = rElement.getAttribute("path");
         if (resourceId.length() == 0) {
@@ -228,36 +232,65 @@ public class SourceGenerator {
         sbImports.append("package " + qname.getNamespaceURI())
             .append(";").append(getLineSep()).append(getLineSep());
         
-        writeAnnotation(sbCode, imports, Path.class, path, true, false);
-        sbCode.append("public " + getClassType() + " " + qname.getLocalPart() 
-                                       + " {" + getLineSep() + getLineSep());
+        if (writeAnnotations(interfaceIsGenerated)) {
+            writeAnnotation(sbCode, imports, Path.class, path, true, false);
+        }
+        String className = getClassName(qname.getLocalPart(), 
interfaceIsGenerated);
+        sbCode.append("public " + getClassType(interfaceIsGenerated) + " " + 
className);
+        writeImplementsInterface(sbCode, qname.getLocalPart(), 
interfaceIsGenerated);              
+        sbCode.append(" {" + getLineSep() + getLineSep());
         
-        writeMethods(rElement, imports, sbCode, typeClassNames, gInfo);
+        writeMethods(rElement, imports, sbCode, typeClassNames, gInfo, 
interfaceIsGenerated);
         
         List<Element> childEls = DOMUtils.getChildrenWithName(rElement, 
             WadlGenerator.WADL_NS, "resource");
         for (Element childEl : childEls) {
             if (childEl.getAttribute("id").length() == 0) {
-                writeMethods(childEl, imports, sbCode, typeClassNames, gInfo);
+                writeMethods(childEl, imports, sbCode, typeClassNames, gInfo, 
interfaceIsGenerated);
             } else {
-                writeResourceMethod(childEl, childEl, imports, sbCode, 
typeClassNames, gInfo);
+                writeResourceMethod(childEl, childEl, imports, sbCode, 
typeClassNames, gInfo, 
+                                    interfaceIsGenerated);
             }
         }
         sbCode.append("}");
         writeImports(sbImports, imports);
         
-        createJavaSourceFile(src, qname, sbCode, sbImports);
+        createJavaSourceFile(src, new QName(qname.getNamespaceURI(), 
className), sbCode, sbImports);
         
         for (Element subEl : childEls) {
             String id = subEl.getAttribute("id");
             if (id.length() > 0 && !resourceId.equals(id) && 
!id.startsWith("{java")) {
-                writeResourceClass(subEl, typeClassNames, gInfo, src);
+                writeResourceClass(subEl, typeClassNames, gInfo, src, 
interfaceIsGenerated);
             }
         }
     }
     
-    private String getClassType() {
-        return generateInterfaces ? "interface" : "class";
+    private String getClassType(boolean interfaceIsGenerated) {
+        return interfaceIsGenerated ? "interface" : "class";
+    }
+    
+    private String getClassName(String clsName, boolean interfaceIsGenerated) {
+        if (interfaceIsGenerated) {
+            return clsName;
+        } else {
+            return generateInterfaces ? clsName + "Impl" : clsName;
+        }
+        
+    }
+    
+    private boolean writeAnnotations(boolean interfaceIsGenerated) {
+        if (interfaceIsGenerated) {
+            return true;
+        } else {
+            return !generateInterfaces && generateImpl;
+        }
+    }
+    
+    private void writeImplementsInterface(StringBuilder sb, String clsName, 
+                                             boolean interfaceIsGenerated) {
+        if (generateInterfaces && !interfaceIsGenerated) {
+            sb.append(" implements " + clsName);
+        }
     }
     
     private String getClassComment() {
@@ -268,12 +301,14 @@ public class SourceGenerator {
     
     private void writeMethods(Element rElement,  
                               Set<String> imports, StringBuilder sbCode, 
-                              Set<String> typeClassNames, GrammarInfo gInfo) {
+                              Set<String> typeClassNames, GrammarInfo gInfo,
+                              boolean interfaceIsGenerated) {
         List<Element> methodEls = DOMUtils.getChildrenWithName(rElement, 
             WadlGenerator.WADL_NS, "method");
        
         for (Element methodEl : methodEls) {
-            writeResourceMethod(rElement, methodEl, imports, sbCode, 
typeClassNames, gInfo);    
+            writeResourceMethod(rElement, methodEl, imports, sbCode, 
typeClassNames, gInfo, 
+                                interfaceIsGenerated);    
         }
     }
     
@@ -312,36 +347,42 @@ public class SourceGenerator {
     
     private void writeResourceMethod(Element resourceEl, Element methodEl, 
                                      Set<String> imports, StringBuilder 
sbCode, 
-                                     Set<String> typeClassNames, GrammarInfo 
gInfo) {
+                                     Set<String> typeClassNames, GrammarInfo 
gInfo,
+                                     boolean interfaceIsGenerated) {
         String id = methodEl.getAttribute("id");
         String methodName = methodEl.getAttribute("name");
-        String path = resourceEl.getAttribute("path");
-        if (id.length() == 0) {
-            LOG.warning("Method with path " + path + " can not be mapped to a 
class method");
-            return;
-        }
-        
-        sbCode.append(TAB);
-        writeAnnotation(sbCode, imports, Path.class, path, true, true);
-        if (methodName.length() > 0) {
-            if (HTTP_METHOD_ANNOTATIONS.containsKey(methodName.toLowerCase())) 
{
-                writeAnnotation(sbCode, imports, 
-                                
HTTP_METHOD_ANNOTATIONS.get(methodName.toLowerCase()), null, true, true);
-            } else {
-                // TODO : write a custom annotation class based on HttpMethod  
  
-            }
-        }
         
         List<Element> responseEls = DOMUtils.getChildrenWithName(methodEl, 
                                                                  
WadlGenerator.WADL_NS, "response");
         List<Element> requestEls = DOMUtils.getChildrenWithName(methodEl, 
                                                                 
WadlGenerator.WADL_NS, "request");
         
-        if (methodName.length() > 0) {
-            writeFormatAnnotations(requestEls, sbCode, imports, true);
-            writeFormatAnnotations(responseEls, sbCode, imports, false);
+        
+        if (writeAnnotations(interfaceIsGenerated)) {
+            String path = resourceEl.getAttribute("path");
+            if (id.length() == 0) {
+                LOG.warning("Method with path " + path + " can not be mapped 
to a class method");
+                return;
+            }
+            sbCode.append(TAB);
+            writeAnnotation(sbCode, imports, Path.class, path, true, true);
+        
+            if (methodName.length() > 0) {
+                if 
(HTTP_METHOD_ANNOTATIONS.containsKey(methodName.toLowerCase())) {
+                    writeAnnotation(sbCode, imports, 
+                                    
HTTP_METHOD_ANNOTATIONS.get(methodName.toLowerCase()), null, true, true);
+                } else {
+                    // TODO : write a custom annotation class name based on 
HttpMethod    
+                }
+                
+                writeFormatAnnotations(requestEls, sbCode, imports, true);
+                writeFormatAnnotations(responseEls, sbCode, imports, false);
+            }
+        } else {
+            sbCode.append(getLineSep()).append(TAB);
         }
-        if (!generateInterfaces) {
+        
+        if (!interfaceIsGenerated) {
             sbCode.append("public ");
         }
         boolean responseTypeAvailable = true;
@@ -367,17 +408,10 @@ public class SourceGenerator {
         List<Element> inParamElements = new LinkedList<Element>();
         inParamElements.addAll(DOMUtils.getChildrenWithName(resourceEl, 
                                                             
WadlGenerator.WADL_NS, "param"));
-        boolean form = false;
-        if (requestEls.size() == 1 && inParamElements.size() == 0) {
-            
inParamElements.addAll(DOMUtils.getChildrenWithName(requestEls.get(0), 
-                 WadlGenerator.WADL_NS, "param"));
-            addFormParameters(inParamElements, requestEls.get(0));
-            form = true;
-        }
         writeRequestTypes(requestEls, inParamElements, sbCode, imports, 
typeClassNames, gInfo,
-                          form);
+                          interfaceIsGenerated);
         sbCode.append(")");
-        if (generateInterfaces) {
+        if (interfaceIsGenerated) {
             sbCode.append(";");
         } else {
             generateEmptyMethodBody(sbCode, responseTypeAvailable);
@@ -442,7 +476,14 @@ public class SourceGenerator {
                                    Set<String> imports, 
                                    Set<String> typeClassNames, 
                                    GrammarInfo gInfo,
-                                   boolean form) {
+                                   boolean interfaceIsGenerated) {
+        boolean form = false;
+        if (requestEls.size() == 1 && inParamEls.size() == 0) {
+            inParamEls.addAll(DOMUtils.getChildrenWithName(requestEls.get(0), 
+                 WadlGenerator.WADL_NS, "param"));
+            addFormParameters(inParamEls, requestEls.get(0));
+            form = true;
+        }
         
         String elementName = null;
         
@@ -468,15 +509,18 @@ public class SourceGenerator {
             Element paramEl = inParamEls.get(i);
 
             String name = paramEl.getAttribute("name");
-            Class<?> paramAnnotation = form ? FormParam.class 
-                : PARAM_ANNOTATIONS.get(paramEl.getAttribute("style"));
-            writeAnnotation(sbCode, imports, paramAnnotation, name, false, 
false);
+            if (writeAnnotations(interfaceIsGenerated)) {
+                Class<?> paramAnnotation = form ? FormParam.class 
+                    : PARAM_ANNOTATIONS.get(paramEl.getAttribute("style"));
+                writeAnnotation(sbCode, imports, paramAnnotation, name, false, 
false);
+                sbCode.append(" ");
+            }
             String type = getPrimitiveType(paramEl);
             if (Boolean.valueOf(paramEl.getAttribute("repeating"))) {
                 addImport(imports, List.class.getName());
                 type = "List<" + type + ">";
             }
-            sbCode.append(" ").append(type).append(" 
").append(name.replace('.', '_'));
+            sbCode.append(type).append(" ").append(name.replace('.', '_'));
             if (i + 1 < inParamEls.size()) {
                 sbCode.append(", ");
                 if (i + 1 >= 4 && ((i + 1) % 4) == 0) {
@@ -680,6 +724,10 @@ public class SourceGenerator {
         this.generateInterfaces = generateInterfaces;
     }
     
+    public void setGenerateImplementation(boolean generate) {
+        this.generateImpl = generate;
+    }
+    
     private static class GrammarInfo {
         private Map<String, String> nsMap;
         private Map<String, String> elementTypeMap;

Added: 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java?rev=1101111&view=auto
==============================================================================
--- 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
 (added)
+++ 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
 Mon May  9 17:00:52 2011
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.tools.wadlto;
+
+import org.apache.cxf.tools.common.ToolConstants;
+
+public final class WadlToolConstants {
+
+    public static final String CFG_OUTPUTDIR = ToolConstants.CFG_OUTPUTDIR;
+    public static final String CFG_COMPILE = ToolConstants.CFG_COMPILE;
+    public static final String CFG_CLASSDIR = ToolConstants.CFG_CLASSDIR;
+    
+    /**
+     * Default
+     */
+    public static final String CFG_INTERFACE = ToolConstants.CFG_INTERFACE;
+    public static final String CFG_SERVER = ToolConstants.CFG_SERVER;
+    public static final String CFG_TYPES = ToolConstants.CFG_TYPES;
+    
+    public static final String CFG_PACKAGENAME = ToolConstants.CFG_PACKAGENAME;
+    public static final String CFG_INTERFACENAME = "interfacename";
+    
+    public static final String CFG_WADLURL = "wadl";
+    
+        
+    private WadlToolConstants() {
+        //utility class
+    }
+}

Propchange: 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java?rev=1101111&r1=1101110&r2=1101111&view=diff
==============================================================================
--- 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
 (original)
+++ 
cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainer.java
 Mon May  9 17:00:52 2011
@@ -27,11 +27,11 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.ext.codegen.SourceGenerator;
 import org.apache.cxf.tools.common.AbstractCXFToolContainer;
 import org.apache.cxf.tools.common.ClassUtils;
-import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.toolspec.ToolSpec;
 import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
 import org.apache.cxf.tools.util.URIParserUtil;
+import org.apache.cxf.tools.wadlto.WadlToolConstants;
 
 public class JAXRSContainer extends AbstractCXFToolContainer {
     
@@ -73,29 +73,37 @@ public class JAXRSContainer extends Abst
 
     public void buildToolContext() {
         getContext();
-        if (context.get(ToolConstants.CFG_OUTPUTDIR) == null) {
-            context.put(ToolConstants.CFG_OUTPUTDIR, ".");
+        if (context.get(WadlToolConstants.CFG_OUTPUTDIR) == null) {
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, ".");
         }
     }
 
     private void processWadl() {
-        File outDir = new 
File((String)context.get(ToolConstants.CFG_OUTPUTDIR));
+        File outDir = new 
File((String)context.get(WadlToolConstants.CFG_OUTPUTDIR));
         String wadl = readWadl();
 
-        SourceGenerator sg = new SourceGenerator();  
+        SourceGenerator sg = new SourceGenerator();
+        boolean isInterface = 
context.optionSet(WadlToolConstants.CFG_INTERFACE);
+        boolean isServer = context.optionSet(WadlToolConstants.CFG_SERVER);
+        if (isServer) {
+            sg.setGenerateInterfaces(isInterface);
+            sg.setGenerateImplementation(true);
+        }
         
         // generate
-        sg.generateSource(wadl, outDir, "proxy");
+        String codeType = context.optionSet(WadlToolConstants.CFG_TYPES)
+            ? SourceGenerator.CODE_TYPE_GRAMMAR : 
SourceGenerator.CODE_TYPE_PROXY;
+        sg.generateSource(wadl, outDir, codeType);
         
         // compile 
-        if (context.optionSet(ToolConstants.CFG_COMPILE)) {
+        if (context.optionSet(WadlToolConstants.CFG_COMPILE)) {
             new ClassUtils().compile(context);
         }
 
     }
     
     protected String readWadl() {
-        String wadlURL = (String)context.get(ToolConstants.CFG_WSDLURL);
+        String wadlURL = (String)context.get(WadlToolConstants.CFG_WADLURL);
         wadlURL = URIParserUtil.getAbsoluteURI(wadlURL);
         
         try {

Modified: 
cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java?rev=1101111&r1=1101110&r2=1101111&view=diff
==============================================================================
--- 
cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
 (original)
+++ 
cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
 Mon May  9 17:00:52 2011
@@ -25,40 +25,116 @@ import java.util.List;
 
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.tools.common.ProcessorTestBase;
-import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
+import org.apache.cxf.tools.wadlto.WadlToolConstants;
 
 import org.junit.Test;
 
 public class JAXRSContainerTest extends ProcessorTestBase {
 
     @Test    
-    public void testCodeGen() {
+    public void testCodeGenInterfaces() {
         try {
             JAXRSContainer container = new JAXRSContainer(null);
             ToolContext context = new ToolContext();
 
-            context.put(ToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
 
-            context.put(ToolConstants.CFG_WSDLURL, 
getLocation("/wadl/bookstore.xml"));
+            context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/bookstore.xml"));
+            //context.put(WadlToolConstants.CFG_COMPILE, "true");
 
+            container.setContext(context);
+            container.execute();
+
+            assertNotNull(output.list());
+            
+            verifyFiles("java", false);
+            //verifyFiles("class");
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail();
+        }
+    }
+    
+    @Test    
+    public void testCodeGenImpl() {
+        try {
+            JAXRSContainer container = new JAXRSContainer(null);
+            ToolContext context = new ToolContext();
 
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
+
+            context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/bookstore.xml"));
+            context.put(WadlToolConstants.CFG_SERVER, "true");
+            //context.put(WadlToolConstants.CFG_COMPILE, "true");
+            
             container.setContext(context);
             container.execute();
 
             assertNotNull(output.list());
             
-            verifyFiles("java");
+            verifyFiles("java", false);
+            //verifyFiles("classes");
+        } catch (Exception e) {
+            fail();
+            e.printStackTrace();
+        }
+    }
+    
+    @Test    
+    public void testCodeGenInterfaceAndImpl() {
+        try {
+            JAXRSContainer container = new JAXRSContainer(null);
+            ToolContext context = new ToolContext();
+
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
+
+            context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/bookstore.xml"));
+            context.put(WadlToolConstants.CFG_INTERFACE, "true");
+            context.put(WadlToolConstants.CFG_SERVER, "true");
+            //context.put(WadlToolConstants.CFG_COMPILE, "true");
             
+            container.setContext(context);
+            container.execute();
+
+            assertNotNull(output.list());
+            
+            verifyFiles("java", true);
+            //verifyFiles("classes");
         } catch (Exception e) {
+            fail();
             e.printStackTrace();
         }
     }
     
+    @Test    
+    public void testCodeGenTypesOnly() {
+        try {
+            JAXRSContainer container = new JAXRSContainer(null);
+            ToolContext context = new ToolContext();
+
+            context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
 
-    private void verifyFiles(String ext) {
+            context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/bookstore.xml"));
+            context.put(WadlToolConstants.CFG_TYPES, "true");
+
+            container.setContext(context);
+            container.execute();
+
+            assertNotNull(output.list());
+            
+            verifyTypes("java");
+            
+        } catch (Exception e) {
+            fail();
+            e.printStackTrace();
+        }
+    }
+    
+    private void verifyFiles(String ext, boolean interfacesAndImpl) {
         List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + ext + 
"$");
-        assertEquals(7, files.size());
+        assertEquals(interfacesAndImpl ? 9 : 7, files.size());
         assertTrue(checkContains(files, "superbooks.Book." + ext));
         assertTrue(checkContains(files, "superbooks.Book2." + ext));
         assertTrue(checkContains(files, "superbooks.Chapter." + ext));
@@ -66,6 +142,20 @@ public class JAXRSContainerTest extends 
         assertTrue(checkContains(files, "superbooks.package-info." + ext));
         assertTrue(checkContains(files, 
"org.apache.cxf.jaxrs.model.wadl.FormInterface." + ext));
         assertTrue(checkContains(files, 
"org.apache.cxf.jaxrs.model.wadl.BookStore." + ext));
+        if (interfacesAndImpl) {
+            assertTrue(checkContains(files, 
"org.apache.cxf.jaxrs.model.wadl.FormInterfaceImpl." + ext));
+            assertTrue(checkContains(files, 
"org.apache.cxf.jaxrs.model.wadl.BookStoreImpl." + ext));
+        }
+    }
+    
+    private void verifyTypes(String ext) {
+        List<File> files = FileUtils.getFilesRecurse(output, ".+\\." + ext + 
"$");
+        assertEquals(5, files.size());
+        assertTrue(checkContains(files, "superbooks.Book." + ext));
+        assertTrue(checkContains(files, "superbooks.Book2." + ext));
+        assertTrue(checkContains(files, "superbooks.Chapter." + ext));
+        assertTrue(checkContains(files, "superbooks.ObjectFactory." + ext));
+        assertTrue(checkContains(files, "superbooks.package-info." + ext));
     }
     
     private boolean checkContains(List<File> clsFiles, String name) {


Reply via email to