ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abaranc...@apache.org
Subject [3/6] git commit: AMBARI-5155 - Redundant Hive server component name in API
Date Fri, 21 Mar 2014 15:56:53 GMT
AMBARI-5155 - Redundant Hive server component name in API


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

Branch: refs/heads/trunk
Commit: 18ab92c9c645353644402a4d51f31d28c9fa12ea
Parents: efb8bd9
Author: Artem Baranchuk <abaranchuk@hortonworks.com>
Authored: Fri Mar 21 01:03:28 2014 +0200
Committer: Artem Baranchuk <abaranchuk@hortonworks.com>
Committed: Fri Mar 21 17:55:21 2014 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/ambari/msi/ClusterDefinition.java  | 4 +---
 .../main/java/org/apache/ambari/scom/SQLProviderModule.java | 9 ++++++---
 .../java/org/apache/ambari/msi/ComponentProviderTest.java   | 2 +-
 .../org/apache/ambari/msi/HostComponentProviderTest.java    | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/18ab92c9/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
index e21afa3..830da48 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java
@@ -83,7 +83,6 @@ public class ClusterDefinition {
 
     Set<String> hiveComponents = new HashSet<String>();
     hiveComponents.add("HIVE_SERVER");
-    hiveComponents.add("HIVE_SERVER2");
     hiveComponents.add("HIVE_METASTORE");
     hiveComponents.add("HIVE_CLIENT");
     componentNameMap.put("HIVE_SERVER_HOST", hiveComponents);
@@ -125,7 +124,6 @@ public class ClusterDefinition {
     componentServiceMap.put("DATANODE",           "HDFS");
     componentServiceMap.put("SECONDARY_NAMENODE", "HDFS");
     componentServiceMap.put("HIVE_SERVER",        "HIVE");
-    componentServiceMap.put("HIVE_SERVER2",       "HIVE");
     componentServiceMap.put("HIVE_METASTORE",     "HIVE");
     componentServiceMap.put("HIVE_CLIENT",        "HIVE");
     componentServiceMap.put("OOZIE_SERVER",       "OOZIE");
@@ -183,7 +181,7 @@ public class ClusterDefinition {
     initComponentServiceMap();
   }
 
-  private Integer getMajorStackVersion() {
+  public Integer getMajorStackVersion() {
     if(StringUtils.isNotEmpty(versionId)) {
       String majorVersion = StringUtils.substring(versionId, 4, 5);
       if(StringUtils.isNotEmpty(majorVersion)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/18ab92c9/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
index a4503b6..c403df3 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/SQLProviderModule.java
@@ -60,13 +60,15 @@ public class SQLProviderModule extends DefaultProviderModule implements
HostInfo
 
   private static Map<String, String> serviceNames = new HashMap<String, String>();
 
-  static {
+  private void initServiceNames() {
+    Integer majorStackVersion = clusterDefinition.getMajorStackVersion();
+    if(majorStackVersion != null) {
+        serviceNames.put("HIVE_SERVER", majorStackVersion == 1 ? "hiveserver" : "hiveserver2");
+    }
     serviceNames.put("NAMENODE", "namenode");
     serviceNames.put("SECONDARY_NAMENODE", "secondarynamenode");
     serviceNames.put("JOBTRACKER", "jobtracker");
     serviceNames.put("HISTORYSERVER", "historyserver");
-    serviceNames.put("HIVE_SERVER", "hiveserver");
-    serviceNames.put("HIVE_SERVER2", "hiveserver2");
     serviceNames.put("HIVE_METASTORE", "metastore");
     serviceNames.put("HIVE_CLIENT", "hwi");
     serviceNames.put("OOZIE_SERVER", "oozieservice");
@@ -89,6 +91,7 @@ public class SQLProviderModule extends DefaultProviderModule implements
HostInfo
 
   public SQLProviderModule() {
     clusterDefinition = new ClusterDefinition(this, ClusterDefinitionProvider.instance(),
this);
+    initServiceNames();
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/18ab92c9/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
index 0f16912..8283d32 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/ComponentProviderTest.java
@@ -41,7 +41,7 @@ public class ComponentProviderTest {
     ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(),
new TestClusterDefinitionProvider(), new TestHostInfoProvider());
     ComponentProvider provider = new ComponentProvider(clusterDefinition);
     Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(),
null);
-    Assert.assertEquals(16, resources.size());
+    Assert.assertEquals(15, resources.size());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/18ab92c9/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
index 582c5bd..25724ac 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/test/java/org/apache/ambari/msi/HostComponentProviderTest.java
@@ -41,7 +41,7 @@ public class HostComponentProviderTest {
     ClusterDefinition clusterDefinition = new ClusterDefinition(new TestStateProvider(),
new TestClusterDefinitionProvider(), new TestHostInfoProvider());
     HostComponentProvider provider = new HostComponentProvider(clusterDefinition);
     Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(),
null);
-    Assert.assertEquals(26, resources.size());
+    Assert.assertEquals(25, resources.size());
   }
 
   @Test


Mime
View raw message