.withINimbus(inimbus) .withSupervisorSlotPortMin(portMin) .withNimbusDaemon(nimbusDaemon) .build(); } catch (Exception e) {
@Test public void testSubmitTopologyToLocalNimbus() throws Exception { int port = Utils.getAvailablePort(); try (ILocalCluster localCluster = new LocalCluster.Builder() .withNimbusDaemon(true) .withDaemonConf(Config.NIMBUS_THRIFT_PORT, port) .build()) { Config topoConf = new Config(); topoConf.putAll(Utils.readDefaultConfig()); topoConf.setDebug(true); topoConf.put("storm.cluster.mode", "local"); // default is aways "distributed" but here local cluster is being used. topoConf.put(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN, InmemoryTopologySubmitterHook.class.getName()); topoConf.put(Config.NIMBUS_THRIFT_PORT, port); List<TopologyDetails> topologyNames = new ArrayList<>(); for (int i = 0; i < 4; i++) { final String topologyName = "word-count-" + UUID.randomUUID().toString(); final StormTopology stormTopology = createTestTopology(); topologyNames.add(new TopologyDetails(topologyName, stormTopology)); localCluster.submitTopology(topologyName, topoConf, stormTopology); } Assert.assertEquals(InmemoryTopologySubmitterHook.submittedTopologies, topologyNames); } }
private static LocalCluster cluster(MkClusterParam param, String id, boolean simulated) throws Exception { Integer supervisors = param.getSupervisors(); if (supervisors == null) { supervisors = 2; } Integer ports = param.getPortsPerSupervisor(); if (ports == null) { ports = 3; } Map<String, Object> conf = param.getDaemonConf(); if (conf == null) { conf = new HashMap<>(); } return new LocalCluster.Builder() .withSupervisors(supervisors) .withPortsPerSupervisor(ports) .withDaemonConf(conf) .withNimbusDaemon(param.isNimbusDaemon()) .withTracked(id) .withSimulatedTime(simulated) .build(); }
/** * Have the local nimbus actually launch a thrift server. This is intended to be used mostly for internal storm testing. */ public Builder withNimbusDaemon() { return withNimbusDaemon(true); }