You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2015/06/04 04:05:58 UTC

[16/50] [abbrv] storm git commit: fix validation

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/0.10.x-branch
Commit: f432abf523a54806e4b927f676b93575bdf687f2
Parents: abf2924
Author: P. Taylor Goetz <pt...@gmail.com>
Authored: Fri Apr 10 15:47:39 2015 -0400
Committer: P. Taylor Goetz <pt...@gmail.com>
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;
     }
 }