Would you mind raising a JIRA issue and attach your patch, please ?

On 8/7/06, jlo_gestalt <[EMAIL PROTECTED]> wrote:


I am attempting to write unit level tests for our components who use a
DeliveryChannel by mocking out the ComponentContext and DeliveryChannel.
However I want to utilize the existing ServiceMix classes to create
Exchange
Factorys and Message Exchanges. I am almost there but have hit a road
block
with MessageExchangeFactoryImpl.setDefaults(MessageExchangeImpl exchange).
On line 260, setDefaults attempts to get the Marshaller. Since I am using
a
MockComponentContext getContext returns null and I get a
NullPointerException. This is the line where it is occuring:
PojoMarshaler marshaler = getContext().getActivationSpec().getMarshaler();

Would it be possible to check for null? Something like:


if (getContext() != null) {
    PojoMarshaler marshaler =
getContext().getActivationSpec().getMarshaler();
    if (marshaler != null) {
        exchange.setMarshaler(marshaler);
    }
}



Being able to write unit level tests without having to have ServiceMix
running would provide HUGE benefits for our team. And this currently
appears
to be the only stumbling block.

Thanks.
--
View this message in context:
http://www.nabble.com/MessageExchangeFactoryImpl-NullPointerException-tf2064194.html#a5686711
Sent from the ServiceMix - User forum at Nabble.com.




--
Cheers,
Guillaume Nodet

Reply via email to