Fixing tests.

Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f3a40011
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f3a40011
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f3a40011

Branch: refs/heads/master
Commit: f3a400117f70dfd437a39f025cfd1d7fe39eb96a
Parents: 832395a
Author: Kyle Nusbaum <knusb...@yahoo-inc.com>
Authored: Wed Aug 9 17:06:33 2017 -0500
Committer: Kyle Nusbaum <knusb...@yahoo-inc.com>
Committed: Wed Aug 9 17:06:33 2017 -0500

----------------------------------------------------------------------
 .../jvm/org/apache/storm/utils/UtilsTest.java   | 35 -----------------
 .../resource/TestResourceAwareScheduler.java    | 40 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f3a40011/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
----------------------------------------------------------------------
diff --git a/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java 
b/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
index fc042c2..c8499e9 100644
--- a/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
+++ b/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
@@ -22,8 +22,6 @@ import org.apache.storm.Config;
 import org.apache.thrift.transport.TTransportException;
 import org.junit.Assert;
 import org.junit.Test;
-import org.junit.Rule;
-import org.junit.rules.ExpectedException;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -175,37 +173,4 @@ public class UtilsTest {
             }
         }
     }
-
-    @Rule
-    public final ExpectedException schedulerException = 
ExpectedException.none();
-
-    @Test
-    public void testSchedulerStrategyWhitelist() {
-        Map<String, Object> config = ConfigUtils.readStormConfig();
-        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
-        config.put(Config.NIMBUS_SCHEDULER_STRATEGY_CLASS_WHITELIST, 
Arrays.asList(allowed));
-
-        Object sched = ReflectionUtils.newSchedulerStrategyInstance(allowed, 
config);
-        Assert.assertEquals(sched.getClass().getName(), allowed);
-    }
-
-    @Test
-    public void testSchedulerStrategyWhitelistException() {
-        Map<String, Object> config = ConfigUtils.readStormConfig();
-        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.SomeNonExistantStrategy";
-        String notAllowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
-        config.put(Config.NIMBUS_SCHEDULER_STRATEGY_CLASS_WHITELIST, 
Arrays.asList(allowed));
-
-        schedulerException.expect(DisallowedStrategyException.class);
-        ReflectionUtils.newSchedulerStrategyInstance(notAllowed, config);
-    }
-
-    @Test
-    public void testSchedulerStrategyEmptyWhitelist() {
-        Map<String, Object> config = ConfigUtils.readStormConfig();
-        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
-
-        Object sched = ReflectionUtils.newSchedulerStrategyInstance(allowed, 
config);
-        Assert.assertEquals(sched.getClass().getName(), allowed);
-    }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/f3a40011/storm-server/src/test/java/org/apache/storm/scheduler/resource/TestResourceAwareScheduler.java
----------------------------------------------------------------------
diff --git 
a/storm-server/src/test/java/org/apache/storm/scheduler/resource/TestResourceAwareScheduler.java
 
b/storm-server/src/test/java/org/apache/storm/scheduler/resource/TestResourceAwareScheduler.java
index 68bbc52..7b96cca 100644
--- 
a/storm-server/src/test/java/org/apache/storm/scheduler/resource/TestResourceAwareScheduler.java
+++ 
b/storm-server/src/test/java/org/apache/storm/scheduler/resource/TestResourceAwareScheduler.java
@@ -37,12 +37,19 @@ import org.apache.storm.topology.TopologyBuilder;
 import org.apache.storm.utils.Utils;
 import org.apache.storm.validation.ConfigValidation;
 
+import org.apache.storm.utils.ConfigUtils;
+import org.apache.storm.utils.ReflectionUtils;
+import org.apache.storm.utils.DisallowedStrategyException;
+
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -929,4 +936,37 @@ public class TestResourceAwareScheduler {
         Assert.assertTrue("Topo scheduled?", 
cluster.getAssignmentById(topo.getId()) != null);
         Assert.assertEquals("Topo all executors scheduled?", 25, 
cluster.getAssignmentById(topo.getId()).getExecutorToSlot().size());
     }
+
+    @Rule
+    public final ExpectedException schedulerException = 
ExpectedException.none();
+
+    @Test
+    public void testSchedulerStrategyWhitelist() {
+        Map<String, Object> config = ConfigUtils.readStormConfig();
+        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
+        config.put(Config.NIMBUS_SCHEDULER_STRATEGY_CLASS_WHITELIST, 
Arrays.asList(allowed));
+
+        Object sched = ReflectionUtils.newSchedulerStrategyInstance(allowed, 
config);
+        Assert.assertEquals(sched.getClass().getName(), allowed);
+    }
+
+    @Test
+    public void testSchedulerStrategyWhitelistException() {
+        Map<String, Object> config = ConfigUtils.readStormConfig();
+        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.SomeNonExistantStrategy";
+        String notAllowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
+        config.put(Config.NIMBUS_SCHEDULER_STRATEGY_CLASS_WHITELIST, 
Arrays.asList(allowed));
+
+        schedulerException.expect(DisallowedStrategyException.class);
+        ReflectionUtils.newSchedulerStrategyInstance(notAllowed, config);
+    }
+
+    @Test
+    public void testSchedulerStrategyEmptyWhitelist() {
+        Map<String, Object> config = ConfigUtils.readStormConfig();
+        String allowed = 
"org.apache.storm.scheduler.resource.strategies.scheduling.DefaultResourceAwareStrategy";
+
+        Object sched = ReflectionUtils.newSchedulerStrategyInstance(allowed, 
config);
+        Assert.assertEquals(sched.getClass().getName(), allowed);
+    }
 }

Reply via email to