From e8e05b20ff30b04285240c9a14e39958d77fe4fe Mon Sep 17 00:00:00 2001 From: Ahmet DAL Date: Mon, 24 Nov 2014 15:42:12 +0200 Subject: [PATCH] STORM-573 is fixed. timeout-ms value can be passed as param to comlete-topology in testing4j.clj for Java projects. --- .../src/clj/backtype/storm/testing4j.clj | 23 +++++++++++-------- .../storm/testing/CompleteTopologyParam.java | 22 +++++++++++++++++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/storm-core/src/clj/backtype/storm/testing4j.clj b/storm-core/src/clj/backtype/storm/testing4j.clj index 4b4a7a67678..52f33a68e1e 100644 --- a/storm-core/src/clj/backtype/storm/testing4j.clj +++ b/storm-core/src/clj/backtype/storm/testing4j.clj @@ -54,17 +54,20 @@ (defn -completeTopology ([^ILocalCluster cluster ^StormTopology topology ^CompleteTopologyParam completeTopologyParam] - (let [mocked-sources (or (-> completeTopologyParam .getMockedSources .getData) {}) - storm-conf (or (.getStormConf completeTopologyParam) {}) - cleanup-state (or (.getCleanupState completeTopologyParam) true) - topology-name (.getTopologyName completeTopologyParam)] - (complete-topology (.getState cluster) topology - :mock-sources mocked-sources - :storm-conf storm-conf - :cleanup-state cleanup-state - :topology-name topology-name))) + (let [mocked-sources (or (-> completeTopologyParam .getMockedSources .getData) {}) + storm-conf (or (.getStormConf completeTopologyParam) {}) + cleanup-state (or (.getCleanupState completeTopologyParam) true) + topology-name (.getTopologyName completeTopologyParam) + timeout-ms (or (.getTimeoutMs completeTopologyParam) TEST-TIMEOUT-MS)] + (complete-topology (.getState cluster) topology + :mock-sources mocked-sources + :storm-conf storm-conf + :cleanup-state cleanup-state + :topology-name topology-name + :timeout-ms timeout-ms))) ([^ILocalCluster cluster ^StormTopology topology] - (-completeTopology cluster topology (CompleteTopologyParam.)))) + (-completeTopology cluster topology (CompleteTopologyParam.)))) + (defn -withSimulatedTime [^Runnable code] diff --git a/storm-core/src/jvm/backtype/storm/testing/CompleteTopologyParam.java b/storm-core/src/jvm/backtype/storm/testing/CompleteTopologyParam.java index 91ecb573bae..f3306cfa320 100644 --- a/storm-core/src/jvm/backtype/storm/testing/CompleteTopologyParam.java +++ b/storm-core/src/jvm/backtype/storm/testing/CompleteTopologyParam.java @@ -39,29 +39,49 @@ public class CompleteTopologyParam { * the topology name you want to submit to the cluster */ private String topologyName; - + + /** + * the timeout of topology you want to submit to the cluster + */ + private Integer timeoutMs; + public MockedSources getMockedSources() { return mockedSources; } + public void setMockedSources(MockedSources mockedSources) { this.mockedSources = mockedSources; } + public Config getStormConf() { return stormConf; } + public void setStormConf(Config stormConf) { this.stormConf = stormConf; } + public Boolean getCleanupState() { return cleanupState; } + public void setCleanupState(Boolean cleanupState) { this.cleanupState = cleanupState; } + public String getTopologyName() { return topologyName; } + public void setTopologyName(String topologyName) { this.topologyName = topologyName; } + + public Integer getTimeoutMs() { + return timeoutMs; + } + + public void setTimeoutMs(Integer timeoutMs) { + this.timeoutMs = timeoutMs; + } }