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/02/03 19:14:18 UTC

git commit: AMBARI-4509. Schema version is not determined correctly under some conditions (dlysnichenko)

Updated Branches:
  refs/heads/trunk 0064670d4 -> 3289ea060


AMBARI-4509. Schema version is not determined correctly under some conditions (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 3289ea060ef4a4249bf5501e95bbe38461e12b9d
Parents: 0064670
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Mon Feb 3 20:12:43 2014 +0200
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Mon Feb 3 20:13:44 2014 +0200

----------------------------------------------------------------------
 .../server/api/util/StackExtensionHelper.java   |  1 +
 .../server/api/services/AmbariMetaInfoTest.java | 10 +++++
 .../api/util/StackExtensionHelperTest.java      |  5 ++-
 .../HDP/2.0.7/services/SQOOP/metainfo.xml       | 39 ++++++++++++++++++++
 .../HDP/2.0.8/services/SQOOP/metainfo.xml       | 39 ++++++++++++++++++++
 5 files changed, 92 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3289ea06/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
index 13e1dd2..fb622e0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/util/StackExtensionHelper.java
@@ -122,6 +122,7 @@ public class StackExtensionHelper {
   private ServiceInfo mergeServices(ServiceInfo parentService,
                                     ServiceInfo childService) {
     ServiceInfo mergedServiceInfo = new ServiceInfo();
+    mergedServiceInfo.setSchemaVersion(childService.getSchemaVersion());
     mergedServiceInfo.setName(childService.getName());
     mergedServiceInfo.setComment(childService.getComment());
     mergedServiceInfo.setUser(childService.getUser());

http://git-wip-us.apache.org/repos/asf/ambari/blob/3289ea06/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 2a4310b..802c9f1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -1228,6 +1228,16 @@ public class AmbariMetaInfoTest {
             service.getOsSpecifics().get("any").getPackages().get(0).getName());
   }
 
+  @Test
+  public void testServiceSchemaVersionInheritance() throws Exception {
+    // Check parent
+    ServiceInfo service = metaInfo.getService(STACK_NAME_HDP, "2.0.7", "SQOOP");
+    Assert.assertEquals("2.0", service.getSchemaVersion());
+    // Test child service metainfo after merge
+    service = metaInfo.getService(STACK_NAME_HDP, "2.0.8", "SQOOP");
+    Assert.assertEquals("2.0", service.getSchemaVersion());
+  }
+
 
   private CustomCommandDefinition findCustomCommand(String ccName,
                                                     ServiceInfo service) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3289ea06/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
index 2e064e8..94bcf12 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/util/StackExtensionHelperTest.java
@@ -51,7 +51,7 @@ public class StackExtensionHelperTest {
     StackExtensionHelper helper = new StackExtensionHelper(stackRoot);
     helper.populateServicesForStack(stackInfo);
     List<ServiceInfo> services =  stackInfo.getServices();
-    assertEquals(5, services.size());
+    assertEquals(6, services.size());
     for (ServiceInfo serviceInfo : services) {
       if (serviceInfo.getName().equals("HIVE")) {
         // Check old-style service
@@ -177,7 +177,8 @@ public class StackExtensionHelperTest {
       } else {
         if (!serviceInfo.getName().equals("YARN") &&
             !serviceInfo.getName().equals("HDFS") &&
-            !serviceInfo.getName().equals("MAPREDUCE2")) {
+            !serviceInfo.getName().equals("MAPREDUCE2") &&
+            !serviceInfo.getName().equals("SQOOP")) {
           fail("Unknown service");
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3289ea06/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/SQOOP/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/SQOOP/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/SQOOP/metainfo.xml
new file mode 100644
index 0000000..44d4232
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.7/services/SQOOP/metainfo.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>SQOOP</name>
+      <comment>Tool for transferring bulk data between Apache Hadoop and structured data stores such as relational databases</comment>
+      <version>1.23</version>
+      <components>
+        <component>
+          <name>SQOOP</name>
+          <category>CLIENT</category>
+          <commandScript>
+            <script>scripts/resourcemanager.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+    </service>
+  </services>
+
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/3289ea06/ambari-server/src/test/resources/stacks/HDP/2.0.8/services/SQOOP/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.8/services/SQOOP/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/2.0.8/services/SQOOP/metainfo.xml
new file mode 100644
index 0000000..44d4232
--- /dev/null
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.8/services/SQOOP/metainfo.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>SQOOP</name>
+      <comment>Tool for transferring bulk data between Apache Hadoop and structured data stores such as relational databases</comment>
+      <version>1.23</version>
+      <components>
+        <component>
+          <name>SQOOP</name>
+          <category>CLIENT</category>
+          <commandScript>
+            <script>scripts/resourcemanager.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+    </service>
+  </services>
+
+</metainfo>