You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2010/11/11 21:58:46 UTC

svn commit: r1034117 - in /cxf/branches/2.3.x-fixes: ./ api/src/main/java/org/apache/cxf/databinding/ common/common/src/main/java/org/apache/cxf/helpers/ rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ rt/databinding/aegis/src/main/jav...

Author: dkulp
Date: Thu Nov 11 20:58:46 2010
New Revision: 1034117

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

........
  r1031210 | bimargulies | 2010-11-04 16:14:53 -0400 (Thu, 04 Nov 2010) | 1 line
  
  CXF-3057, CXF-3058. Clean up some mtom wiring.
........
  r1034113 | dkulp | 2010-11-11 15:50:50 -0500 (Thu, 11 Nov 2010) | 1 line
  
  Add some more method to IOUtils to make it more useful and replace the commons version in the tests
........

Added:
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java
      - copied unchanged from r1031210, cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestService.java
Removed:
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTest.java
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
    cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
    cxf/branches/2.3.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/IOUtils.java
    cxf/branches/2.3.x-fixes/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
    cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java
    cxf/branches/2.3.x-fixes/systests/databinding/src/test/resources/mtomTestBeans.xml

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1031210,1034113

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

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Thu Nov 11 20:58:46 2010
@@ -54,7 +54,7 @@ public abstract class AbstractDataBindin
         BUILTIN_SCHEMA_LOCS.put("http://www.w3.org/2005/08/addressing",
                                 "http://www.w3.org/2006/03/addressing/ws-addr.xsd");
     }
-
+    protected boolean mtomEnabled;
     protected int mtomThreshold;
     private Bus bus;
     private Collection<DOMSource> schemas;
@@ -272,6 +272,14 @@ public abstract class AbstractDataBindin
         }
     }
 
+    public void setMtomEnabled(boolean enabled) {
+        mtomEnabled = enabled;
+    }
+
+    public boolean isMtomEnabled() {
+        return mtomEnabled;
+    }
+
     public int getMtomThreshold() {
         return mtomThreshold;
     }

Modified: cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/DataBinding.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/DataBinding.java (original)
+++ cxf/branches/2.3.x-fixes/api/src/main/java/org/apache/cxf/databinding/DataBinding.java Thu Nov 11 20:58:46 2010
@@ -24,29 +24,32 @@ import java.util.Map;
 import org.apache.cxf.service.Service;
 
 public interface DataBinding {
-    
+
     <T> DataReader<T> createReader(Class<T> cls);
-    
+
     <T> DataWriter<T> createWriter(Class<T> cls);
-    
+
     Class<?>[] getSupportedReaderFormats();
-    
+
     Class<?>[] getSupportedWriterFormats();
-    
+
     /**
-     * Initialize the service info (i.e. type & element names, Schemas) with 
+     * Initialize the service info (i.e. type & element names, Schemas) with
      * information from the databinding.
      * @param service
      */
     void initialize(Service service);
-    
+
     /**
      * Return a set of mappings from namespace to prefix to allow bindings to control
      * the prefixes.
      * @return the map, or null if there are none.
      */
     Map<String, String> getDeclaredNamespaceMappings();
-    
+
+    void setMtomEnabled(boolean enabled);
+    boolean isMtomEnabled();
+
     /**
      * If the binding supports MTOM, set the size threshold for its use.
      * may be overridden by (e.g.) JAXWS configuration.

Modified: cxf/branches/2.3.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/IOUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/IOUtils.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/IOUtils.java (original)
+++ cxf/branches/2.3.x-fixes/common/common/src/main/java/org/apache/cxf/helpers/IOUtils.java Thu Nov 11 20:58:46 2010
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.UnsupportedEncodingException;
@@ -161,34 +162,33 @@ public final class IOUtils {
     public static String toString(final InputStream input) throws IOException {
         return toString(input, DEFAULT_BUFFER_SIZE);
     }
-
+    public static String toString(final InputStream input, String charset) throws IOException {
+        return toString(input, DEFAULT_BUFFER_SIZE, charset);
+    }
     public static String toString(final InputStream input, int bufferSize)
         throws IOException {
+        return toString(input, bufferSize, null);
+    }
+    public static String toString(final InputStream input, int bufferSize, String charset)
+        throws IOException {
 
+        
         int avail = input.available();
         if (avail > bufferSize) {
             bufferSize = avail;
         }
-
-        StringBuilder buf = new StringBuilder();
-        final byte[] buffer = new byte[bufferSize];
-        int n = 0;
-        n = input.read(buffer);
-        while (-1 != n) {
-            if (n == 0) {
-                throw new IOException("0 bytes read in violation of InputStream.read(byte[])");
-            }
-            buf.append(newStringFromBytes(buffer, 0, n));
-            n = input.read(buffer);
-        }
-        input.close();
-        return buf.toString();
+        Reader reader = charset == null ? new InputStreamReader(input, UTF8_CHARSET) 
+            : new InputStreamReader(input, charset);
+        return toString(reader, bufferSize);
     }
 
     public static String toString(final Reader input) throws IOException {
+        return toString(input, DEFAULT_BUFFER_SIZE);
+    }
+    public static String toString(final Reader input, int bufSize) throws IOException {
 
         StringBuilder buf = new StringBuilder();
-        final char[] buffer = new char[DEFAULT_BUFFER_SIZE];
+        final char[] buffer = new char[bufSize];
         int n = 0;
         n = input.read(buffer);
         while (-1 != n) {

Modified: cxf/branches/2.3.x-fixes/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java (original)
+++ cxf/branches/2.3.x-fixes/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/ClientTest.java Thu Nov 11 20:58:46 2010
@@ -33,7 +33,6 @@ import org.apache.cxf.customer.bare.GetC
 import org.apache.cxf.customer.bare.GetCustomers;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.ServerImpl;
-import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.junit.Test;
 
@@ -42,7 +41,7 @@ public class ClientTest extends Abstract
     public void testCreation() throws Exception {
         BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
         bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, new HttpBindingFactory());
-        
+
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
         sf.setBus(getBus());
         sf.setServiceClass(CustomerService.class);
@@ -50,36 +49,34 @@ public class ClientTest extends Abstract
         sf.setAddress("http://localhost:9002/foo/");
         sf.setServiceBean(new CustomerService());
         //sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
-        
+
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("contextMatchStrategy", "stem");
         sf.setProperties(props);
-        
+
         ServerImpl svr = (ServerImpl) sf.create();
 
-        svr.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
-        
         ClientImpl client = new ClientImpl(getBus(), svr.getEndpoint());
-        
-        Object[] objects = client.invoke(new QName("http://cxf.apache.org/jra", "getCustomers"), 
+
+        Object[] objects = client.invoke(new QName("http://cxf.apache.org/jra", "getCustomers"),
                                          new GetCustomers());
         assertNotNull(objects);
-        
+
         Customers c = (Customers) objects[0];
         Customer customer = c.getCustomer().iterator().next();
         assertEquals("Dan Diephouse", customer.getName());
-        
+
         GetCustomer getCustomer = new GetCustomer();
         getCustomer.setId(customer.getId());
         objects = client.invoke(new QName("http://cxf.apache.org/jra", "getCustomer"), getCustomer);
-        
+
         customer = (Customer) objects[0];
         assertEquals("Dan Diephouse", customer.getName());
-//        
-//        objects = client.invoke(new QName("http://cxf.apache.org/jra", "deleteCustomer"), 
+//
+//        objects = client.invoke(new QName("http://cxf.apache.org/jra", "deleteCustomer"),
 //        customer.getId());
 //        assertTrue(objects == null || objects.length == 0);
-//        
+//
         svr.destroy();
     }
 

Modified: cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Thu Nov 11 20:58:46 2010
@@ -93,7 +93,6 @@ public class AegisDatabinding extends Ab
     private boolean isInitialized;
     private Set<String> overrideTypes;
     private TypeCreationOptions configuration;
-    private boolean mtomEnabled;
     private boolean mtomUseXmime;
 
     public AegisDatabinding() {
@@ -186,6 +185,7 @@ public class AegisDatabinding extends Ab
 
             Object val = s.get("mtom-enabled");
             if ("true".equals(val) || Boolean.TRUE.equals(val) || mtomEnabled) {
+                setMtomEnabled(true);
                 aegisContext.setMtomEnabled(true);
             }
 
@@ -690,14 +690,6 @@ public class AegisDatabinding extends Ab
         this.configuration = configuration;
     }
 
-    public boolean isMtomEnabled() {
-        return mtomEnabled;
-    }
-
-    public void setMtomEnabled(boolean mtomEnabled) {
-        this.mtomEnabled = mtomEnabled;
-    }
-
     public boolean isMtomUseXmime() {
         return mtomUseXmime;
     }

Modified: cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Thu Nov 11 20:58:46 2010
@@ -87,9 +87,9 @@ import org.apache.cxf.service.factory.Se
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.ws.addressing.ObjectFactory;
 @NoJSR250Annotations
-public class JAXBDataBinding extends AbstractDataBinding 
+public class JAXBDataBinding extends AbstractDataBinding
     implements WrapperCapableDatabinding, InterceptorProvider {
-    
+
     public static final String SCHEMA_RESOURCE = "SCHEMRESOURCE";
     public static final String MTOM_THRESHOLD = "org.apache.cxf.jaxb.mtomThreshold";
 
@@ -128,13 +128,13 @@ public class JAXBDataBinding extends Abs
         }
 
     }
-    
-    private static final Map<Set<Class<?>>, CachedContextAndSchemas> JAXBCONTEXT_CACHE 
+
+    private static final Map<Set<Class<?>>, CachedContextAndSchemas> JAXBCONTEXT_CACHE
         = new CacheMap<Set<Class<?>>, CachedContextAndSchemas>();
-    
+
     private static final Map<Package, CachedClass> OBJECT_FACTORY_CACHE
         = new CacheMap<Package, CachedClass>();
-    
+
     private static final Map<String, DOMResult> BUILT_IN_SCHEMAS = new HashMap<String, DOMResult>();
     static {
         URIResolver resolver = new URIResolver();
@@ -206,18 +206,18 @@ public class JAXBDataBinding extends Abs
     private Unmarshaller.Listener unmarshallerListener;
     private Marshaller.Listener marshallerListener;
     private ValidationEventHandler validationEventHandler;
-    
+
     private boolean unwrapJAXBElement = true;
 
     private boolean qualifiedSchemas;
-    
-    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> in 
+
+    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> in
         = new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>();
     private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> out
         = new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>();
-    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> outFault 
+    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> outFault
         = new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>();
-    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> inFault 
+    private ModCountCopyOnWriteArrayList<Interceptor<? extends Message>> inFault
         = new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>();
 
     public JAXBDataBinding() {
@@ -251,7 +251,7 @@ public class JAXBDataBinding extends Abs
 
         Integer mtomThresholdInt = new Integer(getMtomThreshold());
         if (c == XMLStreamWriter.class) {
-            DataWriterImpl<XMLStreamWriter> r 
+            DataWriterImpl<XMLStreamWriter> r
                 = new DataWriterImpl<XMLStreamWriter>(this);
             r.setMtomThreshold(mtomThresholdInt);
             return (DataWriter<T>)r;
@@ -295,10 +295,10 @@ public class JAXBDataBinding extends Abs
 
     @SuppressWarnings("unchecked")
     public synchronized void initialize(Service service) {
-        
+
         in.addIfAbsent(JAXBAttachmentSchemaValidationHack.INSTANCE);
         inFault.addIfAbsent(JAXBAttachmentSchemaValidationHack.INSTANCE);
-        
+
         // context is already set, don't redo it
         if (context != null) {
             return;
@@ -307,7 +307,7 @@ public class JAXBDataBinding extends Abs
 
         contextClasses = new LinkedHashSet<Class<?>>();
         for (ServiceInfo serviceInfo : service.getServiceInfos()) {
-            JAXBContextInitializer initializer 
+            JAXBContextInitializer initializer
                 = new JAXBContextInitializer(serviceInfo, contextClasses, typeRefs);
             initializer.walk();
             if (serviceInfo.getProperty("extra.class") != null) {
@@ -342,7 +342,7 @@ public class JAXBDataBinding extends Abs
             } else {
                 synchronized (JAXBCONTEXT_CACHE) {
                     JAXBCONTEXT_CACHE.put(contextClasses, cachedContextAndSchemas);
-                } 
+                }
             }
         }
         ctx = cachedContextAndSchemas.getContext();
@@ -378,10 +378,10 @@ public class JAXBDataBinding extends Abs
                         if (BUILT_IN_SCHEMAS.containsValue(r)) {
                             bi.add(src);
                         } else {
-                            schemas.add(src);                            
+                            schemas.add(src);
                         }
                     }
-                    //put any builtins at the end.   Anything that DOES import them 
+                    //put any builtins at the end.   Anything that DOES import them
                     //will cause it to load automatically and we'll skip them later
                     schemas.addAll(bi);
                 } catch (IOException e) {
@@ -395,8 +395,8 @@ public class JAXBDataBinding extends Abs
                         continue;
                     }
                 }
-                addSchemaDocument(serviceInfo, 
-                                  col, 
+                addSchemaDocument(serviceInfo,
+                                  col,
                                  (Document)r.getNode(),
                                   r.getSystemId());
             }
@@ -422,10 +422,10 @@ public class JAXBDataBinding extends Abs
             }
         }
     }
-    
+
     private String getNamespaceToUse(Service service) {
         if ("true".equals(service.get("org.apache.cxf.databinding.namespace"))) {
-            return null;    
+            return null;
         }
         String tns = null;
         if (service.getServiceInfos().size() > 0) {
@@ -435,7 +435,7 @@ public class JAXBDataBinding extends Abs
         }
         return tns;
     }
-    
+
     public void setExtraClass(Class[] userExtraClass) {
         extraClass = userExtraClass;
     }
@@ -456,11 +456,11 @@ public class JAXBDataBinding extends Abs
     public JAXBContext createJAXBContext(Set<Class<?>> classes, String defaultNs) throws JAXBException {
         return createJAXBContextAndSchemas(classes, defaultNs).getContext();
     }
-    
+
     public CachedContextAndSchemas createJAXBContextAndSchemas(Set<Class<?>> classes,
-                                                               String defaultNs) 
+                                                               String defaultNs)
         throws JAXBException {
-        
+
         // add user extra class into jaxb context
         if (extraClass != null && extraClass.length > 0) {
             for (Class clz : extraClass) {
@@ -512,8 +512,8 @@ public class JAXBDataBinding extends Abs
 
         return cachedContextAndSchemas;
     }
-    
-    private JAXBContext createContext(Set<Class<?>> classes, 
+
+    private JAXBContext createContext(Set<Class<?>> classes,
                                       Map<String, Object> map)
         throws JAXBException {
         JAXBContext ctx;
@@ -537,22 +537,22 @@ public class JAXBDataBinding extends Abs
                     if ("createContext".equals(m.getName())
                         && m.getParameterTypes().length == 9) {
                         try {
-                            return (JAXBContext)m.invoke(null, 
+                            return (JAXBContext)m.invoke(null,
                                      classes.toArray(new Class[classes.size()]),
                                      typeRefs,
                                      map.get(pfx + "subclassReplacements"),
                                      map.get(pfx + "defaultNamespaceRemap"),
                                      map.get(pfx + "c14n") == null
-                                         ? Boolean.FALSE 
+                                         ? Boolean.FALSE
                                              : map.get(pfx + "c14n"),
                                      map.get(pfx + "v2.model.annotation.RuntimeAnnotationReader"),
-                                     map.get(pfx + "XmlAccessorFactory") == null 
-                                         ? Boolean.FALSE 
+                                     map.get(pfx + "XmlAccessorFactory") == null
+                                         ? Boolean.FALSE
                                              : map.get(pfx + "XmlAccessorFactory"),
                                      map.get(pfx + "treatEverythingNillable") == null
                                          ? Boolean.FALSE : map.get(pfx + "treatEverythingNillable"),
-                                     map.get("retainReferenceToInfo") == null 
-                                         ? Boolean.FALSE : map.get("retainReferenceToInfo")); 
+                                     map.get("retainReferenceToInfo") == null
+                                         ? Boolean.FALSE : map.get("retainReferenceToInfo"));
                         } catch (Throwable e) {
                             //ignore
                         }
@@ -574,11 +574,11 @@ public class JAXBDataBinding extends Abs
         }
         return ctx;
     }
-    
+
     private boolean checkObjectFactoryNamespaces(Class<?> clz) {
         for (Method meth : clz.getMethods()) {
             XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
-            if (decl != null 
+            if (decl != null
                 && XmlElementDecl.GLOBAL.class.equals(decl.scope())
                 && StringUtils.isEmpty(decl.namespace())) {
                 return true;
@@ -602,11 +602,11 @@ public class JAXBDataBinding extends Abs
             }
         }
     }
-    
+
     public Set<Class<?>> getContextClasses() {
         return Collections.unmodifiableSet(this.contextClasses);
     }
-    
+
     // Now we can not add all the classes that Jaxb needed into JaxbContext,
     // especially when
     // an ObjectFactory is pointed to by an jaxb @XmlElementDecl annotation
@@ -640,7 +640,7 @@ public class JAXBDataBinding extends Abs
     /**
      * Return a map of properties. These properties are passed to
      * JAXBContext.newInstance when this object creates a context.
-     * 
+     *
      * @return the map of JAXB context properties.
      */
     public Map<String, Object> getContextProperties() {
@@ -652,7 +652,7 @@ public class JAXBDataBinding extends Abs
      * JAXBContext.newInstance when this object creates a context. Note that if
      * you create a JAXB context elsewhere, you will not respect these
      * properties unless you handle it manually.
-     * 
+     *
      * @param contextProperties map of properties.
      */
     public void setContextProperties(Map<String, Object> contextProperties) {
@@ -663,7 +663,7 @@ public class JAXBDataBinding extends Abs
      * Return a map of properties. These properties are set into the JAXB
      * Marshaller (via Marshaller.setProperty(...) when the marshaller is
      * created.
-     * 
+     *
      * @return the map of JAXB marshaller properties.
      */
     public Map<String, Object> getMarshallerProperties() {
@@ -674,19 +674,19 @@ public class JAXBDataBinding extends Abs
      * Set a map of JAXB marshaller properties. These properties are set into
      * the JAXB Marshaller (via Marshaller.setProperty(...) when the marshaller
      * is created.
-     * 
+     *
      * @param marshallerProperties map of properties.
      */
     public void setMarshallerProperties(Map<String, Object> marshallerProperties) {
         this.marshallerProperties = marshallerProperties;
     }
-    
-    
+
+
     /**
      * Return a map of properties. These properties are set into the JAXB
      * Unmarshaller (via Unmarshaller.setProperty(...) when the unmarshaller is
      * created.
-     * 
+     *
      * @return the map of JAXB unmarshaller properties.
      */
     public Map<String, Object> getUnmarshallerProperties() {
@@ -697,13 +697,13 @@ public class JAXBDataBinding extends Abs
      * Set a map of JAXB unmarshaller properties. These properties are set into
      * the JAXB Unmarshaller (via Unmarshaller.setProperty(...) when the unmarshaller
      * is created.
-     * 
+     *
      * @param unmarshallerProperties map of properties.
      */
     public void setUnmarshallerProperties(Map<String, Object> unmarshallerProperties) {
         this.unmarshallerProperties = unmarshallerProperties;
     }
-    
+
     /**
      * Returns the Unmarshaller.Listener that will be registered on the Unmarshallers
      * @return
@@ -734,8 +734,8 @@ public class JAXBDataBinding extends Abs
     public void setMarshallerListener(Marshaller.Listener marshallerListener) {
         this.marshallerListener = marshallerListener;
     }
-    
-    
+
+
     public ValidationEventHandler getValidationEventHandler() {
         return validationEventHandler;
     }
@@ -744,7 +744,7 @@ public class JAXBDataBinding extends Abs
         this.validationEventHandler = validationEventHandler;
     }
 
-    
+
     public boolean isUnwrapJAXBElement() {
         return unwrapJAXBElement;
     }
@@ -768,15 +768,15 @@ public class JAXBDataBinding extends Abs
         List<Method> setMethods = new ArrayList<Method>(partNames.size());
         List<Method> jaxbMethods = new ArrayList<Method>(partNames.size());
         List<Field> fields = new ArrayList<Field>(partNames.size());
-        
+
         Method allMethods[] = wrapperType.getMethods();
         String packageName = PackageUtils.getPackageName(wrapperType);
-        
+
         //if wrappertype class is generated by ASM,getPackage() always return null
         if (wrapperType.getPackage() != null) {
             packageName = wrapperType.getPackage().getName();
         }
-        
+
         String objectFactoryClassName = packageName + ".ObjectFactory";
 
         Object objectFactory = null;
@@ -787,13 +787,13 @@ public class JAXBDataBinding extends Abs
         }
         Method allOFMethods[];
         if (objectFactory != null) {
-            allOFMethods = objectFactory.getClass().getMethods(); 
+            allOFMethods = objectFactory.getClass().getMethods();
         } else {
             allOFMethods = new Method[0];
         }
-        
+
         for (int x = 0; x < partNames.size(); x++) {
-            String partName = partNames.get(x);            
+            String partName = partNames.get(x);
             if (partName == null) {
                 getMethods.add(null);
                 setMethods.add(null);
@@ -801,21 +801,21 @@ public class JAXBDataBinding extends Abs
                 jaxbMethods.add(null);
                 continue;
             }
-            
+
             String elementType = elTypeNames.get(x);
-            
+
             String getAccessor = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.GETTER);
             String setAccessor = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.SETTER);
             Method getMethod = null;
             Method setMethod = null;
             Class<?> valueClass = wrapperType;
-            
-            try {               
-                getMethod = valueClass.getMethod(getAccessor, AbstractWrapperHelper.NO_CLASSES); 
+
+            try {
+                getMethod = valueClass.getMethod(getAccessor, AbstractWrapperHelper.NO_CLASSES);
             } catch (NoSuchMethodException ex) {
                 //ignore for now
             }
-            
+
             Field elField = getElField(partName, valueClass);
             if (getMethod == null
                 && elementType != null
@@ -823,15 +823,15 @@ public class JAXBDataBinding extends Abs
                 && (elField == null
                     || (!Collection.class.isAssignableFrom(elField.getType())
                     && !elField.getType().isArray()))) {
-        
+
                 try {
                     String newAcc = getAccessor.replaceFirst("get", "is");
-                    getMethod = wrapperType.getMethod(newAcc, AbstractWrapperHelper.NO_CLASSES); 
+                    getMethod = wrapperType.getMethod(newAcc, AbstractWrapperHelper.NO_CLASSES);
                 } catch (NoSuchMethodException ex) {
                     //ignore for now
-                }            
-            }                        
-            if (getMethod == null 
+                }
+            }
+            if (getMethod == null
                 && "return".equals(partName)) {
                 //RI generated code uses this
                 try {
@@ -842,14 +842,14 @@ public class JAXBDataBinding extends Abs
                                                           new Class[0]);
                     } catch (NoSuchMethodException ex2) {
                         //ignore for now
-                    } 
-                }                
+                    }
+                }
             }
             if (getMethod == null && elField != null) {
                 getAccessor = JAXBUtils.nameToIdentifier(elField.getName(), JAXBUtils.IdentifierType.GETTER);
                 setAccessor = JAXBUtils.nameToIdentifier(elField.getName(), JAXBUtils.IdentifierType.SETTER);
-                try {               
-                    getMethod = valueClass.getMethod(getAccessor, AbstractWrapperHelper.NO_CLASSES); 
+                try {
+                    getMethod = valueClass.getMethod(getAccessor, AbstractWrapperHelper.NO_CLASSES);
                 } catch (NoSuchMethodException ex) {
                     //ignore for now
                 }
@@ -868,12 +868,12 @@ public class JAXBDataBinding extends Abs
                     break;
                 }
             }
-            
+
             getMethods.add(getMethod);
             setMethods.add(setMethod);
             if (setMethod != null
                 && JAXBElement.class.isAssignableFrom(setMethod.getParameterTypes()[0])) {
-                
+
                 Type t = setMethod.getGenericParameterTypes()[0];
                 Class<?> pcls = null;
                 if (t instanceof ParameterizedType) {
@@ -882,7 +882,7 @@ public class JAXBDataBinding extends Abs
                 if (t instanceof Class) {
                     pcls = (Class)t;
                 }
-                
+
                 String methodName = "create" + wrapperType.getSimpleName()
                     + setMethod.getName().substring(3);
 
@@ -897,7 +897,7 @@ public class JAXBDataBinding extends Abs
             } else {
                 jaxbMethods.add(null);
             }
-            
+
             if (elField != null) {
                 // JAXB Type get XmlElement Annotation
                 XmlElement el = elField.getAnnotation(XmlElement.class);
@@ -909,22 +909,22 @@ public class JAXBDataBinding extends Abs
                 } else {
                     if (getMethod == null && setMethod == null) {
                         if (el != null) {
-                            LOG.warning("Could not create accessor for property " + partName 
+                            LOG.warning("Could not create accessor for property " + partName
                                         + " of type " + wrapperType.getName() + " as the @XmlElement "
                                         + "defines the name as " + el.name());
                         } else {
-                            LOG.warning("Could not create accessor for property " + partName 
+                            LOG.warning("Could not create accessor for property " + partName
                                         + " of type " + wrapperType.getName());
                         }
                     }
                     fields.add(null);
-                } 
+                }
             } else {
                 fields.add(null);
             }
-            
+
         }
-        
+
         return createWrapperHelper(wrapperType,
                                  setMethods.toArray(new Method[setMethods.size()]),
                                  getMethods.toArray(new Method[getMethods.size()]),
@@ -932,7 +932,7 @@ public class JAXBDataBinding extends Abs
                                  fields.toArray(new Field[fields.size()]),
                                  objectFactory);
     }
-    
+
     private static Field getElField(String partName, Class<?> wrapperType) {
         String fieldName = JAXBUtils.nameToIdentifier(partName, JAXBUtils.IdentifierType.VARIABLE);
         for (Field field : wrapperType.getDeclaredFields()) {
@@ -944,11 +944,11 @@ public class JAXBDataBinding extends Abs
             if (field.getName().equals(fieldName)) {
                 return field;
             }
-        }        
+        }
         return null;
     }
 
-    
+
     private static WrapperHelper createWrapperHelper(Class<?> wrapperType, Method setMethods[],
                                                      Method getMethods[], Method jaxbMethods[],
                                                      Field fields[], Object objectFactory) {
@@ -974,8 +974,8 @@ public class JAXBDataBinding extends Abs
             // ASM not found, just use reflection based stuff
         }
         return null;
-    }   
-    
+    }
+
     public List<Interceptor<? extends Message>> getOutFaultInterceptors() {
         return outFault;
     }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Thu Nov 11 20:58:46 2010
@@ -96,21 +96,21 @@ public class JaxWsServiceFactoryBean ext
     // used to tag property on service.
     public static final  String WS_FEATURES = "JAXWS-WS-FEATURES";
     private static final Logger LOG = LogUtils.getLogger(JaxWsServiceFactoryBean.class);
-    
+
     private AbstractServiceConfiguration jaxWsConfiguration;
 
     private JaxWsImplementorInfo implInfo;
 
     private List<WebServiceFeature> setWsFeatures;
     private List<WebServiceFeature> wsFeatures;
-    
+
     private boolean wrapperBeanGenerated;
     private Set<Class<?>> wrapperClasses;
-    
-    
+
+
     public JaxWsServiceFactoryBean() {
         getIgnoredClasses().add(Service.class.getName());
-        
+
         //the JAXWS-RI doesn't qualify the schemas for the wrapper types
         //and thus won't work if we do.
         setQualifyWrapperSchema(false);
@@ -125,7 +125,7 @@ public class JaxWsServiceFactoryBean ext
         this.serviceType = implInfo.getSEIType();
         loadWSFeatureAnnotation(implInfo.getSEIClass(), implInfo.getImplementorClass());
     }
-    
+
     @Override
     public void reset() {
         super.reset();
@@ -134,13 +134,13 @@ public class JaxWsServiceFactoryBean ext
     }
 
     private void initSchemaLocations() {
-        this.schemaLocationMapping.put(JAXWSAConstants.NS_WSA, 
+        this.schemaLocationMapping.put(JAXWSAConstants.NS_WSA,
                                        JAXWSAConstants.WSA_XSD);
     }
 
     private void loadWSFeatureAnnotation(Class<?> serviceClass, Class<?> implementorClass) {
         List<WebServiceFeature> features = new ArrayList<WebServiceFeature>();
-        MTOM mtom = implInfo.getImplementorClass().getAnnotation(MTOM.class);        
+        MTOM mtom = implInfo.getImplementorClass().getAnnotation(MTOM.class);
         if (mtom == null && serviceClass != null) {
             mtom = serviceClass.getAnnotation(MTOM.class);
         }
@@ -152,10 +152,10 @@ public class JaxWsServiceFactoryBean ext
             if (bt != null
                 && (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bt.value())
                 || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bt.value()))) {
-                features.add(new MTOMFeature(true));                
+                features.add(new MTOMFeature(true));
             }
         }
-        
+
 
         Addressing addressing = null;
         if (implementorClass != null) {
@@ -171,7 +171,7 @@ public class JaxWsServiceFactoryBean ext
                 try {
                     Method method = Addressing.class.getMethod("responses", new Class<?>[]{});
                     Object responses = method.invoke(addressing, new Object[]{});
-                    java.lang.reflect.Constructor<?> constructor = 
+                    java.lang.reflect.Constructor<?> constructor =
                         AddressingFeature.class.getConstructor(new Class[] {
                             boolean.class, boolean.class, responses.getClass()
                         });
@@ -184,7 +184,7 @@ public class JaxWsServiceFactoryBean ext
             } else {
                 features.add(new AddressingFeature(addressing.enabled(), addressing.required()));
             }
-            
+
         }
 
         if (features.size() > 0) {
@@ -200,11 +200,11 @@ public class JaxWsServiceFactoryBean ext
     @Override
     public org.apache.cxf.service.Service create() {
         org.apache.cxf.service.Service s = super.create();
-        
+
         s.put(ENDPOINT_CLASS, implInfo.getEndpointClass());
-        
+
         if (s.getDataBinding() != null) {
-            setMTOMThreshold(s.getDataBinding());
+            setMTOMFeatures(s.getDataBinding());
         }
         return s;
     }
@@ -231,8 +231,8 @@ public class JaxWsServiceFactoryBean ext
     }
 
     @Override
-    public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {        
-        Endpoint ep = new JaxWsEndpointImpl(getBus(), getService(), ei, implInfo, wsFeatures, 
+    public Endpoint createEndpoint(EndpointInfo ei) throws EndpointException {
+        Endpoint ep = new JaxWsEndpointImpl(getBus(), getService(), ei, implInfo, wsFeatures,
                                      this.getFeatures(), this.isFromWsdl());
         sendEvent(FactoryBeanListener.Event.ENDPOINT_CREATED, ei, ep);
         return ep;
@@ -255,9 +255,9 @@ public class JaxWsServiceFactoryBean ext
 
         sendEvent(Event.INTERFACE_OPERATION_BOUND, o, method);
     }
-    
+
     protected void bindOperation(OperationInfo op, Method method) {
-        
+
         try {
             // Find the Async method which returns a Response
             Method responseMethod = method.getDeclaringClass().getDeclaredMethod(method.getName() + "Async",
@@ -295,12 +295,12 @@ public class JaxWsServiceFactoryBean ext
         if (c == null) {
             throw new ServiceConstructionException(new Message("INVALID_PROVIDER_EXC", LOG));
         }
-        
+
         if (getEndpointInfo() == null
             && isFromWsdl()) {
             //most likely, they specified a WSDL, but for some reason
             //did not give a valid ServiceName/PortName.  For provider,
-            //we'll allow this since everything is bound directly to 
+            //we'll allow this since everything is bound directly to
             //the invoke method, however, this CAN cause other problems
             //such as addresses in the wsdl not getting updated and such
             //so we'll WARN about it.....
@@ -310,14 +310,14 @@ public class JaxWsServiceFactoryBean ext
                     enames.add(ep.getName());
                 }
             }
-            LOG.log(Level.WARNING, "COULD_NOT_FIND_ENDPOINT", 
+            LOG.log(Level.WARNING, "COULD_NOT_FIND_ENDPOINT",
                     new Object[] {getEndpointName(), enames});
         }
-        
+
         try {
             Method invoke = getServiceClass().getMethod("invoke", c);
             QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke");
-            
+
             // Bind every operation to the invoke method.
             for (ServiceInfo si : getService().getServiceInfos()) {
                 si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
@@ -363,8 +363,8 @@ public class JaxWsServiceFactoryBean ext
                             mpi.setElement(true);
                             mpi.setTypeClass(c);
                             mpi.setTypeQName(XMLSchemaQNames.XSD_ANY);
-                            
-                            mInfo = op.createMessage(new QName(catchAll.getNamespaceURI(), 
+
+                            mInfo = op.createMessage(new QName(catchAll.getNamespaceURI(),
                                                                name + "Response"),
                                                                MessageInfo.Type.OUTPUT);
                             op.setOutput(name + "Response", mInfo);
@@ -372,7 +372,7 @@ public class JaxWsServiceFactoryBean ext
                             mpi.setElement(true);
                             mpi.setTypeClass(c);
                             mpi.setTypeQName(XMLSchemaQNames.XSD_ANY);
-                        
+
                             BindingOperationInfo bo = new BindingOperationInfo(bind, op);
                             op.setProperty("operation.is.synthetic", Boolean.TRUE);
                             bo.setProperty("operation.is.synthetic", Boolean.TRUE);
@@ -387,7 +387,7 @@ public class JaxWsServiceFactoryBean ext
             throw new ServiceConstructionException(e);
         }
 
-        
+
     }
 
     protected Class<?> getProviderParameterType(Class<?> cls) {
@@ -396,7 +396,7 @@ public class JaxWsServiceFactoryBean ext
         }
         Type[] genericInterfaces = cls.getGenericInterfaces();
         for (Type type : genericInterfaces) {
-            if (type instanceof ParameterizedType) { 
+            if (type instanceof ParameterizedType) {
                 Class<?> rawCls = (Class<?>)((ParameterizedType)type).getRawType();
                 if (Provider.class == rawCls) {
                     return (Class<?>)((ParameterizedType)type).getActualTypeArguments()[0];
@@ -407,7 +407,7 @@ public class JaxWsServiceFactoryBean ext
         }
         return getProviderParameterType(cls.getSuperclass());
     }
-    
+
     void initializeWrapping(OperationInfo o, Method selected) {
         Class responseWrapper = getResponseWrapper(selected);
         if (responseWrapper != null) {
@@ -454,7 +454,7 @@ public class JaxWsServiceFactoryBean ext
                 //ignore
             }
         }
-        
+
         return super.getBeanClass(exClass);
     }
 
@@ -484,7 +484,7 @@ public class JaxWsServiceFactoryBean ext
             jaxWsConfiguration = new JaxWsServiceConfiguration();
             jaxWsConfiguration.setServiceFactory(this);
             getServiceConfigurations().add(0, jaxWsConfiguration);
-            
+
             Class<?> seiClass = ii.getEndpointClass();
             if (seiClass != null && seiClass.getPackage() != null) {
                 XmlSchema schema = seiClass.getPackage().getAnnotation(XmlSchema.class);
@@ -494,7 +494,7 @@ public class JaxWsServiceFactoryBean ext
             }
             setMethodDispatcher(new JAXWSMethodDispatcher(implInfo));
         }
-        loadWSFeatureAnnotation(ii.getSEIClass(), ii.getImplementorClass());        
+        loadWSFeatureAnnotation(ii.getSEIClass(), ii.getImplementorClass());
     }
 
     public List<WebServiceFeature> getWsFeatures() {
@@ -534,7 +534,7 @@ public class JaxWsServiceFactoryBean ext
             inputAction = action.input();
         }
         if (wm != null && StringUtils.isEmpty(inputAction)) {
-            inputAction = wm.action(); 
+            inputAction = wm.action();
         }
         if (StringUtils.isEmpty(inputAction)) {
             inputAction = computeAction(operation, "Request");
@@ -590,17 +590,17 @@ public class JaxWsServiceFactoryBean ext
         for (FaultInfo fi : operation.getFaults()) {
             if (fi.getExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME) == null) {
                 String f = "/Fault/" + fi.getName().getLocalPart();
-                fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
+                fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME,
                                          computeAction(operation, f));
                 if (operation.isUnwrappedCapable()) {
                     fi = operation.getUnwrappedOperation().getFault(fi.getName());
-                    fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME, 
+                    fi.addExtensionAttribute(JAXWSAConstants.WSAM_ACTION_QNAME,
                                              computeAction(operation, f));
-                }                
+                }
             }
         }
     }
-    
+
     private String computeAction(OperationInfo op, String postFix) {
         StringBuilder s = new StringBuilder(op.getName().getNamespaceURI());
         if (s.charAt(s.length() - 1) != '/') {
@@ -620,7 +620,7 @@ public class JaxWsServiceFactoryBean ext
         buildWSAActions(op, m);
         return op;
     }
-    
+
     @Override
     protected Set<Class<?>> getExtraClass() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
@@ -630,54 +630,57 @@ public class JaxWsServiceFactoryBean ext
         if (wrapperClasses != null) {
             classes.addAll(wrapperClasses);
         }
-        
+
         XmlSeeAlso xmlSeeAlsoAnno = getServiceClass().getAnnotation(XmlSeeAlso.class);
-        
+
         if (xmlSeeAlsoAnno != null && xmlSeeAlsoAnno.value() != null) {
             for (int i = 0; i < xmlSeeAlsoAnno.value().length; i++) {
                 Class<?> value = xmlSeeAlsoAnno.value()[i];
                 if (value == null) {
-                    LOG.log(Level.WARNING, "XMLSEEALSO_NULL_CLASS", 
+                    LOG.log(Level.WARNING, "XMLSEEALSO_NULL_CLASS",
                             new Object[] {getServiceClass().getName(), i});
                 } else {
                     classes.add(value);
                 }
-                
+
             }
         }
         return classes;
     }
-    
+
     private Set<Class<?>> generatedWrapperBeanClass() {
         DataBinding b = getDataBinding();
-        if (b.getClass().getName().endsWith("JAXBDataBinding") 
+        if (b.getClass().getName().endsWith("JAXBDataBinding")
             && schemaLocations == null) {
             ServiceInfo serviceInfo = getService().getServiceInfos().get(0);
             WrapperClassGenerator wrapperGen = new WrapperClassGenerator(this,
                                                                          serviceInfo.getInterface(),
                                                                          getQualifyWrapperSchema());
-            return wrapperGen.generate();            
+            return wrapperGen.generate();
         }
         return Collections.emptySet();
     }
 
-    private void setMTOMThreshold(DataBinding databinding) {
+    private void setMTOMFeatures(DataBinding databinding) {
         if (this.wsFeatures != null) {
             for (WebServiceFeature wsf : this.wsFeatures) {
-                if (wsf instanceof MTOMFeature && ((MTOMFeature)wsf).getThreshold() > 0) {
-                    databinding.setMtomThreshold(((MTOMFeature)wsf).getThreshold());
+                if (wsf instanceof MTOMFeature) {
+                    databinding.setMtomEnabled(true);
+                    MTOMFeature f = (MTOMFeature) wsf;
+                    if (f.getThreshold() > 0) {
+                        databinding.setMtomThreshold(((MTOMFeature)wsf).getThreshold());
+                    }
                 }
-
             }
         }
     }
-    
+
     @Override
     protected void buildServiceFromClass() {
         super.buildServiceFromClass();
-        getService().put(WS_FEATURES, getWsFeatures()); 
+        getService().put(WS_FEATURES, getWsFeatures());
     }
-    
+
     protected void initializeParameter(MessagePartInfo part, Class rawClass, Type type) {
         if (implInfo.isWebServiceProvider()) {
             part.setTypeQName(XMLSchemaQNames.XSD_ANY);

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/MtomTest.java Thu Nov 11 20:58:46 2010
@@ -36,8 +36,11 @@ import org.apache.cxf.aegis.type.mtom.Ab
 import org.apache.cxf.common.util.SOAPConstants;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.systest.aegis.mtom.fortest.DataHandlerBean;
 import org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl;
+import org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService;
 import org.apache.cxf.test.TestUtilities;
 import org.apache.cxf.testutil.common.TestUtil;
 
@@ -54,8 +57,9 @@ import org.springframework.test.context.
 public class MtomTest extends AbstractJUnit4SpringContextTests {
     static final String PORT = TestUtil.getPortNumber(MtomTest.class);
 
-    private org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl impl;
-    private org.apache.cxf.systest.aegis.mtom.fortest.MtomTest client;
+    private MtomTestImpl impl;
+    private MtomTestService client;
+    private MtomTestService jaxwsClient;
     private TestUtilities testUtilities;
     
     public MtomTest() {
@@ -68,27 +72,43 @@ public class MtomTest extends AbstractJU
         ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
         proxyFac.setDataBinding(aegisBinding);
         proxyFac.setAddress("http://localhost:" + PORT + "/mtom");
-        proxyFac.setServiceClass(org.apache.cxf.systest.aegis.mtom.fortest.MtomTest.class);
+
+        JaxWsProxyFactoryBean jaxwsFac = new JaxWsProxyFactoryBean();
+        jaxwsFac.setDataBinding(new AegisDatabinding());
+        jaxwsFac.setAddress("http://localhost:" + PORT + "/jaxWsMtom");
+
         Map<String, Object> props = new HashMap<String, Object>();
         if (enableClientMTOM) {
             props.put("mtom-enabled", Boolean.TRUE);
         }
         proxyFac.setProperties(props);
 
-        client = (org.apache.cxf.systest.aegis.mtom.fortest.MtomTest)proxyFac.create();
+        client = (org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService)
+            proxyFac.create(MtomTestService.class);
+        jaxwsClient = jaxwsFac.create(MtomTestService.class);
         impl = (MtomTestImpl)applicationContext.getBean("mtomImpl");
     }
-    
-    
-    @Test 
+
+    @Test
     public void testMtomReply() throws Exception {
         setupForTest(true);
         DataHandlerBean dhBean = client.produceDataHandlerBean();
         Assert.assertNotNull(dhBean);
-        Assert.assertEquals(MtomTestImpl.STRING_DATA, dhBean.getDataHandler().getContent());
+        String result = IOUtils.toString(dhBean.getDataHandler().getInputStream(), "utf-8");
+        Assert.assertEquals(MtomTestImpl.STRING_DATA, result);
     }
 
-    @Test 
+    //TODO: how do we see if MTOM actually happened?
+    @Test
+    public void testJaxWsMtomReply() throws Exception {
+        setupForTest(true);
+        DataHandlerBean dhBean = jaxwsClient.produceDataHandlerBean();
+        Assert.assertNotNull(dhBean);
+        String result = IOUtils.toString(dhBean.getDataHandler().getInputStream(), "utf-8");
+        Assert.assertEquals(MtomTestImpl.STRING_DATA, result);
+    }
+
+    @Test
     public void testAcceptDataHandler() throws Exception {
         setupForTest(true);
         DataHandlerBean dhBean = new DataHandlerBean();
@@ -129,7 +149,7 @@ public class MtomTest extends AbstractJU
         testUtilities.addNamespace("xmime", "http://www.w3.org/2005/05/xmlmime");
         Server s = testUtilities.
             getServerForService(new QName("http://fortest.mtom.aegis.systest.cxf.apache.org/", 
-                                          "MtomTest"));
+                                          "MtomTestService"));
         Document wsdl = testUtilities.getWSDLDocument(s); 
         Assert.assertNotNull(wsdl);
         NodeList typeAttrList = 

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/mtom/fortest/MtomTestImpl.java Thu Nov 11 20:58:46 2010
@@ -21,17 +21,18 @@ package org.apache.cxf.systest.aegis.mto
 
 import javax.activation.DataHandler;
 import javax.jws.WebService;
+import javax.xml.ws.soap.MTOM;
 
 /**
- * 
+ *
  */
 @WebService
-@javax.xml.ws.soap.MTOM
-public class MtomTestImpl implements MtomTest {
-    
+@MTOM
+public class MtomTestImpl implements MtomTestService {
+
     public static final String STRING_DATA = "What rough beast, its hour come at last,"
         + " slouches toward Bethlehem to be born?";
-            
+
     private DataHandlerBean lastDhBean;
 
     /** {@inheritDoc}*/
@@ -46,7 +47,7 @@ public class MtomTestImpl implements Mto
     public DataHandlerBean produceDataHandlerBean() {
         DataHandlerBean dhBean = new DataHandlerBean();
         dhBean.setName("legion");
-        // since we know that the code has no lower threshold for using attachments, 
+        // since we know that the code has no lower threshold for using attachments,
         // we can just return a fairly short string.
         dhBean.setDataHandler(new DataHandler(STRING_DATA, "text/plain;charset=utf-8"));
         return dhBean;

Modified: cxf/branches/2.3.x-fixes/systests/databinding/src/test/resources/mtomTestBeans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/databinding/src/test/resources/mtomTestBeans.xml?rev=1034117&r1=1034116&r2=1034117&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/databinding/src/test/resources/mtomTestBeans.xml (original)
+++ cxf/branches/2.3.x-fixes/systests/databinding/src/test/resources/mtomTestBeans.xml Thu Nov 11 20:58:46 2010
@@ -1,30 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-	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.
--->
+<!-- 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. -->
 
 <beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:simple="http://cxf.apache.org/simple"
-	xmlns:jaxws="http://cxf.apache.org/jaxws"
-	xmlns:cxf="http://cxf.apache.org/core"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:simple="http://cxf.apache.org/simple"
+	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core"
 	xsi:schemaLocation="
-http://www.springframework.org/schema/beans 
+http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://cxf.apache.org/simple
 http://cxf.apache.org/schemas/simple.xsd
@@ -37,29 +27,40 @@ http://cxf.apache.org/core http://cxf.ap
 	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
 
-    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-	
-    <cxf:bus>
-      <cxf:features>
-          <cxf:logging/>
-      </cxf:features>
-    </cxf:bus> 
+	<bean
+		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
 
-	<bean id="mtomImpl"
-		class="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl" />
+	<bean id="mtomImpl" class="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestImpl" />
 
-	<simple:server id="mtom-server" address="http://localhost:${testutil.ports.MtomTest}/mtom"
-		serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTest">
+	<bean id="aegisBean"
+		class="org.apache.cxf.aegis.databinding.AegisDatabinding"
+		scope="prototype" />
+
+	<bean id="jaxws-and-aegis-service-factory" class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
+		scope="prototype">
+		<property name="dataBinding" ref="aegisBean" />
+	</bean>
+
+
+	<jaxws:endpoint id="mtom-jaxws-service" implementor="#mtomImpl"
+		address="http://localhost:${testutil.ports.MtomTest}/jaxWsMtom">
+		<jaxws:serviceFactory>
+			<ref bean='jaxws-and-aegis-service-factory' />
+		</jaxws:serviceFactory>
+	</jaxws:endpoint>
+
+
+	<simple:server id="mtom-server"
+		address="http://localhost:${testutil.ports.MtomTest}/mtom"
+		serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService">
 		<simple:dataBinding>
-			<bean
-				class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>
+			<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
 		</simple:dataBinding>
 		<simple:serviceBean>
 			<ref bean="mtomImpl" />
 		</simple:serviceBean>
 		<simple:serviceFactory>
-			<bean
-				class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
+			<bean class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
 				<property name="properties">
 					<map>
 						<entry key="mtom-enabled">
@@ -70,22 +71,21 @@ http://cxf.apache.org/core http://cxf.ap
 			</bean>
 		</simple:serviceFactory>
 	</simple:server>
-	
-	<simple:server id="mtom-xmime-server" address="http://localhost:${testutil.ports.MtomTest}/mtomXmime"
-		serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTest">
+
+	<simple:server id="mtom-xmime-server"
+		address="http://localhost:${testutil.ports.MtomTest}/mtomXmime"
+		serviceClass="org.apache.cxf.systest.aegis.mtom.fortest.MtomTestService">
 		<simple:dataBinding>
-			<bean
-				class="org.apache.cxf.aegis.databinding.AegisDatabinding">
+			<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding">
 				<property name="mtomEnabled" value="true" />
-				<property name="mtomUseXmime" value="true"/>
+				<property name="mtomUseXmime" value="true" />
 			</bean>
 		</simple:dataBinding>
 		<simple:serviceBean>
 			<ref bean="mtomImpl" />
 		</simple:serviceBean>
 		<simple:serviceFactory>
-			<bean
-				class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
+			<bean class='org.apache.cxf.service.factory.ReflectionServiceFactoryBean'>
 				<property name="properties">
 					<map>
 						<entry key="mtom-enabled">