def testUpdateAndDeleteSiddhiApp(self): logging.info("Test: Update and Delete Siddhi App") spPythonClient = SPClient(self.hostUrl) siddhiAppManagerClient = spPythonClient.getSiddhiAppManagementClient() lines = [] with open(resources_path + "/TestSiddhiApp1.siddhi", "rb") as f: lines = [line.decode() for line in f.readlines()] siddhiApp = "".join(lines) result = siddhiAppManagerClient.updateSiddhiApp(siddhiApp, username="******", password="******") self.assertTrue(result.name == UpdateAppStatusResponse.savedNew.name) sleep(5) result = siddhiAppManagerClient.updateSiddhiApp(siddhiApp, username="******", password="******") self.assertTrue(result.name == UpdateAppStatusResponse.updated.name) sleep(5) result = siddhiAppManagerClient.deleteSiddhiApp("TestSiddhiApp1", username="******", password="******") self.assertTrue(result)
def testRetrieveSiddhiAppStatus(self): logging.info("Test1: Retrieving a Siddhi App Status") spPythonClient = SPClient(self.hostUrl) siddhiAppManagementClient = spPythonClient.getSiddhiAppManagementClient() status = siddhiAppManagementClient.retrieveStatusSiddhiApp("TestSiddhiApp", username="******", password="******") self.assertEqual(status, "active")
def testRetrieveSiddhiApp(self): logging.info("Test1: Retrieving a Siddhi App") spPythonClient = SPClient(self.hostUrl) siddhiAppManagementClient = spPythonClient.getSiddhiAppManagementClient() app = siddhiAppManagementClient.retrieveSiddhiApp("TestSiddhiApp", username="******", password="******") lines = [] with open(resources_path + "/TestSiddhiApp.siddhi", "rb") as f: lines = [line.decode() for line in f.readlines()] target_app = "".join(lines) logging.info(target_app) logging.info(app) self.assertEqual(app, target_app)
def testListSiddhiApps(self): logging.info("Test1: List Siddhi Apps") spPythonClient = SPClient(self.hostUrl) siddhiAppManagementClient = spPythonClient.getSiddhiAppManagementClient() lines = [] with open(resources_path + "/TestSiddhiApp1.siddhi", "rb") as f: lines = [line.decode() for line in f.readlines()] siddhiApp = "".join(lines) result = siddhiAppManagementClient.saveSiddhiApp(siddhiApp, username="******", password="******") self.assertTrue(result) sleep(5) apps = siddhiAppManagementClient.listSiddhiApps(username="******", password="******") logging.info(apps) self.assertTrue("TestSiddhiApp1" in apps) logging.info(apps) apps = siddhiAppManagementClient.listSiddhiApps(username="******", password="******", isActive=True) self.assertTrue("TestSiddhiApp1" in apps) logging.info(apps) apps = siddhiAppManagementClient.listSiddhiApps(username="******", password="******", isActive=False) self.assertTrue("TestSiddhiApp1" not in apps) logging.info(apps) result = siddhiAppManagementClient.deleteSiddhiApp("TestSiddhiApp1", username="******", password="******") self.assertTrue(result)