fix validation
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f432abf5 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f432abf5 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f432abf5 Branch: refs/heads/master Commit: f432abf523a54806e4b927f676b93575bdf687f2 Parents: abf2924 Author: P. Taylor Goetz <[email protected]> Authored: Fri Apr 10 15:47:39 2015 -0400 Committer: P. Taylor Goetz <[email protected]> Committed: Fri Apr 10 15:47:39 2015 -0400 ---------------------------------------------------------------------- .../apache/storm/flux/model/TopologyDef.java | 23 +++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/f432abf5/flux-core/src/main/java/org/apache/storm/flux/model/TopologyDef.java ---------------------------------------------------------------------- diff --git a/flux-core/src/main/java/org/apache/storm/flux/model/TopologyDef.java b/flux-core/src/main/java/org/apache/storm/flux/model/TopologyDef.java index 3be7dd6..6c34018 100644 --- a/flux-core/src/main/java/org/apache/storm/flux/model/TopologyDef.java +++ b/flux-core/src/main/java/org/apache/storm/flux/model/TopologyDef.java @@ -196,19 +196,22 @@ public class TopologyDef { } public boolean isDslTopology(){ - boolean hasSpouts = this.spoutMap != null && this.spoutMap.size() > 0; - boolean hasBolts = this.boltMap != null && this.boltMap.size() > 0; - boolean hasStreams = this.streams != null && this.streams.size() > 0; - boolean isDslTopology = hasSpouts || hasBolts || hasStreams; - - return isDslTopology; + return this.topologySource == null; } public boolean validate(){ - // we can't have a topology source and spout/bolt/stream definitions at the same time - boolean isDslTopology = isDslTopology(); - boolean isTopologySource = this.topologySource != null; - return !(isDslTopology && isTopologySource); + boolean hasSpouts = this.spoutMap != null && this.spoutMap.size() > 0; + boolean hasBolts = this.boltMap != null && this.boltMap.size() > 0; + boolean hasStreams = this.streams != null && this.streams.size() > 0; + boolean hasSpoutsBoltsStreams = hasStreams && hasBolts && hasSpouts; + // you cant define a topologySource and a DSL topology at the same time... + if (!isDslTopology() && ((hasSpouts || hasBolts || hasStreams))) { + return false; + } + if(isDslTopology() && (hasSpouts && hasBolts && hasStreams)) { + return true; + } + return true; } }
