Browse Source

AMBARI-3474. Add empty string as a valid config value (ncole)

Nate Cole 11 years ago
parent
commit
883d33eb9b

+ 1 - 2
ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java

@@ -309,8 +309,7 @@ public class StackExtensionHelper {
       List<PropertyInfo> list = new ArrayList<PropertyInfo>();
       
       for (PropertyInfo pi : cx.getProperties()) {
-        // maintain old behavior
-        if (null == pi.getValue() || pi.getValue().isEmpty())
+        if (null == pi.getValue())
           continue;
         
         pi.setFilename(propertyFile.getName());

+ 10 - 9
ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java

@@ -59,13 +59,13 @@ import org.slf4j.LoggerFactory;
 
 public class AmbariMetaInfoTest {
 
-  private static String STACK_NAME_HDP = "HDP";
-  private static String STACK_VERSION_HDP = "0.1";
-  private static String EXT_STACK_NAME = "2.0.6";
-  private static String STACK_VERSION_HDP_02 = "0.2";
+  private static final String STACK_NAME_HDP = "HDP";
+  private static final String STACK_VERSION_HDP = "0.1";
+  private static final String EXT_STACK_NAME = "2.0.6";
+  private static final String STACK_VERSION_HDP_02 = "0.2";
   private static final String STACK_MINIMAL_VERSION_HDP = "0.0";
-  private static String SERVICE_NAME_HDFS = "HDFS";
-  private static String SERVICE_COMPONENT_NAME = "NAMENODE";
+  private static final String SERVICE_NAME_HDFS = "HDFS";
+  private static final String SERVICE_COMPONENT_NAME = "NAMENODE";
   private static final String OS_TYPE = "centos5";
   private static final String REPO_ID = "HDP-UTILS-1.1.0.15";
   private static final String PROPERTY_NAME = "hbase.regionserver.msginterval";
@@ -505,9 +505,10 @@ public class AmbariMetaInfoTest {
     Assert.assertNotNull("yarn.nodemanager.address expected to be inherited " +
       "from parent", inheritedProperty);
     Assert.assertEquals("localhost:100009", redefinedProperty1.getValue());
-    // Parent property value will result in property being present in the
+    // Empty Parent property value will result in property being present in the
     // child stack
-    Assert.assertEquals("localhost:8141", redefinedProperty2.getValue());
+    Assert.assertEquals("Expected property '" + redefinedProperty2.getName() + "'",
+        "", redefinedProperty2.getValue());
     // New property
     Assert.assertNotNull(newProperty);
     Assert.assertEquals("some-value", newProperty.getValue());
@@ -599,7 +600,7 @@ public class AmbariMetaInfoTest {
   @Test
   public void testPropertyCount() throws Exception {
     Set<PropertyInfo> properties = metaInfo.getProperties(STACK_NAME_HDP, STACK_VERSION_HDP_02, SERVICE_NAME_HDFS);
-    Assert.assertEquals(81, properties.size());
+    Assert.assertEquals(84, properties.size());
   }
   
   @Test

+ 3 - 2
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

@@ -118,7 +118,7 @@ public class AmbariManagementControllerTest {
   private static final int REPOS_CNT = 3;
   private static final int STACKS_CNT = 1;
   private static final int STACK_SERVICES_CNT = 5 ;
-  private static final int STACK_PROPERTIES_CNT = 81;
+  private static final int STACK_PROPERTIES_CNT = 84;
   private static final int STACK_COMPONENTS_CNT = 3;
   private static final int OS_CNT = 2;
 
@@ -6904,6 +6904,7 @@ public class AmbariManagementControllerTest {
     requests.clear();
     request = new RepositoryRequest(STACK_NAME, STACK_VERSION, OS_TYPE, REPO_ID);
     request.setBaseUrl(repo.getDefaultBaseUrl());
+    request.setVerifyBaseUrl(false);
     requests.add(request);
     controller.updateRespositories(requests);
     Assert.assertEquals(repo.getBaseUrl(), repo.getDefaultBaseUrl());
@@ -7341,4 +7342,4 @@ public class AmbariManagementControllerTest {
   }
 }
 
-  
+