UNPKG

@idiamantino/livepro-utils

Version:

Stuff for LP

421 lines (325 loc) 27.1 kB
"use strict"; let params = []; const Utils = require("./utils"); const Dynamodb = require('../aws/dynamodb.js'); const Sqs = require('../aws/sqs.js'); const R53 = require('../aws/r53.js'); const querystring = require('querystring'); const S3 = require('../aws/s3.js'); const Lambda = require('../aws/lambda.js'); const Cloudwatch = require('../aws/cloudwatch.js'); const Configuration = require('../admin/configuration.js'); let LpUtils = new Utils(true); class Tester { constructor(params) { this.params = params; this.countTest = 0; this.countSuccess = 0; this.countError = 0; } setDebug(debug = false) { this.debug = debug; LpUtils.setDebug(debug); } async test(params){ LpUtils.printDebug("Tester function accessible:", params); (async() => { let result = await LpUtils.asyncTest("Async test params"); LpUtils.printDebug("Result Async: ", result); })(); return (true); } async debug(params) { LpUtils.printDebug("Debug function accessible:", params); let result = ""; // const LpCloudwatch = new Cloudwatch(this.params.region, '2012-10-17', true); // LpCloudwatch.test(); // await LpCloudwatch.enableRule("Livepro4ProcessQueue"); // await LpCloudwatch.disableRule("Livepro4ProcessQueue"); // await LpCloudwatch.deleteRule("A-Test"); // await LpCloudwatch.createLambdaRule("A-Test", "rate(5 minutes)", "DISABLED", "LiveproProcesses",{ "parameters": '{"process_name": "check_sso","client_name_list": ["devsearch"]}',"method": "GET", "body": "", "path":"process/start"}); // await LpCloudwatch.createRule("A-Test", "rate(5 minutes)", "DISABLED"); // const LpSqs = new Sqs(this.params.region); // const queueurl = await LpSqs.getQueueUrl("LiveproProcesses-ProcessesQueueSQS-NV9W2NLRICFW.fifo"); // console.log(queueurl); // Lambda Section // const LpLambda = new Lambda(this.params.region, '2015-03-31', true); // LpLambda.test(); // this.executeTest("Result ddbAddGlobalConfig:", result); // DDB Section const LpDynamodb = new Dynamodb(this.params.region, '2012-08-10', true); let ddbClient = { "client_name": "testigor123", "database_username": "testigor123", "database_password": "testigor123", "database_name": "testigor123", "subdomain": "testigor123", "domain": "testigor123" } console.log(ddbClient); result = await LpDynamodb.ddbUpdateClient(ddbClient); // const LpConfiguration = new Configuration(this.params.region, '2012-08-10', true); // await LpDynamodb.ddbAddProcessSchedule("123", "process_name","client_name","cron_expression"); // result = await LpDynamodb.getProcessSchedule(); // result = await LpDynamodb.updateClientSecrets("dev416","123123","34543534"); // result = await LpDynamodb.getClient("dev416"); // await LpDynamodb.ddbAddProcessEndpoints("test", true, "1", "type", "url", "10"); // result = await LpDynamodb.getClient(); // result = await LpConfiguration.getClient(); // result = await LpDynamodb.getProcessEndpoints(); // let globalconfigUid = "123123123"; // let globalconfigCode = "yellowfin_admin_password"; // let globalconfigContent = "c3880cd461ece95bc5199f8ad29bcd95"; // let globalconfigSection = "1"; // result = await LpDynamodb.ddbAddGlobalConfig(globalconfigUid,globalconfigCode,globalconfigContent,globalconfigSection); // this.executeTest("Result ddbAddGlobalConfig:", result); // result = await LpDynamodb.getGlobalConfig(globalconfigCode); // this.executeTest("Result getGlobalConfig:", result); // http request section // result = await LpUtils.httprequestnew("http://www.livepro.com.au","/index.php",80,"GET","", "", false); // let content = "{\"id\": \"530\",\"name\": \"steak change 1545022460\",\"type_id\": 3,\"type_description\": \"Document Note\",\"workflow_id\": 3,\"workflow_description\": \"Default\",\"type_code\": \"documentnote\",\"version_id\": 81149,\"workflow_status_id\": 2,\"workflow_status_description\": \"Published\",\"user_id\": 2,\"user_title\": \"system\",\"user_fullname\": \"System Livepro\",\"content\": \"SteakSteak\",\"spellcorrection\": [\"SteakSteak\",\"SteakSteak\",\"Steak\",\"Steak\"],\"language_id\": 1,\"language_description\": \"English\",\"version\": 1,\"subversion\": 1,\"create_date\": \"2018-12-17T14:38:46Z\",\"hierarchies\": [\"Content\",\"Parent Category A\",\"Category A2\"],\"hierarchy_paths\": [\"Content > Parent Category A > Category A2\"],\"title\": \"Steak\",\"title_s\": [\"Steak\"],\"title_autocomplete\": [\"Steak\"],\"is_latest\": true,\"is_published\": true,\"is_archived\": false,\"has_published\": true,\"is_searchable\": true,\"is_searchable_after_end_date\": false,\"is_visible\": true,\"response_types\": [10,5,11,1,8],\"future_workflow_status_description\": \"Published\",\"is_expired_b\": false,\"scope_actions\": [336,337,338,339,340,341,342,439,440,441,442,443,445,688,704,736,737,738,739,740,741,742,836,837,838,839,840,841,842,934,935,936,937,938],\"html_t\": \"<p>Steak<\/p>\",\"title_t\": \"Steak\",\"hierarchy_toplevel\": [\"Parent Category A\"],\"hierarchy_ids\": [43],\"unique\": \"135_1\",\"response_types_description\": [\"List on Hierarchies\",\"Acknowledgment\",\"Favourite\",\"Feedback\",\"Search\"],\"content_title_keywords\": \" SteakSteak Steak\",\"json\": \"{\\\"success\\\":true,\\\"id\\\":\\\"135\\\",\\\"name\\\":\\\"steak\\\",\\\"type_id\\\":\\\"3\\\",\\\"type_description\\\":\\\"Document Note\\\",\\\"sub_type_id\\\":null,\\\"sub_type_description\\\":null,\\\"workflow_id\\\":\\\"3\\\",\\\"workflow_description\\\":\\\"Default\\\",\\\"type_code\\\":\\\"documentnote\\\",\\\"parent_id\\\":null,\\\"parent_version_id\\\":null,\\\"parent_knowledge_object_model\\\":null,\\\"version_id\\\":\\\"150\\\",\\\"keywords\\\":\\\"\\\",\\\"workflow_status_id\\\":\\\"2\\\",\\\"workflow_status_description\\\":\\\"Published\\\",\\\"workflow_status_order\\\":\\\"2\\\",\\\"workflow_status_archived\\\":\\\"0\\\",\\\"workflow_status_published\\\":\\\"1\\\",\\\"user_id\\\":\\\"2\\\",\\\"user_title\\\":\\\"system\\\",\\\"user_fullname\\\":\\\"System Livepro\\\",\\\"content\\\":{\\\"html\\\":\\\"<p>Steak<\\\\\/p>\\\",\\\"virtual_agent_content\\\":\\\"\\\",\\\"virtual_agent_keywords\\\":\\\"\\\",\\\"review_comments\\\":{},\\\"parent_title\\\":null,\\\"parent_type_id\\\":null,\\\"parent_reference\\\":null,\\\"embedded_objects\\\":null},\\\"language_id\\\":\\\"1\\\",\\\"language_description\\\":\\\"English\\\",\\\"knowledge_object_reference\\\":null,\\\"version\\\":\\\"1\\\",\\\"subversion\\\":\\\"1\\\",\\\"create_date\\\":\\\"2018-12-17 14:38:46\\\",\\\"publish_start_date\\\":null,\\\"publish_end_date\\\":null,\\\"publish_expired_date\\\":null,\\\"notes\\\":\\\"\\\",\\\"summary\\\":\\\"\\\",\\\"review_date\\\":null,\\\"review_period\\\":\\\"\\\",\\\"priority\\\":null,\\\"image_id\\\":null,\\\"invisible_hierarchies\\\":[],\\\"hierarchies\\\":[\\\"43\\\"],\\\"hierarchy_paths\\\":[{\\\"id\\\":\\\"43\\\",\\\"description\\\":\\\"Content > Parent Category A > Category A2\\\",\\\"visible\\\":1}],\\\"hierarchy_reference\\\":\\\"{\\\\\\\"success\\\\\\\":true,\\\\\\\"0\\\\\\\":{\\\\\\\"id\\\\\\\":\\\\\\\"43\\\\\\\",\\\\\\\"description\\\\\\\":\\\\\\\"Content > Parent Category A > Category A2\\\\\\\",\\\\\\\"visible\\\\\\\":1}}\\\",\\\"user_associations\\\":[{\\\"id\\\":\\\"6\\\",\\\"user_id\\\":\\\"2\\\",\\\"knowledge_object_id\\\":\\\"135\\\",\\\"type_id\\\":\\\"1\\\"}],\\\"title\\\":\\\"Steak\\\",\\\"title_pending\\\":null,\\\"score\\\":null,\\\"is_latest\\\":1,\\\"is_published\\\":1,\\\"is_archived\\\":0,\\\"is_due_to_expire\\\":0,\\\"is_published_in_future\\\":0,\\\"has_unpublished\\\":0,\\\"has_published\\\":1,\\\"is_searchable\\\":\\\"1\\\",\\\"is_searchable_after_end_date\\\":\\\"0\\\",\\\"is_visible\\\":1,\\\"is_pending\\\":0,\\\"future_is_pending\\\":null,\\\"is_user_favorite\\\":1,\\\"is_user_editable\\\":1,\\\"is_user_read\\\":1,\\\"change_stream\\\":null,\\\"errors_response\\\":[],\\\"response_types\\\":[\\\"10\\\",\\\"5\\\",\\\"11\\\",\\\"1\\\",\\\"8\\\"],\\\"knowledge_object_field_name\\\":\\\"\\\",\\\"future_json\\\":null,\\\"future_workflow_status_description\\\":\\\"Published\\\",\\\"role_ss\\\":\\\"\\\",\\\"dl_ss\\\":\\\"\\\",\\\"is_expired_b\\\":0}\"}"; // let body = '[' + content + ']'; // let headers = {'Content-Type': 'application/json'}; // result = await LpUtils.httprequest("solr-mdev-master.livepro.local","/solr/devsearch_knowledgeobject/update/json?commit=true",8983,"POST",body, headers, false); console.log(result); } async testAll(params = []) { LpUtils.printDebug("Testing All Functions with params:", params); this.testDynamodb(params); this.testSqs(params); this.testUtils(params); this.testR53(params); this.testS3(params); this.testLambda(params); } async printParams(){ LpUtils.printDebug("Params:", this.params); return (true); } executeTest(caption, result) { LpUtils.printDebug(caption, result); this.countTest = this.countTest+1; if((Array.isArray(result) && result.length <= 0) || result == false || result == "") { this.countError++; } else { this.countSuccess++; } } async testUtils(params = []){ LpUtils.printDebug("Utils functions accessible. Params:", params); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpUtils.setDebug(true); let content = "{\"id\": \"530\",\"name\": \"steak change 1545022460\",\"type_id\": 3,\"type_description\": \"Document Note\",\"workflow_id\": 3,\"workflow_description\": \"Default\",\"type_code\": \"documentnote\",\"version_id\": 81149,\"workflow_status_id\": 2,\"workflow_status_description\": \"Published\",\"user_id\": 2,\"user_title\": \"system\",\"user_fullname\": \"System Livepro\",\"content\": \"SteakSteak\",\"spellcorrection\": [\"SteakSteak\",\"SteakSteak\",\"Steak\",\"Steak\"],\"language_id\": 1,\"language_description\": \"English\",\"version\": 1,\"subversion\": 1,\"create_date\": \"2018-12-17T14:38:46Z\",\"hierarchies\": [\"Content\",\"Parent Category A\",\"Category A2\"],\"hierarchy_paths\": [\"Content > Parent Category A > Category A2\"],\"title\": \"Steak\",\"title_s\": [\"Steak\"],\"title_autocomplete\": [\"Steak\"],\"is_latest\": true,\"is_published\": true,\"is_archived\": false,\"has_published\": true,\"is_searchable\": true,\"is_searchable_after_end_date\": false,\"is_visible\": true,\"response_types\": [10,5,11,1,8],\"future_workflow_status_description\": \"Published\",\"is_expired_b\": false,\"scope_actions\": [336,337,338,339,340,341,342,439,440,441,442,443,445,688,704,736,737,738,739,740,741,742,836,837,838,839,840,841,842,934,935,936,937,938],\"html_t\": \"<p>Steak<\/p>\",\"title_t\": \"Steak\",\"hierarchy_toplevel\": [\"Parent Category A\"],\"hierarchy_ids\": [43],\"unique\": \"135_1\",\"response_types_description\": [\"List on Hierarchies\",\"Acknowledgment\",\"Favourite\",\"Feedback\",\"Search\"],\"content_title_keywords\": \" SteakSteak Steak\",\"json\": \"{\\\"success\\\":true,\\\"id\\\":\\\"135\\\",\\\"name\\\":\\\"steak\\\",\\\"type_id\\\":\\\"3\\\",\\\"type_description\\\":\\\"Document Note\\\",\\\"sub_type_id\\\":null,\\\"sub_type_description\\\":null,\\\"workflow_id\\\":\\\"3\\\",\\\"workflow_description\\\":\\\"Default\\\",\\\"type_code\\\":\\\"documentnote\\\",\\\"parent_id\\\":null,\\\"parent_version_id\\\":null,\\\"parent_knowledge_object_model\\\":null,\\\"version_id\\\":\\\"150\\\",\\\"keywords\\\":\\\"\\\",\\\"workflow_status_id\\\":\\\"2\\\",\\\"workflow_status_description\\\":\\\"Published\\\",\\\"workflow_status_order\\\":\\\"2\\\",\\\"workflow_status_archived\\\":\\\"0\\\",\\\"workflow_status_published\\\":\\\"1\\\",\\\"user_id\\\":\\\"2\\\",\\\"user_title\\\":\\\"system\\\",\\\"user_fullname\\\":\\\"System Livepro\\\",\\\"content\\\":{\\\"html\\\":\\\"<p>Steak<\\\\\/p>\\\",\\\"virtual_agent_content\\\":\\\"\\\",\\\"virtual_agent_keywords\\\":\\\"\\\",\\\"review_comments\\\":{},\\\"parent_title\\\":null,\\\"parent_type_id\\\":null,\\\"parent_reference\\\":null,\\\"embedded_objects\\\":null},\\\"language_id\\\":\\\"1\\\",\\\"language_description\\\":\\\"English\\\",\\\"knowledge_object_reference\\\":null,\\\"version\\\":\\\"1\\\",\\\"subversion\\\":\\\"1\\\",\\\"create_date\\\":\\\"2018-12-17 14:38:46\\\",\\\"publish_start_date\\\":null,\\\"publish_end_date\\\":null,\\\"publish_expired_date\\\":null,\\\"notes\\\":\\\"\\\",\\\"summary\\\":\\\"\\\",\\\"review_date\\\":null,\\\"review_period\\\":\\\"\\\",\\\"priority\\\":null,\\\"image_id\\\":null,\\\"invisible_hierarchies\\\":[],\\\"hierarchies\\\":[\\\"43\\\"],\\\"hierarchy_paths\\\":[{\\\"id\\\":\\\"43\\\",\\\"description\\\":\\\"Content > Parent Category A > Category A2\\\",\\\"visible\\\":1}],\\\"hierarchy_reference\\\":\\\"{\\\\\\\"success\\\\\\\":true,\\\\\\\"0\\\\\\\":{\\\\\\\"id\\\\\\\":\\\\\\\"43\\\\\\\",\\\\\\\"description\\\\\\\":\\\\\\\"Content > Parent Category A > Category A2\\\\\\\",\\\\\\\"visible\\\\\\\":1}}\\\",\\\"user_associations\\\":[{\\\"id\\\":\\\"6\\\",\\\"user_id\\\":\\\"2\\\",\\\"knowledge_object_id\\\":\\\"135\\\",\\\"type_id\\\":\\\"1\\\"}],\\\"title\\\":\\\"Steak\\\",\\\"title_pending\\\":null,\\\"score\\\":null,\\\"is_latest\\\":1,\\\"is_published\\\":1,\\\"is_archived\\\":0,\\\"is_due_to_expire\\\":0,\\\"is_published_in_future\\\":0,\\\"has_unpublished\\\":0,\\\"has_published\\\":1,\\\"is_searchable\\\":\\\"1\\\",\\\"is_searchable_after_end_date\\\":\\\"0\\\",\\\"is_visible\\\":1,\\\"is_pending\\\":0,\\\"future_is_pending\\\":null,\\\"is_user_favorite\\\":1,\\\"is_user_editable\\\":1,\\\"is_user_read\\\":1,\\\"change_stream\\\":null,\\\"errors_response\\\":[],\\\"response_types\\\":[\\\"10\\\",\\\"5\\\",\\\"11\\\",\\\"1\\\",\\\"8\\\"],\\\"knowledge_object_field_name\\\":\\\"\\\",\\\"future_json\\\":null,\\\"future_workflow_status_description\\\":\\\"Published\\\",\\\"role_ss\\\":\\\"\\\",\\\"dl_ss\\\":\\\"\\\",\\\"is_expired_b\\\":0}\"}"; let body = '[' + content + ']'; let headers = {'Content-Type': 'application/json'}; if(params.runall) { // Execute all tests result = await LpUtils.httprequest("https://qa415.livepro.com.au","/process/Getkoidlist?from_id=2&to_id=10&username=system&password=c3880cd461ece95bc5199f8ad29bcd95",443,"GET","", "", true); this.executeTest("Result httpsrequest"); result = await LpUtils.httprequest("http://www.livepro.com.au","/index.php",80,"GET","", "", false); this.executeTest("Result httprequest"); result = await LpUtils.httprequest("http://solr-mdev-master.livepro.local","/solr/devsearch_knowledgeobject/select?q=*%3A*&wt=json&indent=true",8983,"POST","", "", false); this.executeTest("Result httprequest"); result = await LpUtils.httprequest("http://solr-mdev-master.livepro.local","/solr/devsearch_knowledgeobject/update/json?commit=true",8983,"POST",body, headers, false); this.executeTest("Result httprequest"); } else { result = await LpUtils.test("test"); this.executeTest("Result test:", result); } console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } async testDynamodb(params = []){ LpUtils.printDebug("Dynamodb function accessible. Params:", params); const LpDynamodb = new Dynamodb(this.params.region, '2012-08-10', true); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpDynamodb.setDebug(true); let uid = "12345"; let clientName = "dev416"; let processName = "update_links"; let processStatus = "processing"; let urlSolr = "urlSolr"; let content = "content json"; let s3PathContent = "s3pathcontent"; let type = "type"; let clientUid = "123123123123"; let databaseClientName = "dbclientname"; let databaseServerName = "dbserver"; let solrClientName = "solrclient"; let solrServerName = "solrserver"; let clientSubdomain = "subdomain" let reportUid = "reportid"; let systemSecret = "systemsecret"; let processSecret = "processecret"; let clientUrl = "clienturl"; let solrName = "eight"; let databaseName = "sone"; let solrUid = "12312312321"; let solrReadHost = "readsolr"; let solrWriteHost = "writesolr"; let databaseUid = "12312312321"; let databaseUsername = "dbname"; let databasePassword = "dbpassword"; let databaseHost = "dbhost"; let databaseEndpoint = "dbendpoint"; let databaseReplicaEndpoint = "dbendpointreplica"; let globalconfigUid = "123123123"; let globalconfigCode = "system"; let globalconfigContent = "c3880cd461ece95bc5199f8ad29bcd95"; let globalconfigSection = "1"; if(params.runall) { // Execute all tests result = await LpDynamodb.ddbAddProcessClient(uid,clientName,"pending",processName, "dateExecution", "dateCreated", "dateUpdated", "1", "processUrl", true); this.executeTest("Result ddbAddProcessClient:", result); result = await LpDynamodb.setProcessClientStatus(uid,processStatus); this.executeTest("Result setProcessClientStatus:", result); result = await LpDynamodb.getProcessClientById(uid); this.executeTest("Result getProcessClientById:", result); result = await LpDynamodb.getProcessClientsByClientName(clientName); this.executeTest("Result getProcessClientsByClientName:", result); result = await LpDynamodb.getProcessClientsByClientNameAndProcessInfo(clientName, processStatus, processName); this.executeTest("Result getProcessClientsByClientNameAndProcessInfo:", result); result = await LpDynamodb.getProcessEndpoints(processName); this.executeTest("Result getProcessEndpoints:", result); result = await LpDynamodb.ddbAddIndexerObject(uid, urlSolr, clientName, content, type, processStatus, s3PathContent) this.executeTest("Result ddbAddIndexerObject:", result); result = await LpDynamodb.getIndexerObjects(clientName); this.executeTest("Result getIndexerObjects:", result); result = await LpDynamodb.getIndexerObjects("",processStatus); this.executeTest("Result getIndexerObjects:", result); result = await LpDynamodb.setIndexerObjectStatus(uid,"processing"); this.executeTest("Result setIndexerObjectStatus:", result); result = await LpDynamodb.ddbAddClient(clientUid,clientName,databaseClientName,databaseServerName,solrClientName,solrServerName,clientSubdomain,reportUid,systemSecret,processSecret,clientUrl); this.executeTest("Result ddbAddClient:", result); result = await LpDynamodb.getClient(clientName); this.executeTest("Result getClient:", result); result = await LpDynamodb.ddbAddSolr(solrUid,solrName,solrReadHost,solrWriteHost); this.executeTest("Result ddbAddClient:", result); result = await LpDynamodb.getSolr(solrName); this.executeTest("Result getSolr:", result); result = await LpDynamodb.ddbAddDatabase(databaseUid,databaseName,databaseUsername,databasePassword,databaseHost,databaseEndpoint,databaseReplicaEndpoint); this.executeTest("Result ddbAddDatabase:", result); result = await LpDynamodb.getDatabase(databaseName); this.executeTest("Result getDatabase:", result); result = await LpDynamodb.ddbAddGlobalConfig(globalconfigUid,globalconfigCode,globalconfigContent,globalconfigSection); this.executeTest("Result ddbAddGlobalConfig:", result); result = await LpDynamodb.getGlobalConfig(globalconfigCode); this.executeTest("Result getGlobalConfig:", result); result - await LpDynamodb.ddbAddProcessSchedule(uid, processName,clientName,"cron_expression"); this.executeTest("Result ddbAddProcessSchedule:", result); result = await LpDynamodb.getProcessSchedule(); this.executeTest("Result getProcessSchedule:", result); } else { result = await LpDynamodb.test("Dynamodb params"); this.executeTest("Result test:", result); } console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } async testSqs(params = []){ LpUtils.printDebug("SQS function accessible. Params:", params); const LpSqs = new Sqs(this.params.region); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpSqs.setDebug(true); let uid = "12345"; let clientName = "client name"; let processName = "update_links"; let processStatus = "processing"; result = await LpSqs.test(); this.executeTest("Result test:", result); console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } async testR53(params = []){ LpUtils.printDebug("R53 function accessible. Params:", params); const LpR53 = new R53(this.params.region); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpR53.setDebug(true); let uid = "12345"; let clientName = "adea"; if(params.runall) { // Execute all tests result = await LpR53.getClientUrl(clientName); this.executeTest("Result getClientUrl:", result); // LpR53.test1(); } else { result = await LpR53.test(); this.executeTest("Result test:", result); } console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } async testS3(params = []){ LpUtils.printDebug("S3 function accessible. Params:", params); const LpS3 = new S3(this.params.region, '2006-03-01', true); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpS3.setDebug(true); let uid = "12345"; let clientName = "devsearch"; let bucket = "lp4dev"; let key = "liveproindexer/test.json"; let content = "{test}"; if(params.runall) { // Execute all tests result = await LpS3.uploadContent(bucket,key,content); this.executeTest("LpS3.uploadContent:", result); result = await LpS3.getContent(bucket,key); this.executeTest("Result LpS3.getContent:", result); // result = await LpS3.test(this.params); } else { result = await LpS3.test(); this.executeTest("Result test:", result); } console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } async testLambda(params = []){ LpUtils.printDebug("Lambda function accessible. Params:", params); const LpLambda = new Lambda(this.params.region, '2015-03-31', true); (async() => { let result = ""; // processId = "", clientName = "", processStatus = "", processName = "", limit = "" LpLambda.setDebug(true); let lambdaname = "LiveproSandbox"; let lambdaargs = '{"key1": "value1","key2": "value2","key3": "value3"}'; if(params.runall) { // Execute all tests result = await LpLambda.callAsync(lambdaname,lambdaargs); this.executeTest("LpLambda.callAsync:", result); } else { result = await LpLambda.test(); this.executeTest("Result test:", result); } console.log("Total Tests:" + this.countTest); console.log("Total Success:" + this.countSuccess); console.log("Total Error:" + this.countError); })(); return (true); } } module.exports = Tester;