You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Gordon Dickens <gd...@anexinet.com> on 2007/10/04 18:49:28 UTC
Reference to SU Bean in JUnit
Hello,
I am writing a JUnit test for a bean service unit. I need to load
properties into that bean, but I can not seem to find a way to get a
reference to the registered instance within ServiceMix (v3.2) see code
snippet below...
BeanComponent beanComponent = new BeanComponent();
BeanEndpoint beanEndpoint = new BeanEndpoint();
QName serviceQName = new QName(NAMESPACE, CONSUMER_SERVICE);
beanEndpoint.setService(serviceQName);
beanEndpoint.setEndpoint(CONSUMER_ENDPOINT);
beanEndpoint.setBeanType(MyImporter.class);
beanComponent.setEndpoints(new BeanEndpoint[] {beanEndpoint });
Any help is appreciated.
Thanks,
Gordon
Re: Reference to SU Bean in JUnit
Posted by Gordon Dickens <gd...@anexinet.com>.
Thanks again Guillaume.
Guillaume Nodet wrote:
> You can instanciate the bean yourself and populate it:
>
> MyImporter myImporter = new MyImporter();
> myImporter.setXxx( ... );
> beanEndpoint.setBean(myImporter);
>
> On 10/4/07, Gordon Dickens <gd...@anexinet.com> wrote:
>
>> Hello,
>>
>> I am writing a JUnit test for a bean service unit. I need to load
>> properties into that bean, but I can not seem to find a way to get a
>> reference to the registered instance within ServiceMix (v3.2) see code
>> snippet below...
>>
>> BeanComponent beanComponent = new BeanComponent();
>> BeanEndpoint beanEndpoint = new BeanEndpoint();
>> QName serviceQName = new QName(NAMESPACE, CONSUMER_SERVICE);
>> beanEndpoint.setService(serviceQName);
>> beanEndpoint.setEndpoint(CONSUMER_ENDPOINT);
>>
>> beanEndpoint.setBeanType(MyImporter.class);
>> beanComponent.setEndpoints(new BeanEndpoint[] {beanEndpoint });
>>
>>
>> Any help is appreciated.
>>
>> Thanks,
>> Gordon
>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> .
>
>
Re: Reference to SU Bean in JUnit
Posted by Guillaume Nodet <gn...@gmail.com>.
You can instanciate the bean yourself and populate it:
MyImporter myImporter = new MyImporter();
myImporter.setXxx( ... );
beanEndpoint.setBean(myImporter);
On 10/4/07, Gordon Dickens <gd...@anexinet.com> wrote:
> Hello,
>
> I am writing a JUnit test for a bean service unit. I need to load
> properties into that bean, but I can not seem to find a way to get a
> reference to the registered instance within ServiceMix (v3.2) see code
> snippet below...
>
> BeanComponent beanComponent = new BeanComponent();
> BeanEndpoint beanEndpoint = new BeanEndpoint();
> QName serviceQName = new QName(NAMESPACE, CONSUMER_SERVICE);
> beanEndpoint.setService(serviceQName);
> beanEndpoint.setEndpoint(CONSUMER_ENDPOINT);
>
> beanEndpoint.setBeanType(MyImporter.class);
> beanComponent.setEndpoints(new BeanEndpoint[] {beanEndpoint });
>
>
> Any help is appreciated.
>
> Thanks,
> Gordon
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/