No worries. I haven't found the testing framework the easiest thing to
use. If you see errors that say something like "cannot convert object to
iterable" I use the code below to disable storm from being able to call
System.exit()
private static class ExitTrappedException extends SecurityException {
}
private static void forbidSystemExitCall() {
final SecurityManager securityManager = new SecurityManager() {
public void checkPermission(Permission permission) {
if (permission.getName().startsWith("exitVM")) {
throw new ExitTrappedException();
}
}
};
System.setSecurityManager(securityManager);
}
private static void enableSystemExitCall() {
System.setSecurityManager(null);
}
On Mon, Aug 4, 2014 at 11:02 PM, Corey Nolet <[email protected]> wrote:
> Nevermind, I wrote that before looking. This has been around since 0.8.1.
> Thanks again Vincent!
>
>
> On Mon, Aug 4, 2014 at 11:01 PM, Corey Nolet <[email protected]> wrote:
>
>> Oh Nice. Is this new in 0.9.*? I just updated so I haven't looked much
>> into what's changed yet, other than Netty.
>>
>>
>> On Mon, Aug 4, 2014 at 10:40 PM, Vincent Russell <
>> [email protected]> wrote:
>>
>>> Corey,
>>>
>>> Have you tried using the integration testing framework that comes with
>>> storm?
>>>
>>>
>>> Testing.withSimulatedTimeLocalCluster(mkClusterParam,
>>> new TestJob() {
>>> @Override
>>> public void run(ILocalCluster cluster) throws Exception {
>>>
>>> CompleteTopologyParam completeTopologyParam = new
>>> CompleteTopologyParam();
>>> completeTopologyParam
>>> .setMockedSources(mockedSources);
>>> completeTopologyParam.setStormConf(daemonConf);
>>>
>>> completeTopologyParam.setTopologyName(getTopologyName());
>>> Map result = Testing.completeTopology(cluster,
>>> topology, completeTopologyParam);
>>>
>>> });
>>>
>>> -Vincent
>>>
>>> On Mon, Aug 4, 2014 at 8:49 PM, Corey Nolet <[email protected]> wrote:
>>>
>>>> I'm testing some sliding window algorithms with tuples emitted from a
>>>> mock spout based on a timer but the amount of time it takes the topology to
>>>> fully start up and activate seems to vary from computer to computer.
>>>> Specifically, I just updated from 0.8.2 to 0.9.2-incubating and all of my
>>>> tests are breaking because the time to activate the topology is taking
>>>> longer (because of Netty possibly?). I'd like to make my tests more
>>>> resilient to things like this.
>>>>
>>>> Is there something I can look at in LocalCluster where I could do
>>>> "while(!notActive) { Thread.sleep(50) }" ?
>>>>
>>>> This is what my test looks like currently:
>>>>
>>>> StormTopology topology = buildTopology(...);
>>>> Config conf = new Config();
>>>> conf.setNumWorkers(1);
>>>>
>>>> LocalCluster cluster = new LocalCluster();
>>>> cluster.submitTopology(getTopologyName(), conf, topology);
>>>>
>>>> try {
>>>> Thread.sleep(4000);
>>>> } catch (InterruptedException e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> cluster.shutdown();
>>>>
>>>> assertEquals(4, MockSinkBolt.getEvents().size());
>>>>
>>>>
>>>>
>>>> Thanks!
>>>>
>>>>
>>>>
>>>
>>
>