org.apache.storm.ILocalCluster Java Examples

The following examples show how to use org.apache.storm.ILocalCluster. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaStormIntegrationTest.java    From incubator-retired-pirk with Apache License 2.0 6 votes vote down vote up
private TestJob createPirkTestJob(final Config config)
{
  final SpoutConfig kafkaConfig = setUpTestKafkaSpout(config);
  return new TestJob()
  {
    StormTopology topology = PirkTopology.getPirkTopology(kafkaConfig);

    @Override
    public void run(ILocalCluster iLocalCluster) throws Exception
    {
      iLocalCluster.submitTopology("pirk_integration_test", config, topology);
      logger.info("Pausing for setup.");
      // Thread.sleep(4000);
      // KafkaProducer producer = new KafkaProducer<String,String>(createKafkaProducerConfig());
      // loadTestData(producer);
      // Thread.sleep(10000);
      while (OutputBolt.latch.getCount() == testCountDown)
      {
        Thread.sleep(1000);
      }
      testCountDown -= 1;

      logger.info("Finished...");
    }
  };
}
 
Example #2
Source File: StormTestUtil.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static Config submitTopology(ILocalCluster stormCluster, String topologyName,
                                    StormTopology stormTopology) throws Exception {
    Config stormConf = new Config();
    stormConf.putAll(Utils.readDefaultConfig());
    stormConf.put("storm.cluster.mode", "local");
    stormConf.setDebug(true);
    stormConf.setMaxTaskParallelism(3);
    stormConf.put(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN,
            org.apache.atlas.storm.hook.StormAtlasHook.class.getName());

    stormCluster.submitTopology(topologyName, stormConf, stormTopology);

    Thread.sleep(10000);
    return stormConf;
}
 
Example #3
Source File: StormTestUtil.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
public static Config submitTopology(ILocalCluster stormCluster, String topologyName,
                                    StormTopology stormTopology) throws Exception {
    Config stormConf = new Config();
    stormConf.putAll(Utils.readDefaultConfig());
    stormConf.put("storm.cluster.mode", "local");
    stormConf.setDebug(true);
    stormConf.setMaxTaskParallelism(3);
    stormConf.put(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN,
            org.apache.atlas.storm.hook.StormAtlasHook.class.getName());

    stormCluster.submitTopology(topologyName, stormConf, stormTopology);

    Thread.sleep(10000);
    return stormConf;
}
 
Example #4
Source File: NormalizationTopologyTest.java    From streamline with Apache License 2.0 5 votes vote down vote up
public void testNormalizationTopology(NormalizationProcessor normalizationProcessor) throws Exception {

        final Config config = new Config();
        config.setDebug(true);
        final String topologyName = "SplitJoinTopologyTest";
        final StormTopology topology = createTopology(normalizationProcessor);
        log.info("Created topology with name: [{}] and topology: [{}]", topologyName, topology);

        ILocalCluster localCluster = new LocalCluster();
        log.info("Submitting topology: [{}]", topologyName);
        localCluster.submitTopology(topologyName, config, topology);
        Thread.sleep(2000);
        localCluster.shutdown();
    }
 
Example #5
Source File: SplitJoinTopologyTest.java    From streamline with Apache License 2.0 5 votes vote down vote up
protected void submitTopology() throws Exception {
    final Config config = getConfig();
    final String topologyName = "SplitJoinTopologyTest";
    final StormTopology topology = createTopology();
    log.info("Created topology with name: [{}] and topology: [{}]", topologyName, topology);

    ILocalCluster localCluster = new LocalCluster();
    log.info("Submitting topology: [{}]", topologyName);
    localCluster.submitTopology(topologyName, config, topology);

}
 
Example #6
Source File: StormTestUtil.java    From atlas with Apache License 2.0 4 votes vote down vote up
public static ILocalCluster createLocalStormCluster() {
    // start a local storm cluster
    HashMap<String,Object> localClusterConf = new HashMap<>();
    localClusterConf.put("nimbus-daemon", true);
    return Testing.getLocalCluster(localClusterConf);
}
 
Example #7
Source File: StormTestUtil.java    From incubator-atlas with Apache License 2.0 4 votes vote down vote up
public static ILocalCluster createLocalStormCluster() {
    // start a local storm cluster
    HashMap<String,Object> localClusterConf = new HashMap<>();
    localClusterConf.put("nimbus-daemon", true);
    return Testing.getLocalCluster(localClusterConf);
}
 
Example #8
Source File: RulesTopologyTest.java    From streamline with Apache License 2.0 4 votes vote down vote up
protected void submitTopology() throws AlreadyAliveException, InvalidTopologyException {
    final Config config = getConfig();
    final String topologyName = "RulesTopologyTest";
    ILocalCluster localCluster = new LocalCluster();
    localCluster.submitTopology(topologyName, config, createTopology());
}