Author: dkulp Date: Tue Jul 28 01:20:20 2009 New Revision: 798352 URL: http://svn.apache.org/viewvc?rev=798352&view=rev Log: Merged revisions 798349 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes
................ r798349 | dkulp | 2009-07-27 21:11:50 -0400 (Mon, 27 Jul 2009) | 12 lines Merged revisions 798345 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r798345 | dkulp | 2009-07-27 21:07:44 -0400 (Mon, 27 Jul 2009) | 4 lines Allow databindings to be optionally be InterceptorProviders Hack around the JAXB attachment schema-validation issue by forcing it to load the attachments (which validation would do anyway) and locking them to keep them from being deleted during the extent of the reading. ........ ................ Added: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java - copied unchanged from r798349, cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/attachment/JAXBAttachmentSchemaValidationHack.java Modified: cxf/branches/2.1.x-fixes/ (props changed) cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java cxf/branches/2.1.x-fixes/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/InFaultChainInitiatorObserver.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutFaultChainInitiatorObserver.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jul 28 01:20:20 2009 @@ -1,2 +1,2 @@ -/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348 -/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344 +/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276,787282-787283,787285,787295,787307,787324,7873 67,788824-788825,788827-788828,788830,789423,789429,789707,789709-789710,789712,789721,789905,789908,789910,789912,790295,790646-790647,790651,790654-790655,790659,791948,791950,791952,791955,792276,792288,792291,792992,792995,792998,794402,794404,794735,794797,794799,794803,795161-795162,796300-796301,796598,797449,797452-797453,797460,797463-797464,797521-797522,797584-797585,797645,797652,797701,797884,797886,798348-798349 +/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269,787277-787279,787290,787305,787323,787366,788060,788187,788703,788774,788820,789371,789420,789527-789529,789704-789705,789896,789898-789900,790294,790637-790644,791354,791538,791753,791947,792261-792263,792684,792975,792985,794297,794396,794728,794778-794780,794892,795160,796022-796023,796593,796780,797194,797231-797233,797442,797505,797517,797581-797582,797640,797651,797699,797882-797883,798344-798345 Propchange: cxf/branches/2.1.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original) +++ cxf/branches/2.1.x-fixes/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Tue Jul 28 01:20:20 2009 @@ -76,6 +76,7 @@ private boolean tempFileFailed; private File tempFile; private File outputDir = DEFAULT_TEMP_DIR; + private boolean allowDeleteOfFile = true; private List<CachedOutputStreamCallback> callbacks; @@ -97,6 +98,13 @@ inmem = true; } + public void holdTempFile() { + allowDeleteOfFile = false; + } + public void releaseTempFileHold() { + allowDeleteOfFile = true; + } + public void registerCallback(CachedOutputStreamCallback cb) { if (null == callbacks) { callbacks = new ArrayList<CachedOutputStreamCallback>(); @@ -451,7 +459,7 @@ private void maybeDeleteTempFile(Object stream) { streamList.remove(stream); - if (!inmem && tempFile != null && streamList.isEmpty()) { + if (!inmem && tempFile != null && streamList.isEmpty() && allowDeleteOfFile) { if (currentStream != null) { try { currentStream.close(); Modified: cxf/branches/2.1.x-fixes/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java (original) +++ cxf/branches/2.1.x-fixes/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocUtil.java Tue Jul 28 01:20:20 2009 @@ -30,6 +30,7 @@ import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.InterceptorChain; +import org.apache.cxf.interceptor.InterceptorProvider; import org.apache.cxf.message.Exchange; import org.apache.cxf.phase.Phase; import org.apache.cxf.phase.PhaseInterceptorChain; @@ -83,6 +84,15 @@ LOG.fine("Interceptors contributed by bus: " + il); } chain.add(il); + + if (ep.getService().getDataBinding() instanceof InterceptorProvider) { + il = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Interceptors contributed by databinding: " + il); + } + chain.add(il); + + } return chain; } @@ -107,6 +117,14 @@ LOG.fine("Interceptors contributed by bus: " + il); } chain.add(il); + + if (ep.getService().getDataBinding() instanceof InterceptorProvider) { + il = ((InterceptorProvider)ep.getService().getDataBinding()).getInInterceptors(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Interceptors contributed by databinding: " + il); + } + chain.add(il); + } chain.setFaultObserver(new ColocOutFaultObserver(bus)); return chain; Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDataSource.java Tue Jul 28 01:20:20 2009 @@ -40,6 +40,13 @@ cache.lockOutputStream(); } + public void hold() { + cache.holdTempFile(); + } + public void release() { + cache.releaseTempFileHold(); + } + public String getContentType() { return ct; } Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Jul 28 01:20:20 2009 @@ -46,6 +46,7 @@ import org.apache.cxf.interceptor.ClientOutFaultObserver; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.InterceptorChain; +import org.apache.cxf.interceptor.InterceptorProvider; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; @@ -615,7 +616,17 @@ LOG.fine("Interceptors contributed by binding: " + i4); } - PhaseInterceptorChain chain = inboundChainCache.get(pm.getInPhases(), i1, i2, i3, i4); + PhaseInterceptorChain chain; + if (endpoint.getService().getDataBinding() instanceof InterceptorProvider) { + InterceptorProvider p = (InterceptorProvider)endpoint.getService().getDataBinding(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Interceptors contributed by databinging: " + p.getInInterceptors()); + } + chain = inboundChainCache.get(pm.getInPhases(), i1, i2, i3, i4, + p.getInInterceptors()); + } else { + chain = inboundChainCache.get(pm.getInPhases(), i1, i2, i3, i4); + } message.setInterceptorChain(chain); chain.setFaultObserver(outFaultObserver); @@ -782,6 +793,16 @@ if (LOG.isLoggable(Level.FINE)) { LOG.fine("Interceptors contributed by binding: " + i4); } + List<Interceptor> i5 = null; + if (endpoint.getService().getDataBinding() instanceof InterceptorProvider) { + i5 = ((InterceptorProvider)endpoint.getService().getDataBinding()).getOutInterceptors(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Interceptors contributed by databinding: " + i5); + } + } + if (i5 != null) { + return outboundChainCache.get(pm.getOutPhases(), i1, i2, i3, i4, i5); + } return outboundChainCache.get(pm.getOutPhases(), i1, i2, i3, i4); } Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/InFaultChainInitiatorObserver.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/InFaultChainInitiatorObserver.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/InFaultChainInitiatorObserver.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/InFaultChainInitiatorObserver.java Tue Jul 28 01:20:20 2009 @@ -45,6 +45,9 @@ chain.add(e.getService().getInFaultInterceptors()); chain.add(e.getInFaultInterceptors()); chain.add(e.getBinding().getInFaultInterceptors()); + if (e.getService().getDataBinding() instanceof InterceptorProvider) { + chain.add(((InterceptorProvider)e.getService().getDataBinding()).getInFaultInterceptors()); + } } protected SortedSet<Phase> getPhases() { Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutFaultChainInitiatorObserver.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutFaultChainInitiatorObserver.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutFaultChainInitiatorObserver.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutFaultChainInitiatorObserver.java Tue Jul 28 01:20:20 2009 @@ -45,6 +45,9 @@ chain.add(e.getService().getOutFaultInterceptors()); chain.add(e.getOutFaultInterceptors()); chain.add(e.getBinding().getOutFaultInterceptors()); + if (e.getService().getDataBinding() instanceof InterceptorProvider) { + chain.add(((InterceptorProvider)e.getService().getDataBinding()).getOutFaultInterceptors()); + } } protected SortedSet<Phase> getPhases() { Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java Tue Jul 28 01:20:20 2009 @@ -146,14 +146,28 @@ LOG.fine("Interceptors contributed by endpoint: " + i3); } List<Interceptor> i4 = null; - PhaseInterceptorChain chain; if (binding != null) { i4 = binding.getOutInterceptors(); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Interceptors contributed by binding: " + i4); } } - if (i4 != null) { + List<Interceptor> i5 = null; + if (ep.getService().getDataBinding() instanceof InterceptorProvider) { + i5 = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors(); + if (LOG.isLoggable(Level.FINE)) { + LOG.fine("Interceptors contributed by databinding: " + i5); + } + if (i4 == null) { + i4 = i5; + i5 = null; + } + } + PhaseInterceptorChain chain; + if (i5 != null) { + chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(), + i1, i2, i3, i4, i5); + } else if (i4 != null) { chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(), i1, i2, i3, i4); } else { Modified: cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original) +++ cxf/branches/2.1.x-fixes/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Tue Jul 28 01:20:20 2009 @@ -30,6 +30,7 @@ import org.apache.cxf.binding.Binding; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.interceptor.InterceptorChain; +import org.apache.cxf.interceptor.InterceptorProvider; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; @@ -74,12 +75,26 @@ exchange.setInMessage(message); setExchangeProperties(exchange, message); + InterceptorProvider dbp = null; + if (endpoint.getService().getDataBinding() instanceof InterceptorProvider) { + dbp = (InterceptorProvider)endpoint.getService().getDataBinding(); + } // setup chain - phaseChain = chainCache.get(bus.getExtension(PhaseManager.class).getInPhases(), - bus.getInInterceptors(), - endpoint.getService().getInInterceptors(), - endpoint.getInInterceptors(), - getBinding().getInInterceptors()); + if (dbp == null) { + phaseChain = chainCache.get(bus.getExtension(PhaseManager.class).getInPhases(), + bus.getInInterceptors(), + endpoint.getService().getInInterceptors(), + endpoint.getInInterceptors(), + getBinding().getInInterceptors()); + } else { + phaseChain = chainCache.get(bus.getExtension(PhaseManager.class).getInPhases(), + bus.getInInterceptors(), + endpoint.getService().getInInterceptors(), + endpoint.getInInterceptors(), + getBinding().getInInterceptors(), + dbp.getInInterceptors()); + } + message.setInterceptorChain(phaseChain); Modified: cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original) +++ cxf/branches/2.1.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Tue Jul 28 01:20:20 2009 @@ -67,6 +67,7 @@ import org.apache.cxf.common.i18n.Message; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.CacheMap; +import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList; import org.apache.cxf.common.util.PackageUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.common.xmlschema.SchemaCollection; @@ -77,6 +78,9 @@ import org.apache.cxf.databinding.WrapperCapableDatabinding; import org.apache.cxf.databinding.WrapperHelper; import org.apache.cxf.helpers.XMLUtils; +import org.apache.cxf.interceptor.Interceptor; +import org.apache.cxf.interceptor.InterceptorProvider; +import org.apache.cxf.jaxb.attachment.JAXBAttachmentSchemaValidationHack; import org.apache.cxf.jaxb.io.DataReaderImpl; import org.apache.cxf.jaxb.io.DataWriterImpl; import org.apache.cxf.resource.URIResolver; @@ -85,7 +89,9 @@ import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.ws.addressing.ObjectFactory; -public class JAXBDataBinding extends AbstractDataBinding implements WrapperCapableDatabinding { +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"; @@ -238,6 +244,11 @@ private boolean qualifiedSchemas; private Service service; + + private List<Interceptor> in = new ModCountCopyOnWriteArrayList<Interceptor>(); + private List<Interceptor> out = new ModCountCopyOnWriteArrayList<Interceptor>(); + private List<Interceptor> outFault = new ModCountCopyOnWriteArrayList<Interceptor>(); + private List<Interceptor> inFault = new ModCountCopyOnWriteArrayList<Interceptor>(); public JAXBDataBinding() { } @@ -315,6 +326,10 @@ @SuppressWarnings("unchecked") public void initialize(Service aservice) { this.service = aservice; + + getInInterceptors().add(JAXBAttachmentSchemaValidationHack.INSTANCE); + getInFaultInterceptors().add(JAXBAttachmentSchemaValidationHack.INSTANCE); + // context is already set, don't redo it if (context != null) { return; @@ -1002,5 +1017,22 @@ } return null; } + + public List<Interceptor> getOutFaultInterceptors() { + return outFault; + } + + public List<Interceptor> getInFaultInterceptors() { + return inFault; + } + + public List<Interceptor> getInInterceptors() { + return in; + } + + public List<Interceptor> getOutInterceptors() { + return out; + } + } Modified: cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (original) +++ cxf/branches/2.1.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java Tue Jul 28 01:20:20 2009 @@ -398,6 +398,7 @@ List<Interceptor> i1 = bus.getInInterceptors(); List<Interceptor> i2 = inInterceptors; List<Interceptor> i3 = endpoint.getInInterceptors(); + return new PhaseChainCache().get(pm.getInPhases(), i1, i2, i3); } Modified: cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java?rev=798352&r1=798351&r2=798352&view=diff ============================================================================== --- cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java (original) +++ cxf/branches/2.1.x-fixes/systests/src/test/java/org/apache/cxf/systest/mtom/ClientMtomXopTest.java Tue Jul 28 01:20:20 2009 @@ -30,6 +30,7 @@ import javax.xml.ws.Holder; import javax.xml.ws.soap.SOAPBinding; +import org.apache.axiom.attachments.utils.IOUtils; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.endpoint.Client; @@ -59,7 +60,7 @@ @BeforeClass public static void startServers() throws Exception { TestUtilities.setKeepAliveSystemProperty(false); - assertTrue("server did not launch correctly", launchServer(Server.class, true)); + assertTrue("server did not launch correctly", launchServer(Server.class)); } @AfterClass @@ -67,22 +68,6 @@ TestUtilities.recoverKeepAliveSystemProperty(); } - /* - * @Test @Ignore public void testMtomSWA() throws Exception { TestMtom - * mtomPort = createPort(MTOM_SERVICE, MTOM_PORT, TestMtom.class); try { - * InputStream pre = - * this.getClass().getResourceAsStream("/wsdl/mtom_xop.wsdl"); long fileSize = - * 0; for (int i = pre.read(); i != -1; i = pre.read()) { fileSize++; } - * ByteArrayDataSource bads = new - * ByteArrayDataSource(this.getClass().getResourceAsStream( - * "/wsdl/mtom_xop.wsdl"), "application/octet-stream"); DataHandler dh = new - * DataHandler(bads); DataHandler dhResp = mtomPort.testSWA(dh); DataSource - * ds = dhResp.getDataSource(); InputStream in = ds.getInputStream(); long - * count = 0; for (int i = in.read(); i != -1; i = in.read()) { count++; } - * assertEquals("attachemnt length different", fileSize, count); } catch - * (UndeclaredThrowableException ex) { throw (Exception) ex.getCause(); } } - */ - @Test public void testMtomXop() throws Exception { TestMtom mtomPort = createPort(MTOM_SERVICE, MTOM_PORT, TestMtom.class, true, true); @@ -110,8 +95,23 @@ mtomPort.testXop(name, param); assertEquals("name unchanged", "return detail + call detail", name.value); assertNotNull(param.value); - param.value.getInputStream().close(); + InputStream in = param.value.getInputStream(); + byte bytes[] = IOUtils.getStreamAsByteArray(in); + assertEquals(data.length, bytes.length); + in.close(); + + param.value = new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")); + name = new Holder<String>("call detail"); + mtomPort.testXop(name, param); + assertEquals("name unchanged", "return detail + call detail", name.value); + assertNotNull(param.value); + + in = param.value.getInputStream(); + bytes = IOUtils.getStreamAsByteArray(in); + assertEquals(data.length, bytes.length); + in.close(); + } catch (UndeclaredThrowableException ex) { throw (Exception)ex.getCause(); }
