ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [48/94] ambari git commit: AMBARI-17112. Fixed implementation of on-ambari-upgrade support. Patch 1 - change validation rules and available fields (dlysnichenko)
Date Thu, 09 Jun 2016 14:20:08 GMT
AMBARI-17112. Fixed implementation of on-ambari-upgrade support. Patch 1 - change validation
rules and available fields (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 9699f57d55c3305de2ae01290836caf60c41683e
Parents: b57a7cf
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Jun 9 16:15:49 2016 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Jun 9 17:16:19 2016 +0300

----------------------------------------------------------------------
 .../ambari/server/state/PropertyInfo.java       | 23 +++-----------------
 .../server/state/PropertyUpgradeBehavior.java   | 16 +++++++-------
 .../configurations-set-default-update-policy.sh | 11 +++-------
 .../ambari/server/state/PropertyInfoTest.java   | 19 +++++-----------
 4 files changed, 19 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9699f57d/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
index fba2daa..c570ab3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyInfo.java
@@ -28,7 +28,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAnyElement;
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementRef;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlList;
 
@@ -51,9 +50,6 @@ public class PropertyInfo {
   private String filename;
   private boolean deleted;
 
-  @XmlElement(name="on-stack-upgrade", required = true)
-  private PropertyUpgradeBehavior propertyStackUpgradeBehavior;
-
   @XmlElement(name="on-ambari-upgrade", required = true)
   private PropertyUpgradeBehavior propertyAmbariUpgradeBehavior;
 
@@ -89,15 +85,10 @@ public class PropertyInfo {
   }
 
   public PropertyInfo() {
-    propertyStackUpgradeBehavior = new PropertyUpgradeBehavior();
-    propertyStackUpgradeBehavior.setAdd(true);
-    propertyStackUpgradeBehavior.setChange(true);
-    propertyStackUpgradeBehavior.setDelete(false);
-
     propertyAmbariUpgradeBehavior = new PropertyUpgradeBehavior();
-    propertyAmbariUpgradeBehavior.setAdd(false);
-    propertyAmbariUpgradeBehavior.setChange(true);
-    propertyAmbariUpgradeBehavior.setDelete(true);
+    propertyAmbariUpgradeBehavior.setAdd(true);
+    propertyAmbariUpgradeBehavior.setUpdate(false);
+    propertyAmbariUpgradeBehavior.setDelete(false);
   }
 
   public String getName() {
@@ -148,14 +139,6 @@ public class PropertyInfo {
     this.propertyTypes = propertyTypes;
   }
 
-  public PropertyUpgradeBehavior getPropertyStackUpgradeBehavior() {
-    return propertyStackUpgradeBehavior;
-  }
-
-  public void setPropertyStackUpgradeBehavior(PropertyUpgradeBehavior propertyStackUpgradeBehavior)
{
-    this.propertyStackUpgradeBehavior = propertyStackUpgradeBehavior;
-  }
-
   public PropertyUpgradeBehavior getPropertyAmbariUpgradeBehavior() {
     return propertyAmbariUpgradeBehavior;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9699f57d/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyUpgradeBehavior.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyUpgradeBehavior.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyUpgradeBehavior.java
index de2e342..f6791ee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyUpgradeBehavior.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/PropertyUpgradeBehavior.java
@@ -33,15 +33,15 @@ public class PropertyUpgradeBehavior {
   @XmlAttribute(name="delete", required = true)
   private boolean delete;
 
-  @XmlAttribute(name="change", required = true)
-  private boolean change;
+  @XmlAttribute(name="update", required = true)
+  private boolean update;
 
   public PropertyUpgradeBehavior() {}
 
-  public PropertyUpgradeBehavior(boolean add, boolean delete, boolean change) {
+  public PropertyUpgradeBehavior(boolean add, boolean delete, boolean update) {
     this.add = add;
     this.delete = delete;
-    this.change = change;
+    this.update = update;
   }
 
   public void setAdd( boolean add )
@@ -54,9 +54,9 @@ public class PropertyUpgradeBehavior {
     this.delete = delete;
   }
 
-  public void setChange( boolean change )
+  public void setUpdate(boolean update )
   {
-    this.change = change;
+    this.update = update;
   }
 
   public boolean isAdd() {
@@ -67,7 +67,7 @@ public class PropertyUpgradeBehavior {
     return delete;
   }
 
-  public boolean isChange() {
-    return change;
+  public boolean isUpdate() {
+    return update;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9699f57d/ambari-server/src/main/resources/scripts/configurations-set-default-update-policy.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/configurations-set-default-update-policy.sh
b/ambari-server/src/main/resources/scripts/configurations-set-default-update-policy.sh
index 930f778..550f1c2 100644
--- a/ambari-server/src/main/resources/scripts/configurations-set-default-update-policy.sh
+++ b/ambari-server/src/main/resources/scripts/configurations-set-default-update-policy.sh
@@ -27,12 +27,7 @@ do
   xmlstarlet ed --inplace -d "//on-stack-upgrade" $i
 
   `xmlstarlet ed --inplace --subnode "/configuration/property" -t 'elem' -n "on-ambari-upgrade"
$i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "add" -v "false" $i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "change" -v "true" $i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "delete" -v "true" $i`;
-
-  `xmlstarlet ed --inplace --subnode "/configuration/property" -t 'elem' -n "on-stack-upgrade"
$i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-stack-upgrade" -t 'attr'
-n "add" -v "true" $i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-stack-upgrade" -t 'attr'
-n "change" -v "true" $i`;
-  `xmlstarlet ed --inplace --subnode "/configuration/property/on-stack-upgrade" -t 'attr'
-n "delete" -v "false" $i`;
+  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "add" -v "true" $i`;
+  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "update" -v "false" $i`;
+  `xmlstarlet ed --inplace --subnode "/configuration/property/on-ambari-upgrade" -t 'attr'
-n "delete" -v "false" $i`;
 done

http://git-wip-us.apache.org/repos/asf/ambari/blob/9699f57d/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
index 9a3d195..8abeb03 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
@@ -103,8 +103,7 @@ public class PropertyInfoTest {
       "<property>\n" +
       "  <name>prop_name</name>\n" +
       "  <value>prop_val</value>\n" +
-      "  <on-ambari-upgrade add=\"true\" change=\"true\" delete=\"true\"/>\n" +
-      "  <on-stack-upgrade add=\"false\" change=\"false\" delete=\"false\"/>\n" +
+      "  <on-ambari-upgrade add=\"true\" update=\"true\" delete=\"true\"/>\n" +
       "</property>";
 
     // when
@@ -112,12 +111,8 @@ public class PropertyInfoTest {
 
     // then
     assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isAdd());
-    assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isChange());
+    assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isUpdate());
     assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isDelete());
-
-    assertFalse(propertyInfo.getPropertyStackUpgradeBehavior().isAdd());
-    assertFalse(propertyInfo.getPropertyStackUpgradeBehavior().isChange());
-    assertFalse(propertyInfo.getPropertyStackUpgradeBehavior().isDelete());
   }
 
   @Test
@@ -134,13 +129,9 @@ public class PropertyInfoTest {
 
     // then
 
-    assertFalse(propertyInfo.getPropertyAmbariUpgradeBehavior().isAdd());
-    assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isChange());
-    assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isDelete());
-
-    assertTrue(propertyInfo.getPropertyStackUpgradeBehavior().isAdd());
-    assertTrue(propertyInfo.getPropertyStackUpgradeBehavior().isChange());
-    assertFalse(propertyInfo.getPropertyStackUpgradeBehavior().isDelete());
+    assertTrue(propertyInfo.getPropertyAmbariUpgradeBehavior().isAdd());
+    assertFalse(propertyInfo.getPropertyAmbariUpgradeBehavior().isUpdate());
+    assertFalse(propertyInfo.getPropertyAmbariUpgradeBehavior().isDelete());
   }
 
   @Test


Mime
View raw message