ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject ambari git commit: AMBARI-18747 - Ambari Upgrade Failed from 2.4.1 to 2.5 (jonathanhurley)
Date Mon, 31 Oct 2016 15:25:55 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 6dc5a23a7 -> 726b0605f


AMBARI-18747 - Ambari Upgrade Failed from 2.4.1 to 2.5 (jonathanhurley)


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

Branch: refs/heads/branch-2.5
Commit: 726b0605fc484f9422ef1a2bb975a2e4f220afd2
Parents: 6dc5a23
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Mon Oct 31 09:02:39 2016 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Mon Oct 31 11:25:04 2016 -0400

----------------------------------------------------------------------
 .../server/upgrade/AbstractUpgradeCatalog.java  | 27 ++++++------
 .../upgrade/AbstractUpgradeCatalogTest.java     | 43 ++++++++++----------
 2 files changed, 34 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/726b0605/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index d3e5920..ebb88eb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -17,11 +17,6 @@
  */
 package org.apache.ambari.server.upgrade;
 
-import javax.persistence.EntityManager;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 import java.io.File;
 import java.io.FileReader;
 import java.io.FilenameFilter;
@@ -47,8 +42,11 @@ import java.util.TreeMap;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
+import javax.persistence.EntityManager;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.configuration.Configuration;
@@ -58,10 +56,10 @@ import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.dao.AlertDefinitionDAO;
 import org.apache.ambari.server.orm.dao.ArtifactDAO;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
-import org.apache.ambari.server.orm.dao.WidgetDAO;
 import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.ResourceTypeDAO;
 import org.apache.ambari.server.orm.dao.RoleAuthorizationDAO;
+import org.apache.ambari.server.orm.dao.WidgetDAO;
 import org.apache.ambari.server.orm.entities.AlertDefinitionEntity;
 import org.apache.ambari.server.orm.entities.ArtifactEntity;
 import org.apache.ambari.server.orm.entities.MetainfoEntity;
@@ -97,8 +95,10 @@ import org.xml.sax.InputSource;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
+import com.google.gson.Gson;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+import com.google.gson.reflect.TypeToken;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Provider;
@@ -378,13 +378,12 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog
{
   }
 
   public void addNewConfigurationsFromXml() throws AmbariException {
-    ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
-    AmbariManagementController controller = injector.getInstance(AmbariManagementController.class);
-
-    Clusters clusters = controller.getClusters();
+    Clusters clusters = injector.getInstance(Clusters.class);
     if (clusters == null) {
       return;
     }
+
+    ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
     Map<String, Cluster> clusterMap = clusters.getClusters();
 
     if (clusterMap != null && !clusterMap.isEmpty()) {
@@ -496,10 +495,8 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog
{
                                                                 Set<String> toRemove,
                                                                 boolean updateIfExists,
                                                                 boolean createNewConfigType)
throws AmbariException {
+    Clusters clusters = injector.getInstance(Clusters.class);
     ConfigHelper configHelper = injector.getInstance(ConfigHelper.class);
-    AmbariManagementController controller = injector.getInstance(AmbariManagementController.class);
-
-    Clusters clusters = controller.getClusters();
     if (clusters == null) {
       return;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/726b0605/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
index 2a8122f..5fa7cac 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java
@@ -17,7 +17,26 @@
  */
 package org.apache.ambari.server.upgrade;
 
-import com.google.inject.Injector;
+import static junit.framework.Assert.assertEquals;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.anyString;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariManagementController;
@@ -34,25 +53,7 @@ import org.apache.ambari.server.view.configuration.ViewConfig;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-
-import static junit.framework.Assert.assertEquals;
-import static org.easymock.EasyMock.anyObject;
-import static org.easymock.EasyMock.anyString;
-import static org.easymock.EasyMock.createNiceMock;
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.easymock.EasyMock.verify;
+import com.google.inject.Injector;
 
 public class AbstractUpgradeCatalogTest {
   private static final String CONFIG_TYPE = "hdfs-site.xml";
@@ -80,7 +81,7 @@ public class AbstractUpgradeCatalogTest {
 
     expect(injector.getInstance(ConfigHelper.class)).andReturn(configHelper).anyTimes();
     expect(injector.getInstance(AmbariManagementController.class)).andReturn(amc).anyTimes();
-    expect(amc.getClusters()).andReturn(clusters).anyTimes();
+    expect(injector.getInstance(Clusters.class)).andReturn(clusters).anyTimes();
 
     HashMap<String, Cluster> clusterMap = new HashMap<>();
     clusterMap.put(CLUSTER_NAME, cluster);


Mime
View raw message