def test_listServices(self): res = listServices( DomainName=self.domain.name, ServiceType=servicetype_namedtuple.Model_Repository_Service) rootLogger.info(res) self.assertEqual(res.retcode, 0, res.stderr) res = listServices(DomainName=self.domain.name) rootLogger.info(res) return res.stdout
def test_backupContents(self): servicesResult = listServices(ServiceType=servicetype_namedtuple.Model_Repository_Service) self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) services = servicesResult.stdout for service in services: outputfilename = datetime.now().strftime("%Y-%m-%d-%H-%M-%S-%s") res = backupContents(ServiceName=service, OutputFileName=outputfilename) rootLogger.info(res)
def test_ping(self): services = listServices( DomainName=self.domain.name, ServiceType=servicetype_namedtuple.Data_Integration_Service) self.assertEqual(services.retcode, 0, services.stderr) if services.retcode == 0: stdout = services.stdout for s in stdout: res = ping(ServiceName=s, DomainName=self.domain.name) rootLogger.info(res) self.assertEqual(res.retcode, 0, res.stderr)
def test_enableService(self): servicesResult = listServices( ServiceType=servicetype_namedtuple.PowerCenter_Integration_Service) self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) for service in servicesResult.stdout: # type: str statusResult = getServiceStatus(ServiceName=service) rootLogger.info(statusResult) self.assertEqual(statusResult.retcode, 0, statusResult.stderr) if not statusResult.stdout: res = enableService(ServiceName=service) else: res = disableService(ServiceName=service) rootLogger.info(res) self.assertEqual(res.retcode, 0, res.stderr)
def test_4_stopBlazeService(self): servicesResult = listServices( ServiceType=servicetype_namedtuple.Data_Integration_Service) self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) connectionsResult = listConnections( ConnectionType=connectiontype_namedtupe.HADOOP) self.assertEqual(connectionsResult.retcode, 0, connectionsResult.stderr) services = servicesResult.stdout connections = connectionsResult.stdout.get( connectiontype_namedtupe.HADOOP) rootLogger.info("########## {0}".format(connections)) for service in services: for connDict in connections: # type: dict k, v = connDict.popitem() res = stopBlazeService(ServiceName=service, HadoopConnection=v) rootLogger.info(res) self.assertEqual(res.retcode, 0, res.stderr)
def test_listUserPrivileges(self): servicesResult = listServices( ServiceType=servicetype_namedtuple.PowerCenter_Repository_Service) usersResult = listAllUsers() self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) self.assertEqual(usersResult.retcode, 0, usersResult.stderr) servicesList = servicesResult.stdout usersList = usersResult.stdout # type: dict for service in servicesList: serviceStatus = getServiceStatus(ServiceName=service) self.assertEqual(serviceStatus.retcode, 0, serviceStatus.stderr) if serviceStatus.stdout: for user in usersList: res = listUserPrivileges( ServiceName=service, ExistingUserName=user.get("userName"), ExistingUserSecurityDomain=user.get("securityDomain")) rootLogger.info(res) self.assertEqual(res.retcode, 0, res.stderr) print() pprint(res.stdout)
def test_50_listWorkflowParams(self): servicesResult = listServices( ServiceType=servicetype_namedtuple.Data_Integration_Service) self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) services = servicesResult.stdout for service in services: applicationsResult = listApplications(servicename=service) self.assertEqual(applicationsResult.retcode, 0, applicationsResult.stderr) applications = applicationsResult.stdout for application in applications: wkfResults = listWorkflows(DomainName=self.domain.name, ServiceName=service, Application=application) self.assertEqual(wkfResults.retcode, 0, wkfResults.stderr) wkfs = wkfResults.stdout for wkf in wkfs: res = listWorkflowParams(ServiceName=service, Application=application, Workflow=wkf) self.assertEqual(res.retcode, 0, res.stderr) rootLogger.info(res) print() pprint(res.stdout)
def setUp(self): domain_inst = Domain() self.domain = domain_inst.get_domain() node_inst = Node() self.node = node_inst.get_current_node() infa_env_inst = INFA_ENV() self.envs = infa_env_inst.get_envs(self.node.id) os.environ.update(self.envs) servicesResult = listServices( self.domain.name, ServiceType=servicetype_namedtuple.Data_Integration_Service) self.assertEqual(servicesResult.retcode, 0, servicesResult.stderr) if len(servicesResult.stdout) > 0: self.DIS_SERVICE = servicesResult.stdout[0] else: self.fail("There's no DIS services in the Domain {0}".format( self.domain.name)) appResults = listApplications(servicename=self.DIS_SERVICE) self.assertEqual(appResults.retcode, 0, appResults.stderr) if len(appResults.stdout) > 0: self.APPLICATION = appResults.stdout[0] else: self.fail("There's no Applications under the services {0}".format( self.DIS_SERVICE)) wkfResult = listWorkflows(DomainName=self.domain.name, ServiceName=self.DIS_SERVICE, Application=self.APPLICATION) self.assertEqual(wkfResult.retcode, 0, wkfResult.stderr) if len(wkfResult.stdout) > 0: self.WKF = wkfResult.stdout[0] else: self.fail("There's no workflow under the application {0}".format( self.APPLICATION))
def test_getServiceStatus(self): services = listServices() for service in services.stdout: res = getServiceStatus(ServiceName=service) rootLogger.info(res)