ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-13552. Upgrade: upgrade endpoint should expose Upgrade/upgrade_type (ncole)
Date Fri, 23 Oct 2015 20:15:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 79f1e4735 -> 41ebca662


AMBARI-13552. Upgrade: upgrade endpoint should expose Upgrade/upgrade_type (ncole)


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

Branch: refs/heads/branch-2.1
Commit: 41ebca662ee697bcf69ecc4a980d9d65d8091cb5
Parents: 79f1e47
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Oct 23 16:00:52 2015 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Oct 23 16:00:52 2015 -0400

----------------------------------------------------------------------
 .../server/controller/internal/UpgradeResourceProvider.java      | 4 ++--
 .../server/controller/internal/UpgradeResourceProviderTest.java  | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/41ebca66/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index 97e0779..bb036e8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -121,7 +121,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
 
   protected static final String UPGRADE_CLUSTER_NAME = "Upgrade/cluster_name";
   protected static final String UPGRADE_VERSION = "Upgrade/repository_version";
-  protected static final String UPGRADE_TYPE = "Upgrade/type";
+  protected static final String UPGRADE_TYPE = "Upgrade/upgrade_type";
   protected static final String UPGRADE_PACK = "Upgrade/pack";
   protected static final String UPGRADE_REQUEST_ID = "Upgrade/request_id";
   protected static final String UPGRADE_FROM_VERSION = "Upgrade/from_version";
@@ -472,7 +472,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider
     ResourceImpl resource = new ResourceImpl(Resource.Type.Upgrade);
 
     setResourceProperty(resource, UPGRADE_CLUSTER_NAME, clusterName, requestedIds);
-    setResourceProperty(resource, UPGRADE_TYPE, entity.getUpgradeType().toString(), requestedIds);
+    setResourceProperty(resource, UPGRADE_TYPE, entity.getUpgradeType(), requestedIds);
     setResourceProperty(resource, UPGRADE_PACK, entity.getUpgradePackage(), requestedIds);
     setResourceProperty(resource, UPGRADE_REQUEST_ID, entity.getRequestId(), requestedIds);
     setResourceProperty(resource, UPGRADE_FROM_VERSION, entity.getFromVersion(), requestedIds);

http://git-wip-us.apache.org/repos/asf/ambari/blob/41ebca66/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index 17c15b2..6c87388 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -387,7 +387,6 @@ public class UpgradeResourceProviderTest {
     assertEquals("Save Cluster State", postClusterUpgradeItems.get(0).getText());
   }
 
-  @Ignore
   @Test
   public void testGetResources() throws Exception {
     RequestStatus status = testCreateResources();
@@ -419,6 +418,7 @@ public class UpgradeResourceProviderTest {
     assertEquals(Direction.UPGRADE, res.getPropertyValue(UpgradeResourceProvider.UPGRADE_DIRECTION));
     assertEquals(false, res.getPropertyValue(UpgradeResourceProvider.UPGRADE_SKIP_FAILURES));
     assertEquals(false, res.getPropertyValue(UpgradeResourceProvider.UPGRADE_SKIP_SC_FAILURES));
+    assertEquals(UpgradeType.ROLLING, res.getPropertyValue(UpgradeResourceProvider.UPGRADE_TYPE));
 
     // upgrade groups
     propertyIds.clear();
@@ -605,6 +605,7 @@ public class UpgradeResourceProviderTest {
     requestProps.put(UpgradeResourceProvider.UPGRADE_CLUSTER_NAME, "c1");
     requestProps.put(UpgradeResourceProvider.UPGRADE_VERSION, "2.1.1.1");
     requestProps.put(UpgradeResourceProvider.UPGRADE_PACK, "upgrade_test");
+    requestProps.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, "true");
 
     ResourceProvider upgradeResourceProvider = createProvider(amc);
 
@@ -1062,6 +1063,7 @@ public class UpgradeResourceProviderTest {
 
     UpgradeEntity entity = upgrades.get(0);
     assertEquals(cluster.getClusterId(), entity.getClusterId().longValue());
+    assertEquals(UpgradeType.ROLLING, entity.getUpgradeType());
 
     StageDAO stageDAO = injector.getInstance(StageDAO.class);
     List<StageEntity> stageEntities = stageDAO.findByRequestId(entity.getRequestId());


Mime
View raw message