You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jlo_gestalt <jl...@gestalt-llc.com> on 2006/08/07 17:06:57 UTC

MessageExchangeFactoryImpl NullPointerException

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.

Re: MessageExchangeFactoryImpl NullPointerException

Posted by jlo_gestalt <jl...@gestalt-llc.com>.
Done. Issue 518.

https://issues.apache.org/activemq/browse/SM-518
-- 
View this message in context: http://www.nabble.com/MessageExchangeFactoryImpl-NullPointerException-tf2064194.html#a5687813
Sent from the ServiceMix - User forum at Nabble.com.


Re: MessageExchangeFactoryImpl NullPointerException

Posted by jlo_gestalt <jl...@gestalt-llc.com>.
Thanks for getting that resolved so quickly.

Do you have an estimate as to when the next release will be created?
The SNAPSHOT directory appears to have been created last around 06-20.
-- 
View this message in context: http://www.nabble.com/MessageExchangeFactoryImpl-NullPointerException-tf2064194.html#a5688102
Sent from the ServiceMix - User forum at Nabble.com.


Re: MessageExchangeFactoryImpl NullPointerException

Posted by Guillaume Nodet <gn...@gmail.com>.
Would you mind raising a JIRA issue and attach your patch, please ?

On 8/7/06, jlo_gestalt <jl...@gestalt-llc.com> 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