UNPKG

3.24 kBJavaScriptView Raw
1/**
2 * Created by Harendra Kumar on 10/7/2016.
3 */
4var asSettingObj = require('./autoSensor/autoSensorSetting');
5var asMonitorObj = require('./autoSensor/autoSensorMonitor');
6var agentSetting = require('./agent-setting.js')
7var util = require('./util')
8function OtherKeywordhandler(){
9
10}
11OtherKeywordhandler.parsingKeywordvalue = function (clientMsg) {
12
13 var allFields = clientMsg;
14 for (var i = 0; i < allFields.length; i++)
15 {
16 if (allFields[i].toString().startsWith("ASSampleInterval=") || allFields[i].toString().indexOf("ASSampleInterval") > -1 ){
17 asSettingObj.asSampleInterval = allFields[i].toString().split("=")[1];
18 util.logger.info(agentSetting.currentTestRun,' |ASSampleInterval =',asSettingObj.asSampleInterval);
19 }
20 else if(allFields[i].toString().startsWith("ASReportInterval=") || allFields[i].toString().indexOf("ASReportInterval") > -1 ){
21 asSettingObj.asReportInterval = allFields[i].toString().split("=")[1];
22 util.logger.info(agentSetting.currentTestRun,' |ASReportInterval =',asSettingObj.asReportInterval);
23 }
24 else if(allFields[i].toString().startsWith("ASStackComparingDepth=") || allFields[i].toString().indexOf("ASStackComparingDepth") > -1 ){
25 asSettingObj.asStackComparingDepth = allFields[i].toString().split("=")[1];
26 util.logger.info(agentSetting.currentTestRun,' |ASStackComparingDepth =',asSettingObj.asStackComparingDepth);
27 }
28 else if(allFields[i].toString().startsWith("ASDepthFilter=") || allFields[i].toString().indexOf("ASDepthFilter") > -1 ){
29 asSettingObj.asDepthFilter = allFields[i].toString().split("=")[1];
30 util.logger.info(agentSetting.currentTestRun,' |ASDepthFilter =',asSettingObj.asDepthFilter);
31 }
32 else if(allFields[i].toString().startsWith("ASTraceLevel=") || allFields[i].toString().indexOf("ASTraceLevel") > -1 ){
33 asSettingObj.ASTraceLevel = allFields[i].toString().split("=")[1];
34 util.logger.info(agentSetting.currentTestRun,' |ASTraceLevel =',asSettingObj.ASTraceLevel);
35 }
36 else if(allFields[i].toString().startsWith("genNewMonRecord=") || allFields[i].toString().indexOf("genNewMonRecord") > -1 ){
37
38 var keywordArray = allFields[i].toString().split("=");
39 try {
40 asMonitorObj.sendThreadSummaryReport(keywordArray[1]);
41 }
42 catch(err)
43 {
44 asMonitorObj.sendThreadSummaryReport(0);
45 }
46 }
47 else if(allFields[i].toString().startsWith("ASThresholdMatchCount=") || allFields[i].toString().indexOf("ASThresholdMatchCount") > -1 ){
48 asSettingObj.asThresholdMatchCount = allFields[i].toString().split("=")[1];
49 util.logger.info(agentSetting.currentTestRun,' |ASThresholdMatchCount =',asSettingObj.asThresholdMatchCount);
50 }
51 }
52 if(asSettingObj.asSampleInterval && asSettingObj.asThresholdMatchCount)
53 {
54 asSettingObj.threshold = asSettingObj.asSampleInterval*asSettingObj.asThresholdMatchCount ;
55 }
56}
57
58
59module.exports = OtherKeywordhandler;