Просмотр исходного кода

AMBARI-860. Remove code that adds fake stages for testing.

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1398126 13f79535-47bb-0310-9956-ffa450edef68
Jitendra Nath Pandey 12 лет назад
Родитель
Сommit
2cefb1bdd7

+ 2 - 0
AMBARI-666-CHANGES.txt

@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-860. Remove code that adds fake stages for testing. (jitendra)
+
   AMBARI-856. Add cluster heatmap. (yusaku)
 
   AMBARI-855. Create the skeleton for a custom data adapter in Ambari Web.

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java

@@ -76,8 +76,8 @@ class ActionScheduler implements Runnable {
   public void run() {
     while (shouldRun) {
       try {
-        doWork();
         Thread.sleep(sleepTime);
+        doWork();
       } catch (InterruptedException ex) {
         LOG.warn("Scheduler thread is interrupted going to stop", ex);
         shouldRun = false;

+ 4 - 3
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java

@@ -226,9 +226,10 @@ public class AmbariServer {
       manager.start();
       LOG.info("********* Started ActionManager **********");
 
-      RequestInjectorForTest testInjector = new RequestInjectorForTest(controller, clusters);
-      Thread testInjectorThread = new Thread(testInjector);
-      testInjectorThread.start();
+//TODO: Remove this code when APIs are ready for testing.
+//      RequestInjectorForTest testInjector = new RequestInjectorForTest(controller, clusters);
+//      Thread testInjectorThread = new Thread(testInjector);
+//      testInjectorThread.start();
       
       server.join();
       LOG.info("Joined the Server");

+ 4 - 4
ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java

@@ -69,18 +69,18 @@ public class TestActionScheduler {
 
     //Keep large number of attempts so that the task is not expired finally
     //Small action timeout to test rescheduling
-    ActionScheduler scheduler = new ActionScheduler(1000, 100, db, aq, fsm, 10000);
+    ActionScheduler scheduler = new ActionScheduler(100, 100, db, aq, fsm, 10000);
     // Start the thread
     scheduler.start();
 
-    Thread.sleep(1000);
+    Thread.sleep(200);
     List<AgentCommand> ac = aq.dequeueAll(hostname);
     assertEquals(1, ac.size());
     assertTrue(ac.get(0) instanceof ExecutionCommand);
     assertEquals("1-977", ((ExecutionCommand) (ac.get(0))).getCommandId());
 
     //The action status has not changed, it should be queued again.
-    Thread.sleep(1000);
+    Thread.sleep(200);
     ac = aq.dequeueAll(hostname);
     assertEquals(1, ac.size());
     assertTrue(ac.get(0) instanceof ExecutionCommand);
@@ -91,7 +91,7 @@ public class TestActionScheduler {
     ac = aq.dequeueAll(hostname);
 
     //Wait for sometime, it shouldn't be scheduled this time.
-    Thread.sleep(1000);
+    Thread.sleep(200);
     ac = aq.dequeueAll(hostname);
     assertEquals(0, ac.size());
   }