コード例 #1
0
 def delete_directory (self, name=EMPTY):
     """
     delete a directory
     :param name: directory name
     :return:
     """
     if name != EMPTY: self.tenant=name
     resp = http_utils.request(http_utils.DELETE, url=self.__create_url(DELETE_DIR), headers=self.__create_headers())
     http_utils.assert_status_code(http_utils.status_codes[http_utils.OK], resp, "ERROR- deleting directory %s ..." % (name))
     return resp
コード例 #2
0
 def open_file (self, directory, file_name):
     """
     open file in hadoop
     :param  directory: /tenant/service_path/resource/
     :param file:  resource.txt
     :return:
     """
     self.file_name = file_name
     self.directory= directory
     resp = http_utils.request(http_utils.GET, url=self.__create_url(OPEN_FILE), headers=self.__create_headers())
     return resp
コード例 #3
0
 def open_file(self, directory, file_name):
     """
     open file in hadoop
     :param  directory: /tenant/service_path/resource/
     :param file:  resource.txt
     :return:
     """
     self.file_name = file_name
     self.directory = directory
     resp = http_utils.request(http_utils.GET,
                               url=self.__create_url(OPEN_FILE),
                               headers=self.__create_headers())
     return resp
コード例 #4
0
 def delete_directory(self, name=EMPTY):
     """
     delete a directory
     :param name: directory name
     :return:
     """
     if name != EMPTY: self.tenant = name
     resp = http_utils.request(http_utils.DELETE,
                               url=self.__create_url(DELETE_DIR),
                               headers=self.__create_headers())
     http_utils.assert_status_code(
         http_utils.status_codes[http_utils.OK], resp,
         "ERROR- deleting directory %s ..." % (name))
     return resp
コード例 #5
0
    def manager_version(self):
        """
        Verify if hadoop is installed and that version is the expected
        """
        if str(self.verify_version).lower().find("true") >= 0:
            resp = http_utils.request(http_utils.GET, url=self.__create_url(VERSION), headers=self.__create_headers())
            http_utils.assert_status_code(http_utils.status_codes[http_utils.OK], resp, "ERROR - in version request... ")
            bodyDict = general_utils.convert_to_str_to_dict(resp.text, general_utils.JSON)

            assert  STARTED == str (bodyDict[CLUSTER_INFO][HADOOP_STATE]), \
            "hadoop is not started...\nverified: %s. Expected: %s. \n\nBody content: %s" \
            % (str (bodyDict[CLUSTER_INFO][HADOOP_STATE]), STARTED, str(resp.text))

            assert  str(self.version) == str (bodyDict[CLUSTER_INFO][HADOOP_VERSION]), \
            "Wrong hadoop version \nverified: %s. Expected: %s. \n\nBody content: %s" \
            % (str (bodyDict[CLUSTER_INFO][HADOOP_VERSION]), str(self.version), str(resp.text))
コード例 #6
0
    def manager_version(self):
        """
        Verify if hadoop is installed and that version is the expected
        """
        if str(self.verify_version).lower().find("true") >= 0:
            resp = http_utils.request(http_utils.GET,
                                      url=self.__create_url(VERSION),
                                      headers=self.__create_headers())
            http_utils.assert_status_code(
                http_utils.status_codes[http_utils.OK], resp,
                "ERROR - in version request... ")
            bodyDict = general_utils.convert_to_str_to_dict(
                resp.text, general_utils.JSON)

            assert  STARTED == str (bodyDict[CLUSTER_INFO][HADOOP_STATE]), \
            "hadoop is not started...\nverified: %s. Expected: %s. \n\nBody content: %s" \
            % (str (bodyDict[CLUSTER_INFO][HADOOP_STATE]), STARTED, str(resp.text))

            assert  str(self.version) == str (bodyDict[CLUSTER_INFO][HADOOP_VERSION]), \
            "Wrong hadoop version \nverified: %s. Expected: %s. \n\nBody content: %s" \
            % (str (bodyDict[CLUSTER_INFO][HADOOP_VERSION]), str(self.version), str(resp.text))