Sunday 15 September 2013

java - Creating a backtype.storm.tuple.Tuple for testing purposes? -


I am new and am trying to work on how to write a bolt test that is executed by the execute (Tuple) Tupal) Method in a subclassed BaseRichBolt .

The problem is that it seems that Tupal is unchanging and I do not see any way or builders to create a new tool for my own Tupal < / Code> How can I create, or how can I test a bolt with test input?

I'm actually using Scala, not Java, but the answer should be easily translatable.

Tapping the object of the taple object. This is straightforward:

  package storm.starter.tools; Import static org.mockito.Mockito.mock; Static org.mokito import. Mokito when; Import backtype.storm.Constants; Import backtype.storm.tuple.Tuple; Public Finale Class Mocktauplahlper {Private Mock Tüpelhalper () {} Public Static Tupal MockTeak Tupal () {Return Mock Tuplal (constantSETExamComoniumID, static.SETMTHERCRAAM_ID); } Public Static Tuplicate Copy (String Component ID, String Stream Id) {Tupal Tupl = Mock (Tupal Class); . When (tuple.getSourceComponent ()) thenReturn (ComponentID); . When (tuple.getSourceStreamId ()) thenReturn (streamId); Returning tuple; }}    

No comments:

Post a Comment