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

svn merge -c 1386907 FIXES: YARN-28. Fixed TestCompositeService to not depend on test-order and thus made it pass on JDK7. Contributed by Thomas Graves.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1392461 13f79535-47bb-0310-9956-ffa450edef68
Robert Joseph Evans 13 лет назад
Родитель
Сommit
f037bcc28e

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -17,6 +17,9 @@ Release 0.23.5 - UNRELEASED
     YARN-116. Add the ability to change the RM include/exclude file without
     a restart. (xieguiming and Harsh J via sseth)
 
+    YARN-28. Fixed TestCompositeService to not depend on test-order and thus
+    made it pass on JDK7 (Thomas Graves via vinodkv).
+
   OPTIMIZATIONS
 
   BUG FIXES

+ 10 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/TestCompositeService.java

@@ -25,6 +25,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.YarnException;
 import org.apache.hadoop.yarn.service.CompositeService;
 import org.apache.hadoop.yarn.service.Service.STATE;
+import org.junit.Before;
 import org.junit.Test;
 
 public class TestCompositeService {
@@ -33,6 +34,11 @@ public class TestCompositeService {
 
   private static final int FAILED_SERVICE_SEQ_NUMBER = 2;
 
+  @Before
+  public void setup() {
+    CompositeServiceImpl.resetCounter();
+  }
+
   @Test
   public void testCallSequence() {
     ServiceManager serviceManager = new ServiceManager("ServiceManager");
@@ -226,6 +232,10 @@ public class TestCompositeService {
       counter = -1;
     }
 
+    public static void resetCounter() {
+      counter = -1;
+    }
+
     public void setThrowExceptionOnStart(boolean throwExceptionOnStart) {
       this.throwExceptionOnStart = throwExceptionOnStart;
     }