You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2014/12/18 23:48:40 UTC

ambari git commit: AMBARI-8713. Oozie env configuration issue on CentOS6 (dlysnichenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk e9bbe6564 -> 1f8e6d83f


AMBARI-8713. Oozie env configuration issue on CentOS6 (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 1f8e6d83f8b9095b211b32490047b5e7417ab737
Parents: e9bbe65
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Fri Dec 19 00:48:04 2014 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Fri Dec 19 00:48:04 2014 +0200

----------------------------------------------------------------------
 .../ambari/server/stack/ServiceModule.java      | 24 +++++++++++
 .../ambari/server/stack/ServiceModuleTest.java  | 43 ++++++++++++++++++++
 2 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f8e6d83/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index 400dd27..a30d761 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -24,6 +24,8 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -161,6 +163,7 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> {
     mergeConfigDependencies(parent);
     mergeComponents(parentModule, allStacks, commonServices);
     mergeConfigurations(parentModule, allStacks, commonServices);
+    mergeExcludedConfigTypes(parent);
   }
 
   /**
@@ -259,6 +262,27 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> {
   }
 
   /**
+   * Merge excluded configs types with parent.  Child values override parent values.
+   *
+   * @param parent parent service module
+   */
+
+  private void mergeExcludedConfigTypes(ServiceInfo parent){
+    if (serviceInfo.getExcludedConfigTypes() == null){
+      serviceInfo.setExcludedConfigTypes(parent.getExcludedConfigTypes());
+    } else if (parent.getExcludedConfigTypes() != null){
+      Set<String> resultExcludedConfigTypes = serviceInfo.getExcludedConfigTypes();
+      for (String excludedType : parent.getExcludedConfigTypes()) {
+        if (!resultExcludedConfigTypes.contains(excludedType)){
+          resultExcludedConfigTypes.add(excludedType);
+        }
+      }
+      serviceInfo.setExcludedConfigTypes(resultExcludedConfigTypes);
+    }
+
+  }
+
+  /**
    * Merge configuration dependencies with parent.  Child values override parent values.
    *
    * @param parent  parent service module

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f8e6d83/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
index fc12d75..1ae4cd1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java
@@ -32,8 +32,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.CommandScriptDefinition;
 import org.apache.ambari.server.state.ComponentInfo;
@@ -873,6 +876,46 @@ public class ServiceModuleTest {
   }
 
   @Test
+  public void testMerge_Configuration__ExcludedTypes() throws Exception {
+    // child
+    ServiceInfo info = new ServiceInfo();
+    Set<String> childExcludedConfigTypes = new HashSet<String>();
+    childExcludedConfigTypes.add("FOO");
+    info.setExcludedConfigTypes(childExcludedConfigTypes);
+
+    //FOO
+    Collection<PropertyInfo> fooProperties = new ArrayList<PropertyInfo>();
+
+    ConfigurationModule childConfigModule = createConfigurationModule("FOO", fooProperties);
+    Collection<ConfigurationModule> childConfigModules = new ArrayList<ConfigurationModule>();
+    childConfigModules.add(childConfigModule);
+
+    // parent
+    ServiceInfo parentInfo = new ServiceInfo();
+    Set<String> parentExcludedConfigTypes = new HashSet<String>();
+    childExcludedConfigTypes.add("BAR");
+    info.setExcludedConfigTypes(childExcludedConfigTypes);
+    parentInfo.setExcludedConfigTypes(parentExcludedConfigTypes);
+    //BAR
+    Collection<PropertyInfo> barProperties = new ArrayList<PropertyInfo>();
+
+
+    ConfigurationModule parentConfigModule = createConfigurationModule("BAR", barProperties);
+    Collection<ConfigurationModule> parentConfigModules = new ArrayList<ConfigurationModule>();
+    parentConfigModules.add(parentConfigModule);
+
+    // create service modules
+    ServiceModule service = createServiceModule(info, childConfigModules);
+    ServiceModule parentService = createServiceModule(parentInfo, parentConfigModules);
+    // resolve child with parent
+
+    resolveService(service, parentService);
+
+    //resolveService(service, parentService);
+    assertEquals(2, service.getModuleInfo().getExcludedConfigTypes().size());
+  }
+
+  @Test
   public void testServiceCheckRegistered() throws Exception {
     ServiceInfo info = new ServiceInfo();
     info.setName("service1");