ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject [41/51] [partial] AMBARI-7621. Import initial contribution for Ambari support on Windows to branch-windows-dev. (Jayush Luniya and Florian Barca via yusaku)
Date Tue, 07 Oct 2014 22:53:09 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py b/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py
index 32a7963..90397ae 100644
--- a/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py
+++ b/ambari-agent/src/test/python/resource_management/TestCopyFromLocal.py
@@ -36,10 +36,10 @@ class TestCopyFromLocal(TestCase):
       call_arg_list = execute_hadoop_mock.call_args_list
       self.assertEqual('fs -copyFromLocal /user/testdir/*.files /apps/test/',
                        call_arg_list[0][0][0].command)
-      self.assertEquals({'not_if': "su - user1 -c ' export PATH=$PATH:/usr/bin ; hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'},
+      self.assertEquals({'not_if': "su - user1 -c ' hadoop fs -ls /apps/test/*.files' >/dev/null 2>&1", 'user': 'user1', 'conf_dir': '/etc/hadoop/conf'},
                         call_arg_list[0][0][0].arguments)
-      self.assertEquals('fs -chown user1 /apps/test//*.files', call_arg_list[1][0][0].command)
-      self.assertEquals({'user': 'hdfs', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments)
+      self.assertEquals('fs -chown user1 /apps/test/*.files', call_arg_list[1][0][0].command)
+      self.assertEquals({'user': 'hdfs', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments)
 
 
   @patch("resource_management.libraries.providers.execute_hadoop.ExecuteHadoopProvider")
@@ -57,9 +57,9 @@ class TestCopyFromLocal(TestCase):
       call_arg_list = execute_hadoop_mock.call_args_list
       self.assertEqual('fs -copyFromLocal /user/testdir/*.files /apps/test/',
                        call_arg_list[0][0][0].command)
-      self.assertEquals({'not_if': "su - user1 -c ' export PATH=$PATH:/usr/bin ; hadoop fs -ls /apps/test//*.files' >/dev/null 2>&1", 'user': 'user1', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'},
+      self.assertEquals({'not_if': "su - user1 -c ' hadoop fs -ls /apps/test/*.files' >/dev/null 2>&1", 'user': 'user1', 'conf_dir': '/etc/hadoop/conf'},
                         call_arg_list[0][0][0].arguments)
-      self.assertEquals('fs -chown user1:hdfs /apps/test//*.files', call_arg_list[1][0][0].command)
-      self.assertEquals({'user': 'hdfs', 'bin_dir': '/usr/bin', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments)
+      self.assertEquals('fs -chown user1:hdfs /apps/test/*.files', call_arg_list[1][0][0].command)
+      self.assertEquals({'user': 'hdfs', 'conf_dir': '/etc/hadoop/conf'}, call_arg_list[1][0][0].arguments)
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestExecuteHadoopResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestExecuteHadoopResource.py b/ambari-agent/src/test/python/resource_management/TestExecuteHadoopResource.py
index d2ef71c..e357390 100644
--- a/ambari-agent/src/test/python/resource_management/TestExecuteHadoopResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestExecuteHadoopResource.py
@@ -15,7 +15,6 @@ 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.
 '''
-import os
 
 from unittest import TestCase
 from mock.mock import patch
@@ -39,11 +38,7 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_count, 1)
       self.assertEqual(execute_mock.call_args[0][0].command,'hadoop --config conf_dir command')
       self.assertEqual(execute_mock.call_args[0][0].arguments,
-                       {'logoutput': True,
-                        'tries': 1,
-                        'user': 'user',
-                        'try_sleep': 0,
-                        'path': []})
+                       {'logoutput': True, 'tries': 1, 'user': 'user', 'try_sleep': 0})
 
 
   @patch("resource_management.core.providers.system.ExecuteProvider")
@@ -63,11 +58,7 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_count, 1)
       self.assertEqual(execute_mock.call_args[0][0].command,'hadoop --config conf_dir command')
       self.assertEqual(execute_mock.call_args[0][0].arguments,
-                       {'logoutput': False,
-                        'tries': 1,
-                        'user': 'user',
-                        'try_sleep': 0,
-                        'path': []})
+                       {'logoutput': False, 'tries': 1, 'user': 'user', 'try_sleep': 0})
 
 
   @patch("resource_management.core.providers.system.ExecuteProvider")
@@ -92,11 +83,7 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_count, 1)
       self.assertEqual(execute_mock.call_args[0][0].command,'hadoop --config conf_dir command')
       self.assertEqual(execute_mock.call_args[0][0].arguments,
-                       {'logoutput': True,
-                        'tries': 2,
-                        'user': 'user',
-                        'try_sleep': 2,
-                        'path': []})
+                       {'logoutput': True, 'tries': 2, 'user': 'user', 'try_sleep': 2})
 
 
   @patch("resource_management.core.providers.system.ExecuteProvider")
@@ -118,17 +105,9 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_args_list[1][0][0].command,
                        'hadoop --config conf_dir command2')
       self.assertEqual(execute_mock.call_args_list[0][0][0].arguments,
-                       {'logoutput': False,
-                        'tries': 1,
-                        'user': 'user',
-                        'try_sleep': 0,
-                        'path': []})
+                       {'logoutput': False, 'tries': 1, 'user': 'user', 'try_sleep': 0})
       self.assertEqual(execute_mock.call_args_list[1][0][0].arguments,
-                       {'logoutput': False,
-                        'tries': 1,
-                        'user': 'user',
-                        'try_sleep': 0,
-                        'path': []})
+                       {'logoutput': False, 'tries': 1, 'user': 'user', 'try_sleep': 0})
 
 
   @patch("resource_management.core.providers.system.ExecuteProvider")
@@ -177,11 +156,7 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_args_list[1][0][0].command,
                        'hadoop --config conf_dir command')
       self.assertEqual(execute_mock.call_args_list[1][0][0].arguments,
-                       {'logoutput': True,
-                        'tries': 1,
-                        'user': 'user',
-                        'try_sleep': 0,
-                        'path': []})
+                       {'logoutput': True, 'tries': 1, 'user': 'user', 'try_sleep': 0})
 
 
   @patch("resource_management.core.providers.system.ExecuteProvider")
@@ -229,4 +204,4 @@ class TestExecuteHadoopResource(TestCase):
       self.assertEqual(execute_mock.call_args_list[0][0][0].command,
                        'path -kt keytab principal')
       self.assertEqual(execute_mock.call_args_list[1][0][0].command,
-                       'hadoop --config conf_dir command')
+                       'hadoop --config conf_dir command')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestExecuteResource.py b/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
index 93d7064..f0a4539 100644
--- a/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
@@ -90,8 +90,7 @@ class TestExecuteResource(TestCase):
       execute_resource = Execute('echo "1"',
                                  path=["/test/one", "test/two"]
       )
-    expected_command = 'export PATH=$PATH:/test/one:test/two ; echo "1"'
-    self.assertEqual(popen_mock.call_args_list[0][0][0][3], expected_command)
+    self.assertEqual(execute_resource.environment["PATH"], '/test/one:test/two')
 
   @patch('time.sleep')
   @patch.object(subprocess, "Popen")

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestFileResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestFileResource.py b/ambari-agent/src/test/python/resource_management/TestFileResource.py
index be6c6e7..7da0dbd 100644
--- a/ambari-agent/src/test/python/resource_management/TestFileResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestFileResource.py
@@ -330,34 +330,3 @@ class TestFileResource(TestCase):
 
     self.assertEqual(chmod_mock.call_count, 1)
     self.assertEqual(chown_mock.call_count, 0)
-
-  @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch("resource_management.core.providers.system.FileProvider._get_content")
-  @patch("__builtin__.open")
-  @patch.object(os.path, "exists")
-  @patch.object(os.path, "isdir")
-  def test_action_create_encoding(self, isdir_mock, exists_mock, open_mock, get_content_mock ,ensure_mock):
-
-    isdir_mock.side_effect = [False, True]
-    exists_mock.return_value = True
-    content_mock = MagicMock()
-    old_content_mock = MagicMock()
-    get_content_mock.return_value = content_mock
-    new_file = MagicMock()
-    open_mock.return_value = new_file
-    enter_file_mock = MagicMock()
-    enter_file_mock.read = MagicMock(return_value=old_content_mock)
-    new_file.__enter__ = MagicMock(return_value=enter_file_mock)
-    with Environment('/') as env:
-      File('/directory/file',
-           action='create',
-           mode=0777,
-           content='file-content',
-           encoding = "UTF-8"
-      )
-
-
-    open_mock.assert_called_with('/directory/file', 'wb')
-    content_mock.encode.assert_called_with('UTF-8')
-    old_content_mock.decode.assert_called_with('UTF-8')
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestFileSystem.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestFileSystem.py b/ambari-agent/src/test/python/resource_management/TestFileSystem.py
deleted file mode 100644
index 91fd71d..0000000
--- a/ambari-agent/src/test/python/resource_management/TestFileSystem.py
+++ /dev/null
@@ -1,117 +0,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.
-'''
-
-import os
-from unittest import TestCase
-from mock.mock import patch
-
-from resource_management.libraries.functions import file_system
-import resource_management.core.providers.mount
-
-
-class TestFileSystem(TestCase):
-  """
-  Test the functionality of the file_system.py file that checks for the mount point of a path.
-  """
-
-  class MOUNT_TYPE:
-    SINGLE_ROOT = 1
-    MULT_DRIVE_CONFLICT = 2
-    MULT_DRIVE_DISTINCT = 3
-
-  def _get_mount(self, type):
-    """
-    /hadoop/hdfs/data will always be on the root
-
-    If the type is MULT_DRIVE_CONFLICT:
-    /hadoop/hdfs/data/1 is on /dev/sda1
-    /hadoop/hdfs/data/2 is on /dev/sda1
-
-    If the type is MULT_DRIVE_DISTINCT:
-    /hadoop/hdfs/data/1 is on /dev/sda1
-    /hadoop/hdfs/data/2 is on /dev/sda2
-    """
-    out = "/dev/mapper/VolGroup-lv_root on / type ext4 (rw)" + os.linesep + \
-          "proc on /proc type proc (rw)" + os.linesep + \
-          "sysfs on /sys type sysfs (rw)" + os.linesep + \
-          "devpts on /dev/pts type devpts (rw,gid=5,mode=620)" + os.linesep + \
-          "tmpfs on /dev/shm type tmpfs (rw)" + os.linesep + \
-          "/dev/sda1 on /boot type ext4 (rw)" + os.linesep + \
-          "none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)" + os.linesep + \
-          "sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)" + os.linesep + \
-          "/vagrant on /vagrant type vboxsf (uid=501,gid=501,rw)"
-
-    if type == self.MOUNT_TYPE.MULT_DRIVE_CONFLICT:
-      out += os.linesep + \
-             "/dev/sda1 on /hadoop/hdfs type ext4 (rw)"
-    elif type == self.MOUNT_TYPE.MULT_DRIVE_DISTINCT:
-      out += os.linesep + \
-             "/dev/sda1 on /hadoop/hdfs/data/1 type ext4 (rw)" + os.linesep + \
-             "/dev/sda2 on /hadoop/hdfs/data/2 type ext4 (rw)"
-
-    out_array = [x.split(' ') for x in out.strip().split('\n')]
-    mount_val = []
-    for m in out_array:
-      if len(m) >= 6 and m[1] == "on" and m[3] == "type":
-        x = dict(
-          device=m[0],
-          mount_point=m[2],
-          fstype=m[4],
-          options=m[5][1:-1].split(',') if len(m[5]) >= 2 else []
-        )
-        mount_val.append(x)
-
-    return mount_val
-
-  def test_invalid(self):
-    """
-    Testing when parameters are invalid or missing.
-    """
-    mount_point = file_system.get_mount_point_for_dir(None)
-    self.assertEqual(mount_point, None)
-
-    mount_point = file_system.get_mount_point_for_dir("")
-    self.assertEqual(mount_point, None)
-
-    mount_point = file_system.get_mount_point_for_dir("  ")
-    self.assertEqual(mount_point, None)
-
-
-  @patch('resource_management.core.providers.mount.get_mounted')
-  def test_at_root(self, mounted_mock):
-    """
-    Testing when the path is mounted on the root.
-    """
-    mounted_mock.return_value = self._get_mount(self.MOUNT_TYPE.SINGLE_ROOT)
-
-    mount_point = file_system.get_mount_point_for_dir("/hadoop/hdfs/data")
-    self.assertEqual(mount_point, "/")
-
-
-  @patch('resource_management.core.providers.mount.get_mounted')
-  def test_at_drive(self, mounted_mock):
-    """
-    Testing when the path is mounted on a virtual file system not at the root.
-    """
-    mounted_mock.return_value = self._get_mount(self.MOUNT_TYPE.MULT_DRIVE_DISTINCT)
-
-    mount_point = file_system.get_mount_point_for_dir("/hadoop/hdfs/data/1")
-    self.assertEqual(mount_point, "/hadoop/hdfs/data/1")
-
-    mount_point = file_system.get_mount_point_for_dir("/hadoop/hdfs/data/2")
-    self.assertEqual(mount_point, "/hadoop/hdfs/data/2")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestPackageResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestPackageResource.py b/ambari-agent/src/test/python/resource_management/TestPackageResource.py
index 1b0e7d2..08c7ac3 100644
--- a/ambari-agent/src/test/python/resource_management/TestPackageResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestPackageResource.py
@@ -17,7 +17,7 @@ limitations under the License.
 '''
 
 from unittest import TestCase
-from mock.mock import patch, MagicMock, call
+from mock.mock import patch, MagicMock
 
 from resource_management.core import Environment, Fail
 from resource_management.core.system import System
@@ -26,38 +26,17 @@ from resource_management.core.resources import Package
 from resource_management.core import shell
 
 class TestPackageResource(TestCase):
+
   @patch.object(shell, "call")
   @patch.object(shell, "checked_call")
-  @patch.object(System, "os_family", new = 'ubuntu')
-  def test_action_install_ubuntu_update(self, shell_mock, call_mock):
+  @patch.object(System, "os_family", new = 'debian')
+  def test_action_install_debian(self, shell_mock, call_mock):
     call_mock.return_value= (1, None)
     with Environment('/') as env:
       Package("some_package",
       )
-    call_mock.assert_has_calls([call("dpkg --get-selections some_package | grep -v deinstall"),
-                                call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q -o Dpkg::Options::='--force-confdef'"
-                                      " --allow-unauthenticated --assume-yes install some_package"),
-                                call("apt-get update -qq")
-                              ])
-    
-    shell_mock.assert_has_calls([call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q -o Dpkg::Options::='--force-confdef' --allow-unauthenticated --assume-yes install some_package")
-                              ])
-  
-  @patch.object(shell, "call")
-  @patch.object(shell, "checked_call")
-  @patch.object(System, "os_family", new = 'ubuntu')
-  def test_action_install_ubuntu(self, shell_mock, call_mock):
-    call_mock.side_effect = [(1, None), (0, None)]
-    with Environment('/') as env:
-      Package("some_package",
-      )
-    call_mock.assert_has_calls([call("dpkg --get-selections some_package | grep -v deinstall"),
-                                call("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q -o Dpkg::Options::='--force-confdef'"
-                                      " --allow-unauthenticated --assume-yes install some_package")
-                              ])
-    
-    self.assertEqual(shell_mock.call_count, 0, "shell.checked_call shouldn't be called")
-
+    call_mock.assert_called_with('dpkg --get-selections some_package | grep -v deinstall')
+    shell_mock.assert_called_with("env DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -q -o Dpkg::Options::='--force-confdef' --allow-unauthenticated --assume-yes install some_package")
 
 
   @patch.object(shell, "call")

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
index 4e4871a..e381e9a 100644
--- a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
@@ -123,8 +123,8 @@ class TestRepositoryResource(TestCase):
     @patch("os.path.isfile", new=MagicMock(return_value=True))
     @patch("filecmp.cmp", new=MagicMock(return_value=False))
     @patch.object(System, "os_release_name", new='precise')        
-    @patch.object(System, "os_family", new='ubuntu')
-    def test_create_repo_ubuntu_repo_exists(self, file_mock, execute_mock,
+    @patch.object(System, "os_family", new='debian')
+    def test_create_repo_debian_repo_exists(self, file_mock, execute_mock, 
                                             tempfile_mock, checked_call_mock):
       tempfile_mock.return_value = MagicMock(spec=file)
       tempfile_mock.return_value.__enter__.return_value.name = "/tmp/1.txt"
@@ -160,8 +160,8 @@ class TestRepositoryResource(TestCase):
     @patch("os.path.isfile", new=MagicMock(return_value=True))
     @patch("filecmp.cmp", new=MagicMock(return_value=True))
     @patch.object(System, "os_release_name", new='precise')        
-    @patch.object(System, "os_family", new='ubuntu')
-    def test_create_repo_ubuntu_doesnt_repo_exist(self, file_mock, execute_mock, tempfile_mock):
+    @patch.object(System, "os_family", new='debian')
+    def test_create_repo_debian_doesnt_repo_exist(self, file_mock, execute_mock, tempfile_mock):
       tempfile_mock.return_value = MagicMock(spec=file)
       tempfile_mock.return_value.__enter__.return_value.name = "/tmp/1.txt"
       
@@ -186,10 +186,10 @@ class TestRepositoryResource(TestCase):
       
     
     @patch("os.path.isfile", new=MagicMock(return_value=True))
-    @patch.object(System, "os_family", new='ubuntu')
+    @patch.object(System, "os_family", new='debian')
     @patch("resource_management.libraries.providers.repository.Execute")
     @patch("resource_management.libraries.providers.repository.File")
-    def test_remove_repo_ubuntu_repo_exist(self, file_mock, execute_mock):
+    def test_remove_repo_debian_repo_exist(self, file_mock, execute_mock):
       with Environment('/') as env:
           Repository('HDP',
                      action = "remove",
@@ -200,10 +200,10 @@ class TestRepositoryResource(TestCase):
       self.assertEqual(execute_mock.call_args[0][0], 'apt-get update -qq -o Dir::Etc::sourcelist="sources.list.d/HDP.list" -o APT::Get::List-Cleanup="0"')
 
     @patch("os.path.isfile", new=MagicMock(return_value=False))
-    @patch.object(System, "os_family", new='ubuntu')
+    @patch.object(System, "os_family", new='debian')
     @patch("resource_management.libraries.providers.repository.Execute")
     @patch("resource_management.libraries.providers.repository.File")
-    def test_remove_repo_ubuntu_repo_doenst_exist(self, file_mock, execute_mock):
+    def test_remove_repo_debian_repo_doenst_exist(self, file_mock, execute_mock):
       with Environment('/') as env:
           Repository('HDP',
                      action = "remove",

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
index e7a61e4..db9bb6c 100644
--- a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
@@ -61,9 +61,8 @@ class TestXmlConfigResource(TestCase):
     with Environment('/') as env:
       XmlConfig('file.xml',
                 conf_dir='/dir/conf',
-                configurations={},
-                configuration_attributes={}
-                )
+                configurations={}
+      )
 
     open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
     result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n  </configuration>\n')
@@ -94,12 +93,11 @@ class TestXmlConfigResource(TestCase):
     with Environment('/') as env:
       XmlConfig('file.xml',
                 conf_dir='/dir/conf',
-                configurations={'property1': 'value1'},
-                configuration_attributes={'attr': {'property1': 'attr_value'}}
-                )
+                configurations={'property1': 'value1'}
+      )
 
     open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
-    result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name>property1</name>\n      <value>value1</value>\n      <attr>attr_value</attr>\n    </property>\n    \n  </configuration>\n')
+    result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name>property1</name>\n      <value>value1</value>\n    </property>\n    \n  </configuration>\n')
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
@@ -133,88 +131,8 @@ class TestXmlConfigResource(TestCase):
                                 "prop.2": "INFO, openjpa",
                                 "prop.4": "${oozie.log.dir}/oozie.log",
                                 "prop.empty": "",
-                                },
-                configuration_attributes={
-                    "": {
-                        "prop.1": "should_not_be_printed",
-                        "prop.2": "should_not_be_printed",
-                    },
-                    "attr1": {
-                        "prop.1": "x",
-                        "prop.8": "not_existed",
-                    },
-                    "attr2": {
-                        "prop.4": "value4",
-                        "prop.3": "value3"
-                    },
-                    "attr_empty": {
-                    },
-                    "attr_value_empty": {
-                        "prop.4": "",
-                        "prop.empty": ""
-                    }
-                })
-
-    open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
-    result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.1</name>\n      <value>&#39;.&#39;yyyy-MM-dd-HH</value>\n      <attr1>x</attr1>\n    </property>\n    \n    <property>\n      <name>prop.2</name>\n      <value>INFO, openjpa</value>\n    </property>\n    \n    <property>\n      <name>prop.3</name>\n      <value>%d{ISO8601} %5p %c{1}:%L - %m%n</value>\n      <attr2>value3</attr2>\n    </property>\n    \n    <property>\n      <name>prop.4</name>\n      <value>${oozie.log.dir}/oozie.log</value>\n      <attr_value_empty></attr_value_empty>\n      <attr2>value4</attr2>\n    </property>\n    \n    <property>\n      <name>prop.empty</name>\n      <value></value>\n      <attr_value_empty></attr_value_empty>\n    </property>\n    \n  </configuration>\n')
-
-  @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch("__builtin__.open")
-  @patch.object(os.path, "exists")
-  @patch.object(os.path, "isdir")
-  @patch.object(time, "asctime")
-  def test_action_create_xml_config_sorted_by_key(self,
-                                                  time_asctime_mock,
-                                                  os_path_isdir_mock,
-                                                  os_path_exists_mock,
-                                                  open_mock,
-                                                  ensure_mock):
-    """
-    Tests if 'create' action - creates new non existent xml file and writes proper data
-    where configurations={"Key":"Value"} are stored in sorted by key order
-    """
-    os_path_isdir_mock.side_effect = [False, True]
-    os_path_exists_mock.return_value = False
-    time_asctime_mock.return_value = 'Wed 2014-02'
-
-    result_file = MagicMock()
-    open_mock.return_value = result_file
-
-    with Environment('/') as env:
-      XmlConfig('file.xml',
-                conf_dir='/dir/conf',
-                configurations={"": "",
-                                "third": "should be third",
-                                "first": "should be first",
-                                "z_last": "should be last",
-                                "second": "should be second",
-                                },
-                configuration_attributes={}
-                )
-
-    open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
-    result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>first</name>\n      <value>should be first</value>\n    </property>\n    \n    <property>\n      <name>second</name>\n      <value>should be second</value>\n    </property>\n    \n    <property>\n      <name>third</name>\n      <value>should be third</value>\n    </property>\n    \n    <property>\n      <name>z_last</name>\n      <value>should be last</value>\n    </property>\n    \n  </configuration>\n')
-
-  @patch("resource_management.libraries.providers.xml_config.File")
-  @patch.object(os.path, "exists")
-  @patch.object(os.path, "isdir")
-  def test_action_create_arguments(self, os_path_isdir_mock ,os_path_exists_mock, file_mock):
-
-    os_path_isdir_mock.side_effect = [False, True]
-    os_path_exists_mock.return_value = False
-
-    with Environment() as env:
-      XmlConfig('xmlFile.xml',
-                conf_dir='/dir/conf',
-                configurations={'property1': 'value1'},
-                configuration_attributes={'attr': {'property1': 'attr_value'}},
-                mode = 0755,
-                owner = "hdfs",
-                group = "hadoop",
-                encoding = "Code"
+                },
       )
 
-    self.assertEqual(file_mock.call_args[0][0],'/dir/conf/xmlFile.xml')
-    call_args = file_mock.call_args[1].copy()
-    del call_args['content']
-    self.assertEqual(call_args,{'owner': 'hdfs', 'group': 'hadoop', 'mode': 0755, 'encoding' : 'Code'})
+    open_mock.assert_called_with('/dir/conf/file.xml', 'wb')
+    result_file.__enter__().write.assert_called_with(u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.empty</name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.3</name>\n      <value>%d{ISO8601} %5p %c{1}:%L - %m%n</value>\n    </property>\n    \n    <property>\n      <name>prop.2</name>\n      <value>INFO, openjpa</value>\n    </property>\n    \n    <property>\n      <name>prop.1</name>\n      <value>&#39;.&#39;yyyy-MM-dd-HH</value>\n    </property>\n    \n    <property>\n      <name>prop.4</name>\n      <value>${oozie.log.dir}/oozie.log</value>\n    </property>\n    \n  </configuration>\n')

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/pom.xml b/ambari-client/groovy-client/pom.xml
index fbedbd1..b05ed24 100644
--- a/ambari-client/groovy-client/pom.xml
+++ b/ambari-client/groovy-client/pom.xml
@@ -53,10 +53,6 @@
       <artifactId>spock-core</artifactId>
       <version>0.7-groovy-2.0</version>
     </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-    </dependency>
   </dependencies>
   <build>
     <plugins>
@@ -87,6 +83,7 @@
         <artifactId>apache-rat-plugin</artifactId>
         <configuration>
           <excludes>
+            <exclude>**/*.iml</exclude>
             <exclude>src/main/resources/blueprints/**</exclude>
             <exclude>src/test/resources/**</exclude>
           </excludes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy
index 6d94c5d..85c52a4 100644
--- a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy
+++ b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/AmbariClient.groovy
@@ -23,7 +23,6 @@ import groovy.util.logging.Slf4j
 import groovyx.net.http.ContentType
 import groovyx.net.http.HttpResponseException
 import groovyx.net.http.RESTClient
-import org.apache.commons.io.IOUtils
 import org.apache.http.NoHttpResponseException
 import org.apache.http.client.ClientProtocolException
 import java.net.ConnectException
@@ -38,7 +37,6 @@ class AmbariClient {
 
   private static final int PAD = 30
   private static final int OK_RESPONSE = 200
-  private static final String SLAVE = "slave_"
   boolean debugEnabled = false;
   def RESTClient ambari
   def slurper = new JsonSlurper()
@@ -94,203 +92,6 @@ class AmbariClient {
   }
 
   /**
-   * Adds a registered host to the cluster.
-   *
-   * @param hostName new node's hostname
-   * @throws HttpResponseException if the node is not registered with ambari
-   */
-  def addHost(String hostName) throws HttpResponseException {
-    if (debugEnabled) {
-      println "[DEBUG] POST ${ambari.getUri()}clusters/${getClusterName()}/hosts/$hostName"
-    }
-    ambari.post(path: "clusters/${getClusterName()}/hosts/$hostName", { it })
-  }
-
-  /**
-   * Decommission and remove a host from the cluster.
-   * NOTE: this is a synchronous call, it wont return until all
-   * requests are finished
-   *
-   * Steps:
-   *  1, decommission services
-   *  2, stop services
-   *  3, delete host components
-   *  4, delete host
-   *  5, restart services
-   *
-   * @param hostName host to be deleted
-   */
-  def removeHost(String hostName) {
-    def components = getHostComponentsMap(hostName).keySet() as List
-
-    // decommission
-    if (components.contains("NODEMANAGER")) {
-      decommissionNodeManager(hostName)
-    }
-    if (components.contains("DATANODE")) {
-      decommissionDataNode(hostName)
-    }
-
-    // stop services
-    def requests = stopComponentsOnHost(hostName, components)
-    waitForRequestsToFinish(requests.values() as List)
-
-    // delete host components
-    deleteHostComponents(hostName, components)
-
-    // delete host
-    deleteHost(hostName)
-
-    // restart zookeper
-    def id = restartServiceComponents("ZOOKEEPER", ["ZOOKEEPER_SERVER"])
-    waitForRequestsToFinish([id])
-
-    // restart nagios
-    if (getServiceComponentsMap().containsKey("NAGIOS")) {
-      id = restartServiceComponents("NAGIOS", ["NAGIOS_SERVER"])
-      waitForRequestsToFinish([id])
-    }
-  }
-
-  /**
-   * Does not return until all the requests are finished.
-   * @param requestIds ids of the requests
-   */
-  def waitForRequestsToFinish(List<Integer> requestIds) {
-    def stopped = false
-    while (!stopped) {
-      def state = true
-      for (int id : requestIds) {
-        if (getRequestProgress(id) != 100.0) {
-          state = false;
-          break;
-        }
-      }
-      stopped = state
-      Thread.sleep(2000)
-    }
-  }
-
-  /**
-   * Decommission the data node on a given host.
-   *
-   * @return id of the request to keep track its progress
-   */
-  def int decommissionDataNode(String host) {
-    decommission(host, "DATANODE", "HDFS", "NAMENODE")
-  }
-
-  /**
-   * Decommission the node manager on a given host.
-   *
-   * @return id of the request to keep track its progress
-   */
-  def int decommissionNodeManager(String host) {
-    decommission(host, "NODEMANAGER", "YARN", "RESOURCEMANAGER")
-  }
-
-  /**
-   * Decommission a host component on a given host.
-   *
-   * @param host hostName where the component is installed to
-   * @param slaveName slave to be decommissioned
-   * @param serviceName where the slave belongs to
-   * @param componentName where the slave belongs to
-   * @return id of the request to keep track its progress
-   */
-  def int decommission(String host, String slaveName, String serviceName, String componentName) {
-    def requestInfo = [
-      command   : "DECOMMISSION",
-      context   : "Decommission $slaveName",
-      parameters: ["slave_type": slaveName, "excluded_hosts": host]
-    ]
-    def filter = [
-      ["service_name": serviceName, "component_name": componentName]
-    ]
-    Map bodyMap = [
-      "RequestInfo"              : requestInfo,
-      "Requests/resource_filters": filter
-    ]
-    ambari.post(path: "clusters/${getClusterName()}/requests", body: new JsonBuilder(bodyMap).toPrettyString(), {
-      getRequestId(it)
-    })
-  }
-
-  /**
-   * Deletes the components from the host.
-   */
-  def deleteHostComponents(String hostName, List<String> components) {
-    components.each {
-      ambari.delete(path: "clusters/${getClusterName()}/hosts/$hostName/host_components/$it")
-    }
-  }
-
-  /**
-   * Deletes the host from the cluster.
-   */
-  def deleteHost(String hostName) {
-    ambari.delete(path: "clusters/${getClusterName()}/hosts/$hostName")
-  }
-
-  /**
-   * Install all the components from a given blueprint's host group. The services must be installed
-   * in order to install its components. It is recommended to use the same blueprint's host group from which
-   * the cluster was created.
-   *
-   * @param hostName components will be installed on this host
-   * @param blueprint id of the blueprint
-   * @param hostGroup host group of the blueprint
-   * @return map of the component names and their request id since its an async call
-   */
-  def Map<String, Integer> installComponentsToHost(String hostName, String blueprint, String hostGroup) throws HttpResponseException {
-    def bpMap = getBlueprint(blueprint)
-    def components = bpMap?.host_groups?.find { it.name.equals(hostGroup) }?.components?.collect { it.name }
-    if (components) {
-      return installComponentsToHost(hostName, components)
-    } else {
-      return [:]
-    }
-  }
-
-  /**
-   * Installs the given components to the given host.
-   * Only existing service components can be installed.
-   *
-   * @param hostName host to install the component to
-   * @param components components to be installed
-   * @throws HttpResponseException in case the component's service is not installed
-   * @return map of the component names and their request id since its an async call
-   */
-  def Map<String, Integer> installComponentsToHost(String hostName, List<String> components) throws HttpResponseException {
-    def resp = [:]
-    components.each {
-      addComponentToHost(hostName, it)
-      resp << [(it): setComponentState(hostName, it, "INSTALLED")]
-    }
-    resp
-  }
-
-  /**
-   * Starts the given components on a host.
-   *
-   * @return map of the component names and their request id since its an async call
-   * @throws HttpResponseException in case the component is not found
-   */
-  def Map<String, Integer> startComponentsOnHost(String hostName, List<String> components) throws HttpResponseException {
-    setComponentsState(hostName, components, "STARTED")
-  }
-
-  /**
-   * Stops the given components on a host.
-   *
-   * @return map of the component names and their request id since its an async call
-   * @throws HttpResponseException in case the component is not found
-   */
-  def Map<String, Integer> stopComponentsOnHost(String hostName, List<String> components) throws HttpResponseException {
-    setComponentsState(hostName, components, "INSTALLED")
-  }
-
-  /**
    * Checks whether the blueprint exists or not.
    *
    * @param id id of the blueprint
@@ -377,34 +178,27 @@ class AmbariClient {
    * @param blueprint id of the blueprint
    * @return recommended assignments
    */
-  def Map<String, List<String>> recommendAssignments(String blueprint) throws InvalidHostGroupHostAssociation {
+  def Map<String, List<String>> recommendAssignments(String blueprint) {
     def result = [:]
     def hostNames = getHostNames().keySet() as List
     def groups = getBlueprint(blueprint)?.host_groups?.collect { ["name": it.name, "cardinality": it.cardinality] }
     if (hostNames && groups) {
       def groupSize = groups.size()
       def hostSize = hostNames.size()
-      if (hostSize == 1 && groupSize == 1) {
-        result = [(groups[0].name): [hostNames[0]]]
-      } else if (hostSize >= groupSize) {
-        int i = 0
-        groups.findAll { !it.name.toLowerCase().startsWith(SLAVE) }.each {
-          result << [(it.name): [hostNames[i++]]]
-        }
-        def slaves = groups.findAll { it.name.toLowerCase().startsWith(SLAVE) }
-        if (slaves) {
-          int k = 0
-          for (int j = i; j < hostSize; j++) {
-            result[slaves[k].name] = result[slaves[k].name] ?: []
-            result[slaves[k].name] << hostNames[j]
-            result << [(slaves[k].name): result[slaves[k++].name]]
-            k = k == slaves.size ? 0 : k
+      if (hostSize == groupSize) {
+        def i = 0
+        result = groups.collectEntries { [(it.name): [hostNames[i++]]] }
+      } else if (groupSize == 2 && hostSize > 2) {
+        def grouped = groups.groupBy { it.cardinality }
+        if (grouped["1"] && grouped["1"].size() == 1) {
+          groups.each {
+            if (it["cardinality"] == "1") {
+              result << [(it["name"]): [hostNames[0]]]
+            } else {
+              result << [(it["name"]): hostNames.subList(1, hostSize)]
+            }
           }
-        } else {
-          throw new InvalidHostGroupHostAssociation("At least one '$SLAVE' is required", groupSize)
         }
-      } else {
-        throw new InvalidHostGroupHostAssociation("At least $groupSize host is required", groupSize)
       }
     }
     return result
@@ -434,49 +228,11 @@ class AmbariClient {
    * Adds a blueprint to the Ambari server. Exception is thrown if fails.
    *
    * @param json blueprint as json
-   * @return blueprint json
    * @throws HttpResponseException in case of error
    */
-  def String addBlueprint(String json) throws HttpResponseException {
-    addBlueprint(json, [:])
-  }
-
-  /**
-   * Adds a blueprint with the desired configurations.
-   *
-   * @param json blueprint to be added
-   * @param configurations blueprint will be extended with these configurations
-   * @return the extended blueprint as json
-   */
-  def String addBlueprint(String json, Map<String, Map<String, String>> configurations) throws HttpResponseException {
+  def void addBlueprint(String json) throws HttpResponseException {
     if (json) {
-      def text = slurper.parseText(json)
-      def bpMap = extendBlueprintConfiguration(text, configurations)
-      def builder = new JsonBuilder(bpMap)
-      def resultJson = builder.toPrettyString()
-      postBlueprint(resultJson)
-      resultJson
-    }
-  }
-
-  /**
-   * Only validates the multinode blueprints, at least 1 slave host group must exist.
-   * Throws an exception if the blueprint is not valid.
-   *
-   * @param json blueprint json
-   * @throws InvalidBlueprintException if the blueprint is not valid
-   */
-  def void validateBlueprint(String json) throws InvalidBlueprintException {
-    if (json) {
-      def bpMap = slurper.parseText(json)
-      if (bpMap?.host_groups?.size > 1) {
-        def find = bpMap.host_groups.find { it.name.toLowerCase().startsWith(SLAVE) }
-        if (!find) {
-          throw new InvalidBlueprintException("At least one '$SLAVE' host group is required.")
-        }
-      }
-    } else {
-      throw new InvalidBlueprintException("No blueprint specified")
+      postBlueprint(json)
     }
   }
 
@@ -490,8 +246,6 @@ class AmbariClient {
     addBlueprint(getResourceContent("blueprints/single-node-hdfs-yarn"))
     addBlueprint(getResourceContent("blueprints/lambda-architecture"))
     addBlueprint(getResourceContent("blueprints/warmup"))
-    addBlueprint(getResourceContent("blueprints/hdp-singlenode-default"))
-    addBlueprint(getResourceContent("blueprints/hdp-multinode-default"))
   }
 
   /**
@@ -547,24 +301,6 @@ class AmbariClient {
   }
 
   /**
-   * Modify an existing configuration. Be ware you'll have to provide the whole configuration
-   * otherwise properties might get lost.
-   *
-   * @param type type of the configuration e.g capacity-scheduler
-   * @param properties properties to be used
-   */
-  def modifyConfiguration(String type, Map<String, String> properties) {
-    Map bodyMap = [
-      "Clusters": ["desired_config": ["type": type, "tag": "version${System.currentTimeMillis()}", "properties": properties]]
-    ]
-    def Map<String, ?> putRequestMap = [:]
-    putRequestMap.put('requestContentType', ContentType.URLENC)
-    putRequestMap.put('path', "clusters/${getClusterName()}")
-    putRequestMap.put('body', new JsonBuilder(bodyMap).toPrettyString());
-    ambari.put(putRequestMap)
-  }
-
-  /**
    * Returns a pre-formatted String of the clusters.
    *
    * @return pre-formatted cluster list
@@ -586,18 +322,18 @@ class AmbariClient {
   }
 
   /**
-   * Returns the requests progress.
+   * Returns the install progress state. If the install failed -1 returned.
    *
    * @param request request id; default is 1
    * @return progress in percentage
    */
-  def BigDecimal getRequestProgress(request = 1) {
+  def BigDecimal getInstallProgress(request = 1) {
     def response = getAllResources("requests/$request", "Requests")
-    def String status = response?.Requests?.request_status
+    def String status = response.Requests?.request_status
     if (status && status.equals("FAILED")) {
       return new BigDecimal(-1)
     }
-    return response?.Requests?.progress_percent
+    return response.Requests?.progress_percent
   }
 
   /**
@@ -622,9 +358,7 @@ class AmbariClient {
   }
 
   /**
-   * Returns the available host names and their states. It also
-   * contains hosts which are not part of the cluster, but are connected
-   * to ambari.
+   * Returns the available host names and its states.
    *
    * @return hostname state association
    */
@@ -633,15 +367,6 @@ class AmbariClient {
   }
 
   /**
-   * Returns the names of the hosts which have the given state. It also
-   * contains hosts which are not part of the cluster, but are connected
-   * to ambari.
-   */
-  def Map<String, String> getHostNamesByState(String state) {
-    getHostNames().findAll { it.value == state }
-  }
-
-  /**
    * Returns a pre-formatted list of the hosts.
    *
    * @return pre-formatted String
@@ -733,7 +458,7 @@ class AmbariClient {
    */
   def Map<String, String> getHostComponentsMap(host) {
     def result = getHostComponents(host)?.items?.collectEntries { [(it.HostRoles.component_name): it.HostRoles.state] }
-    result ?: [:]
+    result ?: new HashMap()
   }
 
   /**
@@ -747,17 +472,16 @@ class AmbariClient {
     return getRawResource(resourceRequestMap)
   }
 
-  /**
-   * Returns a map with service configurations. The keys are the service names, values are maps with <propertyName, propertyValue> entries
-   *
-   * @return a Map with entries of format <servicename, Map<property, value>>
-   */
-  def Map<String, Map<String, String>> getServiceConfigMap(String type = "") {
+/**
+ * Returns a map with service configurations. The keys are the service names, values are maps with <propertyName, propertyValue> entries
+ *
+ * @return a Map with entries of format <servicename, Map<property, value>>
+ */
+  def Map<String, Map<String, String>> getServiceConfigMap() {
     def Map<String, Integer> serviceToTags = new HashMap<>()
 
     //get services and last versions configurations
-    def path = "clusters/${getClusterName()}/configurations"
-    Map<String, ?> configsResourceRequestMap = getResourceRequestMap(path, type ? ["type": type] : [:])
+    Map<String, ?> configsResourceRequestMap = getResourceRequestMap("clusters/${getClusterName()}/configurations", [:])
     def rawConfigs = getSlurpedResource(configsResourceRequestMap)
 
     rawConfigs?.items.collect { object ->
@@ -775,44 +499,14 @@ class AmbariClient {
     return finalMap
   }
 
-  /**
-   * Starts all the services.
-   *
-   * @return id of the request since its an async call
-   */
-  def int startAllServices() {
+  def startAllServices() {
     log.debug("Starting all services ...")
-    manageService("Start All Services", "STARTED")
+    manageAllServices("Start All Services", "STARTED")
   }
 
-  /**
-   * Stops all the services.
-   *
-   * @return id of the request since its an async call
-   */
-  def int stopAllServices() {
+  def stopAllServices() {
     log.debug("Stopping all services ...")
-    manageService("Stop All Services", "INSTALLED")
-  }
-
-  /**
-   * Starts the given service.
-   *
-   * @param service name of the service
-   * @return id of the request
-   */
-  def int startService(String service) {
-    manageService("Starting $service", "STARTED", service)
-  }
-
-  /**
-   * Stops the given service.
-   *
-   * @param service name of the service
-   * @return id of the request
-   */
-  def int stopService(String service) {
-    manageService("Stopping $service", "INSTALLED", service)
+    manageAllServices("Stop All Services", "INSTALLED")
   }
 
   def boolean servicesStarted() {
@@ -823,61 +517,6 @@ class AmbariClient {
     return servicesStatus(false)
   }
 
-  /**
-   * Returns the public hostnames of the hosts which the host components are installed to.
-   */
-  def List<String> getPublicHostNames(String hostComponent) {
-    def hosts = getInternalHostNames(hostComponent)
-    if (hosts) {
-      return hosts.collect() { resolveInternalHostName(it) }
-    } else {
-      return []
-    }
-  }
-
-  /**
-   * Returns the internal hostnames of the hosts which the host components are installed to.
-   */
-  def List<String> getInternalHostNames(String hostComponent) {
-    def hosts = []
-    getClusterHosts().each {
-      if (getHostComponentsMap(it).keySet().contains(hostComponent)) {
-        hosts << it
-      }
-    }
-    hosts
-  }
-
-  /**
-   * Restarts the given components of a service.
-   */
-  def int restartServiceComponents(String service, List<String> components) {
-    def filter = components.collect {
-      ["service_name": service, "component_name": it, "hosts": getInternalHostNames(it).join(",")]
-    }
-    Map bodyMap = [
-      "RequestInfo"              : [command: "RESTART", context: "Restart $service components $components"],
-      "Requests/resource_filters": filter
-    ]
-    ambari.post(path: "clusters/${getClusterName()}/requests", body: new JsonBuilder(bodyMap).toPrettyString(), {
-      getRequestId(it)
-    })
-  }
-
-  /**
-   * Returns the names of the hosts which are in the cluster.
-   */
-  def List<String> getClusterHosts() {
-    slurp("clusters/${getClusterName()}")?.hosts?.Hosts?.host_name
-  }
-
-  /**
-   * Resolves an internal hostname to a public one.
-   */
-  def String resolveInternalHostName(String internalHostName) {
-    slurp("clusters/${getClusterName()}/hosts/$internalHostName")?.Hosts?.public_host_name
-  }
-
   def private boolean servicesStatus(boolean starting) {
     def String status = (starting) ? "STARTED" : "INSTALLED"
     Map serviceComponents = getServicesMap();
@@ -889,24 +528,19 @@ class AmbariClient {
     return allInState;
   }
 
-  def private manageService(String context, String state, String service = "") {
+  def private manageAllServices(String context, String state) {
     Map bodyMap = [
       RequestInfo: [context: context],
       ServiceInfo: [state: state]
     ]
     JsonBuilder builder = new JsonBuilder(bodyMap)
-    def path = "${ambari.getUri()}clusters/${getClusterName()}/services"
-    if (service) {
-      path += "/$service"
-    }
     def Map<String, ?> putRequestMap = [:]
     putRequestMap.put('requestContentType', ContentType.URLENC)
-    putRequestMap.put('path', path)
+    putRequestMap.put('path', "${ambari.getUri()}" + "clusters/${getClusterName()}/services")
     putRequestMap.put('query', ['params/run_smoke_test': 'false'])
     putRequestMap.put('body', builder.toPrettyString());
 
-    def reponse = ambari.put(putRequestMap)
-    slurper.parseText(reponse.getAt("responseData")?.getAt("str"))?.Requests?.id
+    ambari.put(putRequestMap)
   }
 
   private def processServiceVersions(Map<String, Integer> serviceToVersions, String service, def version) {
@@ -983,7 +617,7 @@ class AmbariClient {
    */
   private getSlurpedResource(Map resourceRequestMap) {
     def rawResource = getRawResource(resourceRequestMap)
-    def slurpedResource = (rawResource != null) ? slurper.parseText(rawResource) : rawResource
+    def slurpedResource = (rawResource) ? slurper.parseText(rawResource) : null
     return slurpedResource
   }
 
@@ -1082,38 +716,6 @@ class AmbariClient {
     getAllResources("services", "ServiceInfo")
   }
 
-  private def addComponentToHost(String hostName, String component) {
-    if (debugEnabled) {
-      println "[DEBUG] POST ${ambari.getUri()}clusters/${getClusterName()}/hosts/$hostName/host_components"
-    }
-    ambari.post(path: "clusters/${getClusterName()}/hosts/$hostName/host_components/${component.toUpperCase()}", { it })
-  }
-
-  private def Map<String, Integer> setComponentsState(String hostName, List<String> components, String state)
-    throws HttpResponseException {
-    def resp = [:]
-    components.each {
-      resp << [(it): setComponentState(hostName, it, state)]
-    }
-    return resp
-  }
-
-  private def setComponentState(String hostName, String component, String state) {
-    if (debugEnabled) {
-      println "[DEBUG] PUT ${ambari.getUri()}clusters/${getClusterName()}/hosts/$hostName/host_components/$component"
-    }
-    Map bodyMap = [
-      HostRoles  : [state: state.toUpperCase()],
-      RequestInfo: [context: "${component.toUpperCase()} ${state.toUpperCase()}"]
-    ]
-    def Map<String, ?> putRequestMap = [:]
-    putRequestMap.put('requestContentType', ContentType.URLENC)
-    putRequestMap.put('path', "clusters/${getClusterName()}/hosts/$hostName/host_components/${component.toUpperCase()}")
-    putRequestMap.put('body', new JsonBuilder(bodyMap).toPrettyString());
-    def reponse = ambari.put(putRequestMap)
-    slurper.parseText(reponse.getAt("responseData")?.getAt("str"))?.Requests?.id
-  }
-
   /**
    * Returns the properties of the host components as a Map parsed from the Ambari response json.
    *
@@ -1128,43 +730,4 @@ class AmbariClient {
     getClass().getClassLoader().getResourceAsStream(name)?.text
   }
 
-  private def extendBlueprintConfiguration(Map blueprintMap, Map newConfigs) {
-    def configurations = blueprintMap.configurations
-    if (!configurations) {
-      if (newConfigs) {
-        def conf = []
-        newConfigs.each { conf << [(it.key): it.value] }
-        blueprintMap << ["configurations": conf]
-      }
-      return blueprintMap
-    }
-    newConfigs.each {
-      def site = it.key
-      def index = indexOfConfig(configurations, site)
-      if (index == -1) {
-        configurations << ["$site": it.value]
-      } else {
-        def existingConf = configurations.get(index)
-        existingConf."$site" << it.value
-      }
-    }
-    blueprintMap
-  }
-
-  private int indexOfConfig(List<Map> configurations, String site) {
-    def index = 0
-    for (Map conf : configurations) {
-      if (conf.containsKey(site)) {
-        return index;
-      }
-      index++
-    }
-    return -1;
-  }
-
-  private def int getRequestId(def responseDecorator) {
-    def resp = IOUtils.toString(new InputStreamReader(responseDecorator.entity.content.wrappedStream))
-    slurper.parseText(resp)?.Requests?.id
-  }
-
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidBlueprintException.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidBlueprintException.groovy b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidBlueprintException.groovy
deleted file mode 100644
index 36a7e62..0000000
--- a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidBlueprintException.groovy
+++ /dev/null
@@ -1,28 +0,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.
- */
-package org.apache.ambari.groovy.client
-
-/**
- * Thrown when the blueprint validation fails.
- */
-public class InvalidBlueprintException extends Exception {
-
-  public InvalidBlueprintException(String message) {
-    super(message)
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidHostGroupHostAssociation.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidHostGroupHostAssociation.groovy b/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidHostGroupHostAssociation.groovy
deleted file mode 100644
index 1483eb9..0000000
--- a/ambari-client/groovy-client/src/main/groovy/org/apache/ambari/groovy/client/InvalidHostGroupHostAssociation.groovy
+++ /dev/null
@@ -1,39 +0,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.
- */
-package org.apache.ambari.groovy.client
-
-/**
- * Thrown when the host group and host association offends the criteria of
- * recommendation.
- */
-public class InvalidHostGroupHostAssociation extends Exception {
-
-  /**
-   * For recommendation at least host group number of host is expected.
-   */
-  private final int minRequiredHost
-
-  public InvalidHostGroupHostAssociation(String message, int minRequiredHost) {
-    super(message)
-    this.minRequiredHost = minRequiredHost
-  }
-
-  public int getMinRequiredHost() {
-    return minRequiredHost
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/hdp-multinode-default
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/hdp-multinode-default b/ambari-client/groovy-client/src/main/resources/blueprints/hdp-multinode-default
deleted file mode 100644
index 0a76808..0000000
--- a/ambari-client/groovy-client/src/main/resources/blueprints/hdp-multinode-default
+++ /dev/null
@@ -1,179 +0,0 @@
-{
-    "configurations" : [
-        {
-            "nagios-env" : {
-                "nagios_contact" : "admin@localhost"
-            }
-        }
-    ],
-    "host_groups" : [
-        {
-            "name" : "master_1",
-            "components" : [
-                {
-                    "name" : "NAMENODE"
-                },
-                {
-                    "name" : "ZOOKEEPER_SERVER"
-                },
-                {
-                    "name" : "HBASE_MASTER"
-                },
-                {
-                    "name" : "GANGLIA_SERVER"
-                },
-                {
-                    "name" : "HDFS_CLIENT"
-                },
-                {
-                    "name" : "YARN_CLIENT"
-                },
-                {
-                    "name" : "HCAT"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                }
-            ],
-            "cardinality" : "1"
-        },
-        {
-            "name" : "master_2",
-            "components" : [
-
-                {
-                    "name" : "ZOOKEEPER_CLIENT"
-                },
-                {
-                    "name" : "HISTORYSERVER"
-                },
-                {
-                    "name" : "HIVE_SERVER"
-                },
-                {
-                    "name" : "SECONDARY_NAMENODE"
-                },
-                {
-                    "name" : "HIVE_METASTORE"
-                },
-                {
-                    "name" : "HDFS_CLIENT"
-                },
-                {
-                    "name" : "HIVE_CLIENT"
-                },
-                {
-                    "name" : "YARN_CLIENT"
-                },
-                {
-                    "name" : "MYSQL_SERVER"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                },
-                {
-                    "name" : "WEBHCAT_SERVER"
-                }
-            ],
-            "cardinality" : "1"
-        },
-        {
-            "name" : "master_3",
-            "components" : [
-                {
-                    "name" : "RESOURCEMANAGER"
-                },
-                {
-                    "name" : "ZOOKEEPER_SERVER"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                }
-            ],
-            "cardinality" : "1"
-        },
-        {
-            "name" : "master_4",
-            "components" : [
-                {
-                    "name" : "OOZIE_SERVER"
-                },
-                {
-                    "name" : "ZOOKEEPER_SERVER"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                }
-            ],
-            "cardinality" : "1"
-        },
-        {
-            "name" : "slave_1",
-            "components" : [
-                {
-                    "name" : "HBASE_REGIONSERVER"
-                },
-                {
-                    "name" : "NODEMANAGER"
-                },
-                {
-                    "name" : "DATANODE"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                }
-            ],
-            "cardinality" : "${slavesCount}"
-        },
-        {
-            "name" : "gateway",
-            "components" : [
-                {
-                    "name" : "AMBARI_SERVER"
-                },
-                {
-                    "name" : "NAGIOS_SERVER"
-                },
-                {
-                    "name" : "ZOOKEEPER_CLIENT"
-                },
-                {
-                    "name" : "PIG"
-                },
-                {
-                    "name" : "OOZIE_CLIENT"
-                },
-                {
-                    "name" : "HBASE_CLIENT"
-                },
-                {
-                    "name" : "HCAT"
-                },
-                {
-                    "name" : "SQOOP"
-                },
-                {
-                    "name" : "HDFS_CLIENT"
-                },
-                {
-                    "name" : "HIVE_CLIENT"
-                },
-                {
-                    "name" : "YARN_CLIENT"
-                },
-                {
-                    "name" : "MAPREDUCE2_CLIENT"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                }
-            ],
-            "cardinality" : "1"
-        }
-    ],
-    "Blueprints" : {
-        "blueprint_name" : "hdp-multinode-default",
-        "stack_name" : "HDP",
-        "stack_version" : "2.1"
-    }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/hdp-singlenode-default
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/hdp-singlenode-default b/ambari-client/groovy-client/src/main/resources/blueprints/hdp-singlenode-default
deleted file mode 100644
index 34fa5a0..0000000
--- a/ambari-client/groovy-client/src/main/resources/blueprints/hdp-singlenode-default
+++ /dev/null
@@ -1,133 +0,0 @@
-{
-    "configurations" : [
-        {
-            "nagios-env" : {
-                "nagios_contact" : "admin@localhost"
-            }
-        }
-    ],
-    "host_groups" : [
-        {
-            "name" : "master",
-            "components" : [
-                {
-                    "name" : "STORM_REST_API"
-                },
-                {
-                    "name" : "PIG"
-                },
-                {
-                    "name" : "HISTORYSERVER"
-                },
-                {
-                    "name" : "HBASE_REGIONSERVER"
-                },
-                {
-                    "name" : "OOZIE_CLIENT"
-                },
-                {
-                    "name" : "HBASE_CLIENT"
-                },
-                {
-                    "name" : "NAMENODE"
-                },
-                {
-                    "name" : "SUPERVISOR"
-                },
-                {
-                    "name" : "FALCON_SERVER"
-                },
-                {
-                    "name" : "HCAT"
-                },
-                {
-                    "name" : "AMBARI_SERVER"
-                },
-                {
-                    "name" : "APP_TIMELINE_SERVER"
-                },
-                {
-                    "name" : "HDFS_CLIENT"
-                },
-                {
-                    "name" : "HIVE_CLIENT"
-                },
-                {
-                    "name" : "NODEMANAGER"
-                },
-                {
-                    "name" : "DATANODE"
-                },
-                {
-                    "name" : "WEBHCAT_SERVER"
-                },
-                {
-                    "name" : "RESOURCEMANAGER"
-                },
-                {
-                    "name" : "ZOOKEEPER_SERVER"
-                },
-                {
-                    "name" : "ZOOKEEPER_CLIENT"
-                },
-                {
-                    "name" : "STORM_UI_SERVER"
-                },
-                {
-                    "name" : "HBASE_MASTER"
-                },
-                {
-                    "name" : "HIVE_SERVER"
-                },
-                {
-                    "name" : "OOZIE_SERVER"
-                },
-                {
-                    "name" : "FALCON_CLIENT"
-                },
-                {
-                    "name" : "NAGIOS_SERVER"
-                },
-                {
-                    "name" : "SECONDARY_NAMENODE"
-                },
-                {
-                    "name" : "TEZ_CLIENT"
-                },
-                {
-                    "name" : "HIVE_METASTORE"
-                },
-                {
-                    "name" : "GANGLIA_SERVER"
-                },
-                {
-                    "name" : "SQOOP"
-                },
-                {
-                    "name" : "YARN_CLIENT"
-                },
-                {
-                    "name" : "MAPREDUCE2_CLIENT"
-                },
-                {
-                    "name" : "MYSQL_SERVER"
-                },
-                {
-                    "name" : "GANGLIA_MONITOR"
-                },
-                {
-                    "name" : "DRPC_SERVER"
-                },
-                {
-                    "name" : "NIMBUS"
-                }
-            ],
-            "cardinality" : "1"
-        }
-    ],
-    "Blueprints" : {
-        "blueprint_name" : "hdp-singlenode-default",
-        "stack_name" : "HDP",
-        "stack_version" : "2.1"
-    }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/lambda-architecture
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/lambda-architecture b/ambari-client/groovy-client/src/main/resources/blueprints/lambda-architecture
index 26fa576..3deec4c 100644
--- a/ambari-client/groovy-client/src/main/resources/blueprints/lambda-architecture
+++ b/ambari-client/groovy-client/src/main/resources/blueprints/lambda-architecture
@@ -1,14 +1,14 @@
 {
   "configurations": [
     {
-        "nagios-env" : {
-            "nagios_contact" : "admin@localhost"
-        }
+      "global": {
+        "nagios_contact": "me@my-awesome-domain.example"
+      }
     }
   ],
   "host_groups": [
     {
-      "name": "master_1",
+      "name": "host_group_1",
       "components": [
         {
           "name": "ZOOKEEPER_SERVER"
@@ -65,7 +65,7 @@
       "cardinality": "1"
     },
     {
-      "name": "slave_1",
+      "name": "host_group_2",
       "components": [
         {
           "name": "ZOOKEEPER_SERVER"
@@ -101,6 +101,9 @@
           "name": "YARN_CLIENT"
         },
         {
+          "name" : "APP_TIMELINE_SERVER"
+        },
+        {
           "name": "MAPREDUCE2_CLIENT"
         },
         {
@@ -119,7 +122,7 @@
       "cardinality": "1"
     },
     {
-      "name": "slave_2",
+      "name": "host_group_3",
       "components": [
         {
           "name": "ZOOKEEPER_SERVER"
@@ -155,6 +158,9 @@
           "name": "DATANODE"
         },
         {
+          "name" : "APP_TIMELINE_SERVER"
+        },
+        {
           "name": "GANGLIA_MONITOR"
         }
       ],
@@ -166,4 +172,4 @@
     "stack_name": "HDP",
     "stack_version": "2.1"
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/multi-node-hdfs-yarn
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/multi-node-hdfs-yarn b/ambari-client/groovy-client/src/main/resources/blueprints/multi-node-hdfs-yarn
index 82f3042..27a602a 100644
--- a/ambari-client/groovy-client/src/main/resources/blueprints/multi-node-hdfs-yarn
+++ b/ambari-client/groovy-client/src/main/resources/blueprints/multi-node-hdfs-yarn
@@ -1,9 +1,9 @@
 {
   "configurations": [
     {
-        "nagios-env" : {
-            "nagios_contact" : "admin@localhost"
-        }
+      "global": {
+        "nagios_contact": "me@my-awesome-domain.example"
+      }
     }
   ],
   "host_groups": [
@@ -32,7 +32,7 @@
       "cardinality": "1"
     },
     {
-      "name": "slave_1",
+      "name": "slaves",
       "components": [
         {
           "name": "DATANODE"
@@ -64,4 +64,4 @@
     "stack_name": "HDP",
     "stack_version": "2.1"
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/single-node-hdfs-yarn
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/single-node-hdfs-yarn b/ambari-client/groovy-client/src/main/resources/blueprints/single-node-hdfs-yarn
index 768741b..46ca508 100644
--- a/ambari-client/groovy-client/src/main/resources/blueprints/single-node-hdfs-yarn
+++ b/ambari-client/groovy-client/src/main/resources/blueprints/single-node-hdfs-yarn
@@ -1,14 +1,14 @@
 {
   "host_groups" : [
     {
-      "name" : "master",
+      "name" : "host_group_1",
       "components" : [
       {
         "name" : "NAMENODE"
       },
       {
         "name" : "SECONDARY_NAMENODE"
-      },
+      },       
       {
         "name" : "DATANODE"
       },

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/main/resources/blueprints/warmup
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/main/resources/blueprints/warmup b/ambari-client/groovy-client/src/main/resources/blueprints/warmup
index e6587c1..8b745d6 100644
--- a/ambari-client/groovy-client/src/main/resources/blueprints/warmup
+++ b/ambari-client/groovy-client/src/main/resources/blueprints/warmup
@@ -1,9 +1,9 @@
 {
   "configurations": [
     {
-        "nagios-env" : {
-            "nagios_contact" : "admin@localhost"
-        }
+      "global": {
+        "nagios_contact": "me@my-awesome-domain.example"
+      }
     }
   ],
   "host_groups": [
@@ -91,4 +91,4 @@
     "stack_name": "HDP",
     "stack_version": "2.1"
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariBlueprintsTest.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariBlueprintsTest.groovy b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariBlueprintsTest.groovy
index d47b1a2..b467c56 100644
--- a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariBlueprintsTest.groovy
+++ b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariBlueprintsTest.groovy
@@ -17,14 +17,11 @@
  */
 package org.apache.ambari.groovy.client
 
-import groovy.json.JsonSlurper
 import groovy.util.logging.Slf4j
 
 @Slf4j
 class AmbariBlueprintsTest extends AbstractAmbariClientTest {
 
-  def slurper = new JsonSlurper()
-
   private enum Scenario {
     CLUSTERS, NO_CLUSTERS, BLUEPRINT_EXISTS, NO_BLUEPRINT, HOSTS, NO_HOSTS
   }
@@ -141,98 +138,6 @@ class AmbariBlueprintsTest extends AbstractAmbariClientTest {
     [:] == result
   }
 
-  def "test validate blueprint"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("blueprint.json").text
-
-    when:
-    ambari.validateBlueprint(json)
-
-    then:
-    noExceptionThrown()
-  }
-
-  def "test validate blueprint no slaves_"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("hdp-multinode-default2.json").text
-
-    when:
-    ambari.validateBlueprint(json)
-
-    then:
-    thrown(InvalidBlueprintException)
-  }
-
-  def "test validate blueprint with uppercase SLAVE_"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("hdp-multinode-default.json").text
-
-    when:
-    ambari.validateBlueprint(json)
-
-    then:
-    notThrown(InvalidBlueprintException)
-  }
-
-  def "test validate blueprint for null json"() {
-    when:
-    ambari.validateBlueprint(null)
-
-    then:
-    thrown(InvalidBlueprintException)
-  }
-
-  def "test add blueprint with configuration"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("blueprint.json").text
-    ambari.metaClass.postBlueprint = { String blueprint -> return }
-
-    when:
-    def config = [
-      "yarn-site": ["property-key": "property-value", "yarn.nodemanager.local-dirs": "/mnt/fs1/,/mnt/fs2/"],
-      "hdfs-site": ["dfs.datanode.data.dir": "/mnt/fs1/,/mnt/fs2/"]
-    ]
-    def blueprint = ambari.addBlueprint(json, config)
-
-    then:
-    def expected = slurper.parseText(getClass().getClassLoader().getResourceAsStream("blueprint-config.json").text)
-    def actual = slurper.parseText(blueprint)
-    actual == expected
-  }
-
-  def "test add blueprint with existing configuration"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("multi-node-hdfs-yarn.json").text
-    ambari.metaClass.postBlueprint = { String blueprint -> return }
-
-    when:
-    def config = [
-      "yarn-site": ["property-key": "property-value", "yarn.nodemanager.local-dirs": "apple"],
-      "hdfs-site": ["dfs.datanode.data.dir": "/mnt/fs1/,/mnt/fs2/"],
-      "core-site": ["fs.defaultFS": "localhost:9000"]
-    ]
-    def blueprint = ambari.addBlueprint(json, config)
-
-    then:
-    def expected = slurper.parseText(getClass().getClassLoader().getResourceAsStream("multi-node-hdfs-yarn-config.json").text)
-    def actual = slurper.parseText(blueprint)
-    actual == expected
-  }
-
-  def "test add blueprint with empty configuration"() {
-    given:
-    def json = getClass().getClassLoader().getResourceAsStream("blueprint.json").text
-    ambari.metaClass.postBlueprint = { String blueprint -> return }
-
-    when:
-    def blueprint = ambari.addBlueprint(json, [:])
-
-    then:
-    def expected = slurper.parseText(json)
-    def actual = slurper.parseText(blueprint)
-    actual == expected
-  }
-
   def protected String selectResponseJson(Map resourceRequestMap, String scenarioStr) {
     def thePath = resourceRequestMap.get("path");
     def query = resourceRequestMap.get("query");

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariHostsTest.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariHostsTest.groovy b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariHostsTest.groovy
index 7efb95d..80d2f51 100644
--- a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariHostsTest.groovy
+++ b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariHostsTest.groovy
@@ -59,39 +59,9 @@ class AmbariHostsTest extends AbstractAmbariClientTest {
     ] == result
   }
 
-  def "install host components to a host from an existing valid blueprint"() {
-    given:
-    mockResponses(Scenario.CLUSTERS.name())
-    ambari.metaClass.addComponentToHost = { String host, String component -> return null }
-    ambari.metaClass.setComponentState = { String host, String component, String state -> return 10 }
-
-    when:
-    def result = ambari.installComponentsToHost("amb0", "hdp-multinode-default", "slave_1")
-
-    then:
-    [
-      "HBASE_REGIONSERVER": 10,
-      "NODEMANAGER"       : 10,
-      "DATANODE"          : 10,
-      "GANGLIA_MONITOR"   : 10
-    ] == result
-  }
-
-  def "install host components to a host from an existing valid blueprint but invalid group"() {
-    given:
-    mockResponses(Scenario.CLUSTERS.name())
-    ambari.metaClass.addComponentToHost = { String host, String component -> return null }
-    ambari.metaClass.setComponentState = { String host, String component, String state -> return null }
-
-    when:
-    def result = ambari.installComponentsToHost("amb0", "hdp-multinode-default", "slave_2")
-
-    then:
-    [:] == result
-  }
-
   def protected String selectResponseJson(Map resourceRequestMap, String scenarioStr) {
     def thePath = resourceRequestMap.get("path");
+    def query = resourceRequestMap.get("query");
     def Scenario scenario = Scenario.valueOf(scenarioStr)
     def json = null
     if (thePath == TestResources.CLUSTERS.uri()) {
@@ -101,8 +71,6 @@ class AmbariHostsTest extends AbstractAmbariClientTest {
       }
     } else if (thePath == TestResources.HOST_COMPONENTS.uri()) {
       json = "host-components.json"
-    } else if (thePath == TestResources.BLUEPRINT_MULTI.uri) {
-      json = "hdp-multinode-default.json"
     } else {
       log.error("Unsupported resource path: {}", thePath)
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariRecommendTest.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariRecommendTest.groovy b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariRecommendTest.groovy
deleted file mode 100644
index 9f7ff03..0000000
--- a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariRecommendTest.groovy
+++ /dev/null
@@ -1,150 +0,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.
- */
-package org.apache.ambari.groovy.client
-
-import groovy.util.logging.Slf4j
-
-@Slf4j
-class AmbariRecommendTest extends AbstractAmbariClientTest {
-
-  private enum Scenario {
-    SINGLE_NODE_BLUEPRINT, MULTI_NODE_BLUEPRINT, MULTI_NODE_BLUEPRINT2
-  }
-
-  def "test recommend for single node"() {
-    given:
-    mockResponses(Scenario.SINGLE_NODE_BLUEPRINT.name())
-    ambari.metaClass.getHostNames = { return ["amb0": "HEALTHY"] }
-
-    when:
-    def result = ambari.recommendAssignments("single-node-hdfs-yarn")
-
-    then:
-    [host_group_1: ["amb0"]] == result
-  }
-
-  def "test recommend for invalid host number"() {
-    given:
-    mockResponses(Scenario.MULTI_NODE_BLUEPRINT.name())
-    ambari.metaClass.getHostNames = { return ["amb0": "HEALTHY"] }
-
-    when:
-    def result
-    try {
-      result = ambari.recommendAssignments("hdp-multinode-default")
-    } catch (InvalidHostGroupHostAssociation e) {
-      result = e.getMinRequiredHost()
-    }
-
-    then:
-    result == 7
-  }
-
-  def "test recommend for no slave group"() {
-    given:
-    mockResponses(Scenario.MULTI_NODE_BLUEPRINT2.name())
-    ambari.metaClass.getHostNames = {
-      return [
-        "amb0": "HEALTHY",
-        "amb1": "HEALTHY",
-        "amb2": "HEALTHY",
-        "amb3": "HEALTHY",
-        "amb4": "HEALTHY",
-        "amb5": "HEALTHY",
-        "amb6": "HEALTHY",
-        "amb7": "HEALTHY",
-        "amb8": "HEALTHY",
-        "amb9": "HEALTHY",
-        "am10": "HEALTHY",
-        "am10": "HEALTHY",
-        "am20": "HEALTHY",
-        "am30": "HEALTHY",
-        "am40": "HEALTHY",
-      ]
-    }
-
-    when:
-    def result
-    def msg
-    try {
-      result = ambari.recommendAssignments("hdp-multinode-default2")
-    } catch (InvalidHostGroupHostAssociation e) {
-      msg = e.getMessage()
-      result = e.getMinRequiredHost()
-    }
-
-    then:
-    result == 5
-    msg == "At least one 'slave_' is required"
-  }
-
-  def "test recommend for multi node"() {
-    given:
-    mockResponses(Scenario.MULTI_NODE_BLUEPRINT.name())
-    ambari.metaClass.getHostNames = {
-      return [
-        "amb0": "HEALTHY",
-        "amb1": "HEALTHY",
-        "amb2": "HEALTHY",
-        "amb3": "HEALTHY",
-        "amb4": "HEALTHY",
-        "amb5": "HEALTHY",
-        "amb6": "HEALTHY",
-        "amb7": "HEALTHY",
-        "amb8": "HEALTHY",
-        "amb9": "HEALTHY",
-        "am10": "HEALTHY",
-        "am10": "HEALTHY",
-        "am20": "HEALTHY",
-        "am30": "HEALTHY",
-        "am40": "HEALTHY",
-      ]
-    }
-
-    when:
-    def result = ambari.recommendAssignments("hdp-multinode-default")
-
-    then:
-    [master_1: ["amb0"],
-     master_2: ["amb1"],
-     master_3: ["amb2"],
-     master_4: ["amb3"],
-     gateway : ["amb4"],
-     slave_1 : ["amb5", "amb7", "amb9", "am20", "am40"],
-     SLAVE_2 : ["amb6", "amb8", "am10", "am30"]
-    ] == result
-  }
-
-  def protected String selectResponseJson(Map resourceRequestMap, String scenarioStr) {
-    def thePath = resourceRequestMap.get("path");
-    def query = resourceRequestMap.get("query");
-    def Scenario scenario = Scenario.valueOf(scenarioStr)
-    def json = null
-    if (thePath == TestResources.BLUEPRINT.uri()) {
-      json = "blueprint.json"
-    } else if (thePath == TestResources.BLUEPRINT_MULTI.uri()) {
-      json = "hdp-multinode-default.json"
-    } else if (thePath == TestResources.BLUEPRINT_MULTI2.uri()) {
-      json = "hdp-multinode-default2.json"
-    } else {
-      log.error("Unsupported resource path: {}", thePath)
-    }
-    return json
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariServicesTest.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariServicesTest.groovy b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariServicesTest.groovy
index e798789..ce8060f 100644
--- a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariServicesTest.groovy
+++ b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/AmbariServicesTest.groovy
@@ -17,14 +17,11 @@
  */
 package org.apache.ambari.groovy.client
 
-import groovy.json.JsonSlurper
 import groovy.util.logging.Slf4j
 
 @Slf4j
 class AmbariServicesTest extends AbstractAmbariClientTest {
 
-  def slurper = new JsonSlurper()
-
   private enum Scenario {
     SERVICES, NO_SERVICES, NO_SERVICE_COMPONENTS
   }
@@ -117,66 +114,6 @@ class AmbariServicesTest extends AbstractAmbariClientTest {
     !result
   }
 
-  def "test stop all services"() {
-    given:
-    def context
-    ambari.metaClass.getClusterName = { return "cluster" }
-    ambari.getAmbari().metaClass.put = { Map request ->
-      context = request
-    }
-    ambari.getSlurper().metaClass.parseText { String text -> return ["Requests": ["id": 1]] }
-
-    when:
-    def id = ambari.stopAllServices()
-
-    then:
-    1 == id
-    context.path == "http://localhost:8080/api/v1/clusters/cluster/services"
-    def body = slurper.parseText(context.body)
-    body.RequestInfo.context == "Stop All Services"
-    body.ServiceInfo.state == "INSTALLED"
-  }
-
-  def "test start service ZOOKEEPER"() {
-    given:
-    def context
-    ambari.metaClass.getClusterName = { return "cluster" }
-    ambari.getAmbari().metaClass.put = { Map request ->
-      context = request
-    }
-    ambari.getSlurper().metaClass.parseText { String text -> return ["Requests": ["id": 1]] }
-
-    when:
-    def id = ambari.startService("ZOOKEEPER")
-
-    then:
-    1 == id
-    context.path == "http://localhost:8080/api/v1/clusters/cluster/services/ZOOKEEPER"
-    def body = slurper.parseText(context.body)
-    body.RequestInfo.context == "Starting ZOOKEEPER"
-    body.ServiceInfo.state == "STARTED"
-  }
-
-  def "test stop service ZOOKEEPER"() {
-    given:
-    def context
-    ambari.metaClass.getClusterName = { return "cluster" }
-    ambari.getAmbari().metaClass.put = { Map request ->
-      context = request
-    }
-    ambari.getSlurper().metaClass.parseText { String text -> return ["Requests": ["id": 1]] }
-
-    when:
-    def id = ambari.stopService("ZOOKEEPER")
-
-    then:
-    1 == id
-    context.path == "http://localhost:8080/api/v1/clusters/cluster/services/ZOOKEEPER"
-    def body = slurper.parseText(context.body)
-    body.RequestInfo.context == "Stopping ZOOKEEPER"
-    body.ServiceInfo.state == "INSTALLED"
-  }
-
   def private String selectResponseJson(Map resourceRequestMap, String scenarioStr) {
     def thePath = resourceRequestMap.get("path");
     def Scenario scenario = Scenario.valueOf(scenarioStr)

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/TestResources.groovy
----------------------------------------------------------------------
diff --git a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/TestResources.groovy b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/TestResources.groovy
index 716d700..f9ee519 100644
--- a/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/TestResources.groovy
+++ b/ambari-client/groovy-client/src/test/groovy/org/apache/ambari/groovy/client/TestResources.groovy
@@ -23,8 +23,6 @@ enum TestResources {
   CONFIGURATIONS("http://localhost:8080/api/v1/clusters/MySingleNodeCluster/configurations"),
   BLUEPRINTS("http://localhost:8080/api/v1/blueprints"),
   BLUEPRINT("http://localhost:8080/api/v1/blueprints/single-node-hdfs-yarn"),
-  BLUEPRINT_MULTI("http://localhost:8080/api/v1/blueprints/hdp-multinode-default"),
-  BLUEPRINT_MULTI2("http://localhost:8080/api/v1/blueprints/hdp-multinode-default2"),
   INEXISTENT_BLUEPRINT("http://localhost:8080/api/v1/blueprints/inexistent-blueprint"),
   HOSTS("http://localhost:8080/api/v1/hosts"),
   TASKS("http://localhost:8080/api/v1/clusters/MySingleNodeCluster/requests/1"),


Mime
View raw message