AMBARI-21695. Problem in starting accumulo in upgraded cluster (IOP-HDP). UT 
fix. (swagle)


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

Branch: refs/heads/branch-2.6
Commit: b02146cd5b3172de9081cbb43b46e54c715d0876
Parents: 3c5ec6a
Author: Siddharth Wagle <swa...@hortonworks.com>
Authored: Thu Aug 10 09:55:19 2017 -0700
Committer: Siddharth Wagle <swa...@hortonworks.com>
Committed: Thu Aug 10 09:55:19 2017 -0700

----------------------------------------------------------------------
 .../listeners/upgrade/StackUpgradeFinishListener.java |  6 +++---
 .../upgrade/StackUpgradeFinishListenerTest.java       | 14 ++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b02146cd/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
index 41a0f35..7dd9754 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListener.java
@@ -53,7 +53,7 @@ public class StackUpgradeFinishListener {
   Provider<AmbariMetaInfo> ambariMetaInfo;
 
   @Inject
-  RoleCommandOrderProvider roleCommandOrderProvider;
+  Provider<RoleCommandOrderProvider> roleCommandOrderProvider;
 
   /**
    * Constructor.
@@ -88,9 +88,9 @@ public class StackUpgradeFinishListener {
       }
 
       // Clear the RoleCommandOrder cache on upgrade
-      if (roleCommandOrderProvider instanceof CachedRoleCommandOrderProvider) {
+      if (roleCommandOrderProvider.get() instanceof 
CachedRoleCommandOrderProvider) {
         LOG.info("Clearing RCO cache");
-        CachedRoleCommandOrderProvider cachedRcoProvider = 
(CachedRoleCommandOrderProvider) roleCommandOrderProvider;
+        CachedRoleCommandOrderProvider cachedRcoProvider = 
(CachedRoleCommandOrderProvider) roleCommandOrderProvider.get();
         cachedRcoProvider.clearRoleCommandOrderCache();
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b02146cd/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListenerTest.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListenerTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListenerTest.java
index 94e5890..360f3f0 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListenerTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/events/listeners/upgrade/StackUpgradeFinishListenerTest.java
@@ -17,35 +17,31 @@
  */
 package org.apache.ambari.server.events.listeners.upgrade;
 
-import static org.easymock.EasyMock.anyString;
 import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
 
-import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.events.StackUpgradeFinishEvent;
 import org.apache.ambari.server.events.publishers.VersionEventPublisher;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
+import org.apache.ambari.server.metadata.RoleCommandOrderProvider;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.orm.entities.UpgradeEntity;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
-import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.UpgradeState;
 import org.easymock.EasyMockRunner;
 import org.easymock.EasyMockSupport;
+import org.easymock.Mock;
+import org.easymock.MockType;
 import org.easymock.TestSubject;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.google.inject.Provider;
 
 
 /**
@@ -75,6 +71,8 @@ public class StackUpgradeFinishListenerTest extends 
EasyMockSupport {
   @TestSubject
   private StackUpgradeFinishListener listener = new 
StackUpgradeFinishListener(publisher);
 
+  @Mock(type = MockType.NICE)
+  private Provider<RoleCommandOrderProvider> 
roleCommandOrderProviderProviderMock;
 
   @Before
   public void setup() throws Exception {

Reply via email to