Exemplo n.º 1
0
    def validate_datasource_list(self):
        nav= NavigationTree(self.web_session)
        nav.navigate_to_middleware_datasources_view()

        haw= hawkular_api(self.web_session)
        tab = table(self.web_session)
        dataDb = db(self.web_session)

        datasource_api = self.hawkular_api.get_hawkular_datasources()
        datasource_ui = table(self.web_session).get_middleware_datasources_table()
        datasource_db = db(self.web_session).get_datasources()
        assert len(datasource_db) == len(datasource_ui) == len(datasource_api), "Datasource length match"

        for data_ui in datasource_ui:
            datasource_name = data_ui.get('Datasource Name')
            data_api = self.ui_utils.find_row_in_list(datasource_api, 'Name', datasource_name)

            assert data_api, "Datasource Name {} not found".format(datasource_name)
            assert (datasource_name == data_api.get("Name")), \
                "Datasource Name mismatch ui:{}, hawk:{}".format(datasource_name, data_api.get("Name"))
            self.web_session.logger.info(
                "UI Datasource name is: {}, and Hawkular datasource is: {} ".format(datasource_name,
                                                                                    data_api.get("Name")))

        return True
Exemplo n.º 2
0
def test_cfui_details_by_text(web_session):

    nav = NavigationTree(web_session)
    nav.jump_to_middleware_servers_view()

    pattern = "488ef4f1-9df2-4a79"
    if nav.found_by_pattern(pattern):
        sleep(5)
        t = table(web_session)
        t.pretty_print(t.page_elements())
    else:
        raise ValueError("Detail page is still unavailable")
Exemplo n.º 3
0
def test_cfui_details_by_text(web_session):

    nav = NavigationTree(web_session)
    nav.jump_to_middleware_servers_view()

    pattern = "488ef4f1-9df2-4a79"
    if nav.found_by_pattern(pattern):
        sleep(5)
        t = table(web_session)
        t.pretty_print(t.page_elements())
    else:
        raise ValueError("Detail page is still unavailable")
Exemplo n.º 4
0
    def delete_hawkular_provider(self):
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Middleware Providers", 30)
        self.web_session.logger.info("Deleting the provider- {}".format(
            self.web_session.HAWKULAR_HOSTNAME))
        self.web_driver.find_element_by_xpath(
            "//input[contains(@type,'checkbox')]").click()
        self.web_driver.find_element_by_xpath(
            "//button[@title='Configuration']").click()
        self.web_driver.find_element_by_xpath(
            "//a[@title='Remove selected Middleware Providers from the VMDB']"
        ).click()
        self.web_driver.switch_to_alert().accept()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Delete initiated", 15)

        # Verify if the provider is deleted from the provider list.

        assert ui_utils(self.web_session).waitForElementOnPage(
            By.XPATH,
            "//a[@title='{}']".format(self.web_session.HAWKULAR_PROVIDER_NAME),
            120,
            exist=False)
        if not ui_utils(self.web_session).isTextOnPage(
                self.web_session.HAWKULAR_PROVIDER_NAME):
            self.web_session.logger.info(
                "The provider - {} - is deleted successfully".format(
                    self.web_session.HAWKULAR_HOSTNAME))
Exemplo n.º 5
0
    def delete_provider(self, delete_all_providers=True):
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Middleware Providers", 30)

        # Delete the provider
        if delete_all_providers:
            self.clear_all_providers()
        else:
            self.delete_hawkular_provider()
Exemplo n.º 6
0
    def does_provider_exist(self):
        self.web_session.logger.info("Checking if provider exists")

        # navigate_to_providers

        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()

        if ui_utils(self.web_session).isElementPresent(
                By.XPATH, "//span[contains(.,'(Item 0 of 0)')]"):
            self.web_session.logger.info("Middleware Provider does not exist.")
            return False
        else:
            self.web_session.logger.info("Middleware Provider already exist.")
            return True
Exemplo n.º 7
0
    def undeploy_application_archive(self, app_to_undeploy=APPLICATION_WAR):
        NavigationTree(
            self.web_session).navigate_to_middleware_deployment_view()

        deployments_ui = table(
            self.web_session).get_middleware_deployments_table()
        self.ui_utils.click_on_row_containing_text(app_to_undeploy)

        # Undeploy
        self.undeploy_server_deployment(app_to_undeploy)

        # Validate that application is "Disabled"
        assert self.ui_utils.refresh_until_text_appears('Disabled', 300)

        return True
Exemplo n.º 8
0
    def validate_providers_list(self):

        # Test to validate provider list page in UI and validate matching providers hostname, port number

        self.web_session.logger.info("Begin providers list test.")
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()

        assert len(providers_ui) > 0, "Providers list is empty."

        for prov_ui in providers_ui:

            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                assert (prov_ui.get('Hostname') == self.web_session.
                        HAWKULAR_HOSTNAME), "Hostname mismatch"
                assert (prov_ui.get('Port') == self.web_session.HAWKULAR_PORT
                        ), "Port Number mismatch"

        return True
Exemplo n.º 9
0
    def validate_providers_details(self):

        # Test to validate hawkular provider details like name, hostname, port number
        # and to validate number of middleware servers, deployments and datasources in releationships section.

        self.web_session.logger.info("Begin providers details test.")
        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        providers_ui = table(self.web_session).get_middleware_providers_table()
        servers_hawk = self.hawkular_api.get_hawkular_servers()
        deployments_hawk = self.hawkular_api.get_hawkular_deployments()
        datasources_hawk = self.hawkular_api.get_hawkular_datasources()

        for prov_ui in providers_ui:
            if prov_ui.get('Name') == self.web_session.HAWKULAR_PROVIDER_NAME:
                ui_utils(self.web_session).click_on_row_containing_text(
                    self.web_session.HAWKULAR_PROVIDER_NAME)

        assert ui_utils(self.web_session).waitForTextOnPage("Status", 15)
        providers_details_ui = ui_utils(
            self.web_session).get_generic_table_as_dict()

        assert (providers_details_ui.get('Name') == self.web_session.
                HAWKULAR_PROVIDER_NAME), "Provider name mismatch"
        assert (providers_details_ui.get('Host Name') ==
                self.web_session.HAWKULAR_HOSTNAME), "Hostname mismatch"
        assert (providers_details_ui.get('Port') ==
                self.web_session.HAWKULAR_PORT), "Port Number mismatch"

        assert providers_details_ui.get('Middleware Servers') == str(
            len(servers_hawk)), "Number of servers mismatch"

        self.web_session.logger.debug("UI Deploys: {}  HW Deploys: {}".format(
            providers_details_ui.get('Middleware Deployments'),
            str(len(deployments_hawk))))
        # assert providers_details_ui.get('Middleware Deployments') == str(len(deployments_hawk)), "Number of Deployments mismatch"
        assert providers_details_ui.get('Middleware Datasources') == str(
            len(datasources_hawk)), "Number of Datasources mismatch"

        return True
Exemplo n.º 10
0
    def deploy_application_archive(self, app_to_deploy=APPLICATION_WAR):

        NavigationTree(self.web_session).navigate_to_middleware_servers_view()

        # Find EAP on which to deploy
        eap = self.find_non_container_eap_in_state("running")
        assert eap, "No EAP found in desired state."

        self.ui_utils.click_on_row_containing_text(eap.get('Feed'))
        self.ui_utils.waitForTextOnPage('Version', 15)

        self.add_server_deployment(self.APPLICATION_WAR)

        # Validate UI
        self.web_session.web_driver.get(
            "{}/middleware_deployment/show_list".format(
                self.web_session.MIQ_URL))
        # deployments_ui = table(self.web_session).get_middleware_deployments_table()
        #assert self.ui_utils.find_row_in_list(deployments_ui, "Deployment Name", self.APPLICATION_WAR), "Deployment {} not found on UI.".format(app_to_deploy)
        self.ui_utils.refresh_until_text_appears(self.APPLICATION_WAR, 300)
        self.ui_utils.click_on_row_containing_text(app_to_deploy)
        assert self.ui_utils.refresh_until_text_appears('Enabled', 300)

        # Validate DB
        deployments_db = self.db.get_deployments()
        assert self.ui_utils.find_row_in_list(
            deployments_db, "name",
            self.APPLICATION_WAR), "Deployment {} not found in DB.".format(
                app_to_deploy)

        # Validate HS API
        deployments_hawk = hawkular_api(
            self.web_session).get_hawkular_deployments()
        assert self.ui_utils.find_row_in_list(
            deployments_hawk, "Name", self.APPLICATION_WAR
        ), "Deployment {} not found in Hawkular.".format(app_to_deploy)

        return True
Exemplo n.º 11
0
    def eap_power_action(self, power, eap_hawk):

        self.web_session.logger.info(
            "About to {} EAP server {} Feed {}".format(power.get('action'),
                                                       eap_hawk.get('Product'),
                                                       eap_hawk.get('Feed')))

        feed = eap_hawk.get('Feed')  # Unique server id

        NavigationTree(self.web_session).navigate_to_middleware_servers_view()

        self.ui_utils.click_on_row_containing_text(eap_hawk.get('Feed'))
        self.ui_utils.waitForTextOnPage("Properties", 15)

        self.web_driver.find_element_by_xpath(
            "//button[@title='Power']").click()
        self.web_driver.find_element_by_xpath("//a[contains(.,'{}')]".format(
            power.get('action'))).click()
        self.web_driver.switch_to_alert().accept()
        assert self.ui_utils.waitForTextOnPage(power.get('wait_for'), 15)

        # Validate backend - Hawkular
        if power.get('end_state'):
            assert self.wait_for_eap_state(feed, power.get('end_state'), 15)
Exemplo n.º 12
0
    def update_provider(self, add_provider=True):
        self.web_session.logger.info(
            "Checking if provider exist and add if it does not.")
        if add_provider:
            self.add_provider(delete_if_provider_present=False)

        NavigationTree(
            self.web_session).navigate_to_middleware_providers_view()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Middleware Providers", 30)
        self.web_driver.find_element_by_xpath(
            "//input[contains(@type,'checkbox')]").click()
        self.web_driver.find_element_by_xpath(
            "//button[@title='Configuration']").click()
        elem_editprovider_link = self.web_driver.find_element_by_xpath(
            "//a[contains(.,'Edit Selected Middleware Provider')]")
        elem_editprovider_link.click()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Confirm Password", 30)

        self.web_driver.find_element_by_xpath("//input[@id='name']").clear()
        self.web_driver.find_element_by_xpath("//input[@id='name']").send_keys(
            self.web_session.PROVIDER)

        self.web_driver.find_element_by_xpath(
            "//input[@id='hostname']").clear()
        self.web_driver.find_element_by_xpath(
            "//input[@id='hostname']").send_keys("Demo.hawkular.org")

        self.web_driver.find_element_by_xpath("//input[@id='port']").clear()
        self.web_driver.find_element_by_xpath("//input[@id='port']").send_keys(
            8080)

        # Wait till Save button is enabled before click

        WebDriverWait(self.web_driver, 30).until(
            EC.element_to_be_clickable(
                (By.XPATH, "//button[contains(.,'Save')]")))
        self.web_driver.find_element_by_xpath(
            "//button[contains(.,'Save')]").click()

        assert ui_utils(self.web_session).waitForTextOnPage(
            'Middleware Provider "{}" was saved'.format(
                self.web_session.PROVIDER), 15)

        # Verify if the provider name, hostname and port number is successfully updated and shown in UI

        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH,
            "//td[contains(.,'{}')]".format(self.web_session.PROVIDER))
        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH, "//td[contains(text(),'Demo')]")
        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH, "//td[contains(.,'8080')]")
        self.web_session.logger.info(
            "The middleware provider is edited successfully.")

        # Edit and save the name, port and number to default value.( This will additionally check edit from the provider details page)

        self.web_driver.find_element_by_xpath(
            "//button[@title='Configuration']").click()
        self.web_driver.find_element_by_xpath(
            "//a[@title='Edit this Middleware Provider']").click()
        assert ui_utils(self.web_session).waitForTextOnPage(
            "Basic Information", 30)

        self.web_driver.find_element_by_xpath("//input[@id='name']").clear()
        self.web_driver.find_element_by_xpath("//input[@id='name']").send_keys(
            self.web_session.HAWKULAR_PROVIDER_NAME)

        self.web_driver.find_element_by_xpath(
            "//input[@id='hostname']").clear()
        self.web_driver.find_element_by_xpath(
            "//input[@id='hostname']").send_keys(
                self.web_session.HAWKULAR_HOSTNAME)

        self.web_driver.find_element_by_xpath("//input[@id='port']").clear()
        self.web_driver.find_element_by_xpath("//input[@id='port']").send_keys(
            self.web_session.HAWKULAR_PORT)

        # Wait till Save button is enabled before click

        WebDriverWait(self.web_driver, 30).until(
            EC.element_to_be_clickable(
                (By.XPATH, "//button[contains(.,'Save')]")))
        self.web_driver.find_element_by_xpath(
            "//button[contains(.,'Save')]").click()
        assert ui_utils(self.web_session).waitForTextOnPage(
            'Middleware Provider "{}" was saved'.format(
                self.web_session.HAWKULAR_PROVIDER_NAME), 15)

        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH, "//td[contains(.,'{}')]".format(
                self.web_session.HAWKULAR_PROVIDER_NAME))
        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH, "//td[contains(.,'{}')]".format(
                self.web_session.HAWKULAR_HOSTNAME))
        assert ui_utils(self.web_session).isElementPresent(
            By.XPATH,
            "//td[contains(.,'{}')]".format(self.web_session.HAWKULAR_PORT))
        self.web_session.logger.info(
            "The middleware provider is edited to the original values successfully."
        )
Exemplo n.º 13
0
def _test_cfui_single_detail_page(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_providers_view()
    nav.to_first_details()
    t = table(web_session)
    t.pretty_print(t.page_elements())
Exemplo n.º 14
0
def _test_cfui_single_detail_page(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_providers_view()
    nav.to_first_details()
    t = table(web_session)
    t.pretty_print(t.page_elements())
Exemplo n.º 15
0
def test_cfui_datasource_details(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_datasources_view()
    nav.to_first_details()
    pass
Exemplo n.º 16
0
def test_cfui_server_details(web_session):
    nav = NavigationTree(web_session)
    nav.jump_to_middleware_servers_view()
    nav.to_first_details()
    pass