mercredi 4 mars 2015

Spring Integration: Unit test Start/Stop endpoint adapters

I have one jdbc inbound adapter and one jms adapter as follows:



<int-jdbc:inbound-channel-adapter id="fooInboundJdbcAdapter" query="SELECT * FROM foo WHERE status IS NULL" channel="fooJdbcChannel"
data-source="dataSource">
<int:poller fixed-rate="10000"/>
</int-jdbc:inbound-channel-adapter>

<int-jms:message-driven-channel-adapter id="fooJmsMessageDrivenAdapter"
connection-factory="jmsConnectionFactory"
channel="fooJmsListenerChannel"
destination="fooJmsQueue"/>


I used control-bus to start/stop these adapters. One of the method looks like:



public boolean startAdapter() {
return controlChannel.send(new GenericMessage<String>("@" + fooInboundJdbcAdapter.getComponentName() + ".start()"));
}


Now, I am trying to write unit test for above method. I am confused about how I should unit test this method. Any help on this? controlChannel and fooInboundJdbcAdapter are injected in this case.


Aucun commentaire:

Enregistrer un commentaire