def test_create_datasource_select_driver(provider, datasource): """Tests datasource creation and deletion on EAP server Method is executed for all database types Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add JDBC Driver' toolbar operation * Fills all necessary fields and saves * Invokes 'Add Datasource' toolbar operation * Selects Datasource type. * Click Next. * Input Datasource Name. * Input Datasource JNDI Name. * Click Next. * Choose the tab "Existing Driver". * Select just created driver * Click Next. * Input Database Connection URL. * Input Database username. * Input Database password. * Submits the form. * Checks if newly created datasource is listed. """ server = get_eap_server(provider) file_path = download_jdbc_driver(datasource.driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=datasource.driver.driver_name, module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, xa_class=datasource.driver.xa_class, major_version=datasource.driver.major_version, minor_version=datasource.driver.minor_version) verify_server_running(provider, server) verify_driver_listed(provider, datasource, server)
def test_deploy_driver(provider, driver): """Tests Deployment of provided JDBC Driver into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add JDBC Driver' toolbar operation * Selects JDBC driver file to upload. * Input Driver Name. * Input Module Name. * Input Driver Name. * Input Driver Class. * Input Major Version. * Input Minor Version. * Submits the form. * Checks that notification message is shown. """ server = get_eap_server(provider) file_path = download_jdbc_driver(driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=driver.driver_name, module_name=driver.module_name, driver_class=driver.driver_class, xa_class=driver.xa_class, major_version=driver.major_version, minor_version=driver.minor_version)
def test_disable_upgrade_enable(provider): """Tests upgrading disabled archive into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Disable that archive. * Verified the recently disabled archive's status is Disabled. * Deploys newer version of the same deployment archive into server as Disabled. * Enables that archive. * Verified the recently enabled archive's status is Enabled. * Verify the content of new archive, """ server = get_eap_server(provider) runtime_name = deploy(provider, server, RESOURCE_WAR_NAME) check_deployment_enabled(provider, server, runtime_name) check_deployment_content(provider, server, runtime_name.replace(WAR_EXT, ''), RESOURCE_WAR_CONTENT) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.disable() check_deployment_disabled(provider, server, runtime_name) deploy(provider, server, RESOURCE_WAR_NAME_NEW, runtime_name=runtime_name, enabled=False, overwrite=True) check_deployment_disabled(provider, server, runtime_name) check_no_deployment_content(provider, server, runtime_name.replace(WAR_EXT, '')) deployment.enable() check_deployment_enabled(provider, server, runtime_name) check_deployment_content(provider, server, runtime_name.replace(WAR_EXT, ''), RESOURCE_WAR_CONTENT_NEW)
def test_create_delete_datasource(provider, datasource_params): """Tests datasource creation and deletion on EAP server Method is executed for all database types Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add Datasource' toolbar operation * Selects Datasource type. * Click Next. * Input Datasource Name. * Input Datasource JNDI Name. * Click Next. * Input Driver Name. * Input Module Name. * Input Driver Name. * Input Driver Class. * Click Next. * Input Database Connection URL. * Input Database username. * Input Database password. * Submits the form. * Checks if newly created datasource is listed. Selects it. * Deletes that Datasource via UI operation. * Checks whether resource is deleted. """ server = get_eap_server(provider) server.add_datasource(datasource_params[0], datasource_params[1], datasource_params[2], datasource_params[3], datasource_params[4], datasource_params[5], datasource_params[6].replace("\\", ""), datasource_params[7], datasource_params[8])
def test_disable_enable(provider, archive_name): """Tests Starting of stopped archive into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Select that deployment from deployments list. * Performs "Disable" toolbar operation on it. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently disabled archive's status is Disabled. * Selects that archive from the list to load details. * Verifies that properties of deplyment's summary page and the status is Disabled. * Performs "Enable" toolbar operation on it. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently enabled archive's status is Enabled. * Selects that archive from the list to load details. * Verifies that properties of deplyment's summary page and the status is Enabled. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, archive_name) check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.disable() check_deployment_disabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.validate_properties() deployment.enable() check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.validate_properties()
def gen_undeploy_events(provider): server = get_eap_server(provider) runtime_name = gen_deploy_events(provider) check_deployment_appears(provider, server, runtime_name) undeploy(provider, server, runtime_name) check_deployment_not_listed(provider, server, runtime_name) return runtime_name
def test_container_server_immutability(provider): """Tests container based EAP server immutability on UI Steps: * Select container based EAP server details in UI * Compare selected server UI details with CFME database and MGMT system * Verify that all menu items are disabled and server is immutable """ if 'eap7_template' not in conf.cfme_data.get('management_systems', {})[provider.key]: pytest.skip("Skipping test, environment is not in OSCP") server = get_eap_server(provider) srv_ui = server.server(method='ui') srv_db = server.server(method='db') srv_mgmt = srv_ui.server(method='mgmt') assert srv_ui, "Server was not found in UI" assert srv_db, "Server was not found in DB" assert srv_mgmt, "Server was not found in MGMT system" assert srv_ui.name == srv_db.name == srv_mgmt.name, \ ("server name does not match between UI:{}, DB:{}, MGMT:{}" .format(srv_ui.name, srv_db.name, srv_mgmt.name)) srv_db.validate_properties() srv_mgmt.validate_properties() assert conf.cfme_data.get( 'management_systems', {})[provider.key]['eap7_template'] in srv_ui.hostname assert srv_ui.is_immutable()
def test_redeploy_disable_enabled(provider): """Tests force Redeployment and disabling of already deployed and enabled archive into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server as Enabled. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently deployed archive's status is Enabled. * Deploys newer version of the same deployment archive into server as Disabled, check to overwrite existing deployment. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently deployed archive's status is Disabled. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, RESOURCE_WAR_NAME, enabled=True) check_deployment_enabled(provider, server, runtime_name) deploy(provider, server, RESOURCE_WAR_NAME_NEW, runtime_name=runtime_name, enabled=False, overwrite=True) check_deployment_disabled(provider, server, runtime_name)
def gen_deploy_fail_events(provider): server = get_eap_server(provider) file_path = get_resource_path(RESOURCE_EAR_NAME) runtime_name = generate_runtime_name(file_path) deploy_archive(provider, server, file_path, runtime_name) runtime_name2 = generate_runtime_name(file_path) deploy_archive(provider, server, file_path, runtime_name2, overwrite=True) return runtime_name
def gen_ds_creation_events(provider, datasource_params): server = get_eap_server(provider) ds_name = generate_ds_name(datasource_params[1]) jndi_name = generate_ds_name(datasource_params[2]) server.add_datasource(datasource_params[0], ds_name, jndi_name, datasource_params[3], datasource_params[4], datasource_params[5], datasource_params[6], datasource_params[7], datasource_params[8]) return ds_name
def gen_deploy_fail_events(provider): server = get_eap_server(provider) file_path = get_resource_path(RESOURCE_WAR_NAME) runtime_name = generate_runtime_name(file_path) deploy_archive(provider, server, file_path, runtime_name) check_deployment_appears(provider, server, runtime_name) with error.expected('Deployment "{}" already exists on this server.' .format(runtime_name)): deploy_archive(provider, server, file_path, runtime_name) check_deployment_appears(provider, server, runtime_name) return runtime_name
def gen_deploy_fail_events(provider): server = get_eap_server(provider) file_path = get_resource_path(RESOURCE_WAR_NAME) runtime_name = generate_runtime_name(file_path) deploy_archive(provider, server, file_path, runtime_name) check_deployment_appears(provider, server, runtime_name) with error.expected( 'Deployment "{}" already exists on this server.'.format( runtime_name)): deploy_archive(provider, server, file_path, runtime_name) check_deployment_appears(provider, server, runtime_name) return runtime_name
def test_create_delete_xa_datasource(provider, datasource): """Tests XA datasource creation and deletion on EAP server Method is executed for all database types Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add JDBC Driver' toolbar operation * Fills all necessary fields and saves * Invokes 'Add Datasource' toolbar operation * Selects Datasource type. * Selects XA Datasource type. * Click Next. * Input Datasource Name. * Input Datasource JNDI Name. * Click Next. * Input Driver Name. * Input Module Name. * Input Driver Name. * Input Driver Class. * Click Next. * Input Database Connection URL. * Input Database username. * Input Database password. * Submits the form. * Checks if newly created datasource is listed. Selects it. * Deletes that Datasource via UI operation. * Checks whether resource is deleted. """ server = get_eap_server(provider) file_path = download_jdbc_driver(datasource.driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=datasource.driver.driver_name, module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, major_version=datasource.driver.major_version, minor_version=datasource.driver.minor_version) server.add_datasource(ds_type='{} XA'.format(datasource.database_type), ds_name='{}XA'.format(datasource.datasource_name), jndi_name='{}XA'.format(datasource.jndi_name), xa_ds=True, driver_name=datasource.driver.driver_name, driver_module_name=datasource.driver.module_name, driver_class=datasource.driver.xa_class, ds_url=datasource.connection_url.replace("\\", ""), username=datasource.username, password=datasource.password) datasource_name = "XA Datasource [{}XA]".format(datasource.datasource_name) verify_datasource_listed(provider, datasource_name, server) delete_datasource(provider, server, datasource_name) verify_datasource_not_listed(provider, datasource_name)
def test_create_delete_datasource(provider): """Tests datasource creation and deletion on EAP server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add JDBC Driver' toolbar operation * Fills all necessary fields and saves * Invokes 'Add Datasource' toolbar operation * Selects Datasource type. * Click Next. * Input Datasource Name. * Input Datasource JNDI Name. * Click Next. * Input Driver Name. * Input Module Name. * Input Driver Name. * Input Driver Class. * Click Next. * Input Database Connection URL. * Input Database username. * Input Database password. * Submits the form. * Checks if newly created datasource is listed. Selects it. * Deletes that Datasource via UI operation. * Checks whether resource is deleted. """ server = get_eap_server(provider) datasource = ORACLE_12C_DS file_path = download_jdbc_driver(datasource.driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=datasource.driver.driver_name, module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, xa_class=datasource.driver.xa_class, major_version=datasource.driver.major_version, minor_version=datasource.driver.minor_version) server.add_datasource(ds_type=datasource.database_type, ds_name=datasource.datasource_name, jndi_name=datasource.jndi_name, driver_name=datasource.driver.driver_name, driver_module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, ds_url=datasource.connection_url.replace("\\", ""), username=datasource.username, password=datasource.password) datasource_name = "Datasource [{}]".format(datasource.datasource_name) verify_datasource_listed(provider, datasource_name, server) """ @TODO enable when BZ#1460296 is fixed
def test_server_jdr(provider): """Tests EAP7 Standalone server's Generate JDR button. Steps: * Chooses EAP7 Standalone server. * Clicks on Generate JDR button. * Verifies that JDR report is queued. * Waits until JDR Report is generated. """ server = get_eap_server(provider) verify_server_running(provider, server) before_test_date = datetime.utcnow() server.generate_jdr() jdr_rc = JDRReportCollection(parent=server) verify_report_ready(jdr_rc, date_after=before_test_date)
def test_create_xa_datasource(provider, datasource): """Tests XA datasource creation and deletion on EAP server Method is executed for all database types Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add JDBC Driver' toolbar operation * Fills all necessary fields and saves * Invokes 'Add Datasource' toolbar operation * Selects Datasource type. * Selects XA Datasource type. * Click Next. * Input Datasource Name. * Input Datasource JNDI Name. * Click Next. * Input Driver Name. * Input Module Name. * Input Driver Name. * Input Driver Class. * Click Next. * Input Database Connection URL. * Input Database username. * Input Database password. * Submits the form. * Checks if newly created datasource is listed. """ server = get_eap_server(provider) file_path = download_jdbc_driver(datasource.driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=datasource.driver.driver_name, module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, xa_class=datasource.driver.xa_class, major_version=datasource.driver.major_version, minor_version=datasource.driver.minor_version) server.add_datasource(ds_type='{} XA'.format(datasource.database_type), ds_name='{}XA'.format(datasource.datasource_name), jndi_name='{}XA'.format(datasource.jndi_name), xa_ds=True, driver_name=datasource.driver.driver_name, driver_module_name=datasource.driver.module_name, driver_class=datasource.driver.xa_class, ds_url=datasource.connection_url.replace("\\", ""), username=datasource.username, password=datasource.password) datasource_name = "XA Datasource [{}XA]".format(datasource.datasource_name) verify_datasource_listed(provider, datasource_name, server)
def test_redeploy_fail(provider): """Tests Redeployment of already deployed archive into EAP7 server @TODO enable when "alert-warning" notifications are handled. Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently deployed archive's status is Enabled. * Deploys newer version of the same deployment archive into server. * Verify that exception is shown that archive already exists. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, RESOURCE_WAR_NAME) check_deployment_enabled(provider, server, runtime_name) with error.expected('Deployment "{}" already exists on this server.'.format(runtime_name)): deploy(provider, server, RESOURCE_WAR_NAME_NEW, runtime_name=runtime_name)
def test_redeploy_fail(provider): """Tests Redeployment of already deployed archive into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently deployed archive's status is Enabled. * Deploys newer version of the same deployment archive into server. * Verify that exception is shown that archive already exists. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, RESOURCE_WAR_NAME) check_deployment_enabled(provider, server, runtime_name) with error.expected('Deployment "{}" already exists on this server.'.format(runtime_name)): deploy(provider, server, RESOURCE_WAR_NAME_NEW, runtime_name=runtime_name)
def test_undeploy(provider, archive_name): """Tests Undeployment of archive from EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Select that deployment from deployments list. * Performs "Undeploy" toolbar operation on it. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently undeployed archive is not listed anymore. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, archive_name) check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.undeploy() check_deployment_not_listed(provider, server, runtime_name)
def test_deploy(provider, archive_name): """Tests Deployment of provided archive into EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Invokes 'Add Deployment' toolbar operation * Selects "war" file to upload. * Chose random Runtime Name. * Checks that notification message is shown. * Refreshes the provider. * Verifies that deployment is shown in list and is Enabled. * Selects deployment to show the details. * Verified details properties. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, archive_name) check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.validate_properties()
def test_restart(provider, archive_name): """Tests Restart of archive from EAP7 server Steps: * Get servers list from UI * Chooses JBoss EAP server from list * Deploys some deployment archive into server. * Select that deployment from deployments list. * Performs "Restart" toolbar operation on it. * Refreshes the provider. * Lists all deployments on EAP server. * Verified the recently restarted archive is listed and is Enabled. """ server = get_eap_server(provider) runtime_name = deploy(provider, server, archive_name) check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.restart() check_deployment_enabled(provider, server, runtime_name) deployment = get_deployment_from_list(provider, server, runtime_name) deployment.validate_properties()
def gen_ds_creation_events(provider, datasource): server = get_eap_server(provider) ds_name = generate_ds_name(datasource.datasource_name) jndi_name = generate_ds_name(datasource.jndi_name) file_path = download_jdbc_driver(datasource.driver.database_name) deploy_jdbc_driver(provider, server, file_path, driver_name=datasource.driver.driver_name, module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, major_version=datasource.driver.major_version, minor_version=datasource.driver.minor_version) server.add_datasource(ds_type=datasource.database_type, ds_name=ds_name, jndi_name=jndi_name, driver_name=datasource.driver.driver_name, driver_module_name=datasource.driver.module_name, driver_class=datasource.driver.driver_class, ds_url=datasource.connection_url.replace("\\", ""), username=datasource.username, password=datasource.password) ds_name = "Datasource [{}]".format(ds_name) return ds_name
def server(provider): server = get_eap_server(provider) yield server
def server(provider): server = get_eap_server(provider) yield server server.restart_server()