Github user revans2 commented on a diff in the pull request: https://github.com/apache/storm/pull/1839#discussion_r94783485 --- Diff: storm-core/test/jvm/org/apache/storm/MessagingTest.java --- @@ -0,0 +1,97 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.storm; + +import org.apache.storm.generated.GlobalStreamId; +import org.apache.storm.generated.Grouping; +import org.apache.storm.generated.StormTopology; +import org.apache.storm.testing.*; +import org.apache.storm.utils.Utils; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.*; + +public class MessagingTest { + private final static Logger LOG = LoggerFactory.getLogger(MessagingTest.class); + + @Test + public void testLocalTransport() throws Exception { + Config stormConf = new Config(); + //stormConf.putAll(Utils.readDefaultConfig()); + stormConf.put(Config.TOPOLOGY_WORKERS, 2); + stormConf.put(Config.STORM_MESSAGING_TRANSPORT , "org.apache.storm.messaging.netty.Context"); + boolean[] transportOptions = {true, false}; + for(boolean transportOn:transportOptions) { + stormConf.put(Config.STORM_LOCAL_MODE_ZMQ, transportOn); + //List<String> seeds = new ArrayList<>(); + //seeds.add("localhost"); + //stormConf.put(Config.NIMBUS_HOST, "localhost"); + //stormConf.put(Config.NIMBUS_SEEDS, seeds); + //stormConf.put("storm.cluster.mode", "local"); + //stormConf.put(Config.STORM_LOCAL_HOSTNAME, "localhost"); + + ILocalCluster cluster = new LocalCluster.Builder().withSimulatedTime().withSupervisors(1).withPortsPerSupervisor(2) + .withDaemonConf(stormConf).build(); + Thrift.SpoutDetails spoutDetails = Thrift.prepareSpoutDetails(new TestWordSpout(false), 2); + Map<GlobalStreamId, Grouping> inputs = new HashMap<>(); + inputs.put(Utils.getGlobalStreamId("1", null), Thrift.prepareShuffleGrouping()); + Thrift.BoltDetails boltDetails = Thrift.prepareBoltDetails(inputs, new TestGlobalCount(), 6); + Map<String, Thrift.SpoutDetails> spoutMap = new HashMap<>(); + spoutMap.put("1", spoutDetails); + Map<String, Thrift.BoltDetails> boltMap = new HashMap<>(); + boltMap.put("2", boltDetails); + StormTopology stormTopology = Thrift.buildTopology(spoutMap, boltMap); + //TopologyBuilder builder = new TopologyBuilder(); + //builder.setSpout("1", new TestWordSpout(false), 2); + //builder.setBolt("2", new TestGlobalCount(), 6).shuffleGrouping("1"); + //StormTopology stormTopology = builder.createTopology(); + FixedTuple[] fixedTuple = {new FixedTuple((List<Object>) Collections.singletonList((Object) "a")), new FixedTuple((List<Object>) Collections.singletonList((Object) "b")), --- End diff -- Or better yet if the commented out code works use it instead. It is a lot smaller and fits the java API better.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---