cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sosnoski <...@sosnoski.com>
Subject Re: WS-RM integration test for server side
Date Mon, 17 Jan 2011 03:28:01 GMT
On 01/17/2011 03:12 PM, Freeman Fang wrote:
>
> On 2011-1-17, at 上午5:41, Dennis Sosnoski wrote:
>
>> ...
>>
>> I'd like to add in- and out-message recorders to the greeterBus
>> configuration build by ControlImpl, which it looks like I should be able
>> to do in the passed-in configuration file, then run the service
>> in-process so that I can potentially access the recorders from the test
>> code. But how can I find the recorders from the test code?
>>
>> ...
> Hi,
>
> How about add two publich methods in
> org.apache.cxf.systest.ws.rm.ControlImpl,  just like
>
>     public List<Interceptor<? extends Message>>
> getGreeterBusInInterceptors() {
>         return greeterBus.getInInterceptors();
>     }
>
>     public List<Interceptor<? extends Message>>
> getGreeterBusOuInterceptors() {
>         return greeterBus.getOutInterceptors();
>     }

I don't think this would work, since the Interceptors are not going to
support conversion to/from XML... are they?

>
> Or more specifically, just return the in/out recorder interceptor you
> are concerned about, just like
>
>     public Interceptor getInMessageRecorder() {
>         for (Interceptor interceptor : greeterBus.getInInterceptors()) {
>             if
> (interceptor.getClass().getName().equals("org.apache.cxf.systest.ws.util.InMessageRecorder"))
> {
>                 return interceptor;
>             }
>         }
>         return null;
>     }
>
>     public Interceptor getOutMessageRecorder() {
>         for (Interceptor interceptor : greeterBus.getOutInterceptors()) {
>             if
> (interceptor.getClass().getName().equals("org.apache.cxf.systest.ws.util.OutMessageRecorder"))
> {
>                 return interceptor;
>             }
>         }
>         return null;
>     }
>
> So that you can get In/OutMessageRecorders whenever you want to use it.

Same issue applies here. I could use calls to Control to get the actual
recorded data without too much trouble, as List<byte[]>.

I'm now wondering, though, if I'm better off just bypassing the whole
Server/Control logic in these tests and instead just starting an
in-process service instance directly in my test code. That way I can
control the bus configuration and don't need to play any games with
passing data. Anyone see any drawbacks to this approach for server-side
testing?

  - Dennis

Mime
View raw message