ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [34/50] [abbrv] ambari git commit: AMBARI-20811. Trying to upgrade HDF 2.0.2.0 to HDF 3.0.0.0 fails with NPE (dlysnichenko)
Date Mon, 24 Apr 2017 12:01:49 GMT
AMBARI-20811. Trying to upgrade HDF 2.0.2.0 to HDF 3.0.0.0 fails with NPE (dlysnichenko)


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

Branch: refs/heads/branch-3.0-perf
Commit: 6b549d36fb196a423cfa2ba83971e9f1fa39b220
Parents: 9f113f9
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Fri Apr 21 16:09:01 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Mon Apr 24 14:59:56 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/stack/StackDirectory.java    | 4 ++++
 .../java/org/apache/ambari/server/stack/StackManagerTest.java  | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b549d36/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
index d0950a7..5b44112 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.stack;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -437,6 +438,9 @@ public class StackDirectory extends StackDefinitionDirectory {
     if (configUpgradePack != null) {
       this.configUpgradePack = configUpgradePack;
     } else {
+      ConfigUpgradePack emptyConfigUpgradePack = new ConfigUpgradePack();
+      emptyConfigUpgradePack.services = new ArrayList<>();
+      this.configUpgradePack = emptyConfigUpgradePack;
       LOG.info("Stack '{}' doesn't contain config upgrade pack file", getPath());
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b549d36/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 8c7ab9d..d8c02dc 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -58,6 +58,7 @@ import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.ServiceOsSpecific;
 import org.apache.ambari.server.state.StackInfo;
+import org.apache.ambari.server.state.stack.ConfigUpgradePack;
 import org.apache.ambari.server.state.stack.MetricDefinition;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.stack.UpgradePack;
@@ -728,7 +729,7 @@ public class StackManagerTest {
   }
 
   /**
-   * Tests that {@link UpgradePack} instances are correctly initialized
+   * Tests that {@link UpgradePack} and {@link ConfigUpgradePack} instances are correctly
initialized
    * post-unmarshalling.
    *
    * @throws Exception
@@ -745,6 +746,9 @@ public class StackManagerTest {
       // reference equality (make sure it's the same list)
       assertTrue(upgradePack.getTasks() == upgradePack.getTasks());
     }
+    ConfigUpgradePack configUpgradePack = stack.getConfigUpgradePack();
+    assertNotNull(configUpgradePack);
+    assertNotNull(configUpgradePack.services);
   }
 
   @Test


Mime
View raw message