On 2011-1-17, at 上午5:41, Dennis Sosnoski wrote:
I've been working on writing integration tests that check WS-RM
delivery
assurances on the server side, after seeing some problems in this area
when I tested using sample code
(http://mail-archives.apache.org/mod_mbox/cxf-dev/201101.mbox/
browser).
I'm trying to use
systests/ws-specs/src/test/java/
org.apache.cxf.systest.ws.rm.SequenceTest as
a starting point, but since I want to check the message delivery to
the
server I need a very different organization.
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?
It looks like I could get the BusFactory default bus setting after the
call to Control.startGreeter(), since it sets this to the
newly-constructed greeterBus, but I hate to rely on a side-effect like
this. Can someone suggest a cleaner way to handle this?
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();
}
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.
Freeman
~
Thanks for any advice,
- Dennis
--
Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html
>
Axis2/CXF/Metro SOA and Web Services Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org