forked from tomdz/storm-esper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tomdz#3 from maxichan/master
Bolt updates - pass class instead of strings for input/output fields, fixed tests
- Loading branch information
Showing
9 changed files
with
438 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.tomdz.storm.esper.model; | ||
|
||
import java.util.Map; | ||
|
||
public interface Event { | ||
Map<Class, String[]> getModelByType(); | ||
String[] getModels(); | ||
String getStreamName(); | ||
String getEventName(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.tomdz.storm.esper; | ||
|
||
import org.apache.storm.Config; | ||
import org.apache.storm.testing.CompleteTopologyParam; | ||
import org.apache.storm.testing.MockedSources; | ||
import org.apache.storm.testing.TestJob; | ||
import org.apache.storm.tuple.Tuple; | ||
import org.apache.storm.tuple.Values; | ||
|
||
import java.util.HashSet; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
public abstract class EsperTestJob implements TestJob { | ||
|
||
/** | ||
* Check that all outgoing fields from the Esper bolt match the incoming fields of the | ||
* gathering bolt. | ||
* @param esperBolt | ||
* @param gatheringBolt | ||
*/ | ||
public void assertEventTypesEqual(EsperBolt esperBolt, GatheringBolt gatheringBolt) { | ||
for (Tuple tuple : gatheringBolt.getGatheredData()) { | ||
String streamId = tuple.getSourceStreamId(); | ||
|
||
EventTypeDescriptor eventType = esperBolt.getEventTypeForStreamId(streamId); | ||
|
||
assertEquals(new HashSet<String>(tuple.getFields().toList()), | ||
new HashSet<String>(eventType.getFields().toList())); | ||
} | ||
} | ||
|
||
public CompleteTopologyParam createTestDataConfig(String spoutName, Values... values) { | ||
MockedSources mockedSources = new MockedSources(); | ||
mockedSources.addMockData(spoutName, values); | ||
|
||
return createConfig(mockedSources); | ||
} | ||
|
||
public CompleteTopologyParam createConfig(MockedSources mockedSources) { | ||
Config conf = new Config(); | ||
conf.setNumWorkers(1); | ||
conf.setDebug(false); | ||
conf.put(Config.TOPOLOGY_DEBUG, false); | ||
conf.put(Config.TOPOLOGY_EVENTLOGGER_EXECUTORS, 0); | ||
|
||
CompleteTopologyParam completeTopologyParam = new CompleteTopologyParam(); | ||
completeTopologyParam.setMockedSources(mockedSources); | ||
completeTopologyParam.setStormConf(conf); | ||
return completeTopologyParam; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.