diff --git a/pom.xml b/pom.xml
index 6af2d5e..fc157b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -125,22 +125,22 @@
GBK
-
-
-
- maven-ali
- http://maven.aliyun.com/nexus/content/groups/public
-
- true
-
-
- true
- always
- fail
-
-
-
-
+
+
+
+ maven-ali
+ http://maven.aliyun.com/nexus/content/groups/public
+
+ true
+
+
+ true
+ always
+ fail
+
+
+
+
junit
@@ -210,12 +210,12 @@
org.apache.httpcomponents
httpclient
-
+
commons-io
commons-io
2.5
-
+
commons-lang
commons-lang
2.6
@@ -225,32 +225,29 @@
commons-logging
1.2
-
+
org.apache.commons
commons-math
2.2
-
+
commons-net
commons-net
3.6
-
- log4j
- log4j
- 1.2.17
-
-
+
+
org.slf4j
slf4j-api
+ 1.7.26
-
- org.springframework.boot
- spring-boot-starter-log4j
- 1.3.8.RELEASE
-
-
-
+
+ org.springframework.boot
+ spring-boot-starter-log4j
+ 1.3.8.RELEASE
+
+
org.seleniumhq.selenium
selenium-java
@@ -261,12 +258,12 @@
xml-apis
xml-apis
-
+
io.appium
java-client
6.0.0-BETA2
-
+
org.freemarker
freemarker
@@ -295,12 +292,12 @@
org.springframework.boot
spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-logging
-
-
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
diff --git a/src/main/Resources/bootlog4j.conf b/src/main/Resources/bootlog4j.conf
index be380cc..a736444 100644
--- a/src/main/Resources/bootlog4j.conf
+++ b/src/main/Resources/bootlog4j.conf
@@ -1,12 +1,9 @@
-log4j.rootLogger=INFO,stdout,app,error
+log4j.rootLogger=INFO,stdout,info,warn,error
-log4j.logger.app=info,error
+log4j.logger.info=info
+log4j.logger.warn=warn
log4j.logger.error=error
-log4j.additivity.msg=false
-log4j.additivity.monitor=false
-log4j.additivity.error=false
-
log4j.logger.org.springframework=warn
log4j.logger.org.apache=info,error
log4j.logger.org.aspectj.weaver=warn
@@ -23,25 +20,36 @@ log4j.logger.java.sql.PreparedStatement=info
#log4j.logger.org.apache.commons.httpclient.Wire=off
-################
+################打印到控制台
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{yyyy-MM-dd HH\:mm\:ss\:SSS}\:%l - \n%p\: %m%n
-################
-log4j.appender.app=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.app.File=bootlog/APP.log
-log4j.appender.app.layout=org.apache.log4j.PatternLayout
-log4j.appender.app.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
-log4j.appender.app.DatePattern = '.'yyyy-MM-dd
-log4j.appender.app.encoding=UTF-8
-#log4j.appender.app.encoding=UTF-8
+################记录系统日志,监控客户端运行情况
+log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.info.File=bootlog/INFO.log
+log4j.appender.info.layout=org.apache.log4j.PatternLayout
+log4j.appender.info.Threshold = INFO
+log4j.appender.info.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
+log4j.appender.info.DatePattern = '.'yyyy-MM-dd
+log4j.appender.info.encoding=UTF-8
################
-################error
+################记录系统告警日志
+log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.warn.File=bootlog/WARN.log
+log4j.appender.warn.layout=org.apache.log4j.PatternLayout
+log4j.appender.warn.Threshold = WARN
+log4j.appender.warn.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
+log4j.appender.warn.DatePattern = '.'yyyy-MM-dd
+log4j.appender.warn.encoding=UTF-8
+################
+
+################记录系统错误,监控程序是否出错
log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.File=bootlog/ERROR.log
log4j.appender.error.layout=org.apache.log4j.PatternLayout
+log4j.appender.error.Threshold = ERROR
log4j.appender.error.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
log4j.appender.error.DatePattern = '.'yyyy-MM-dd
log4j.appender.error.encoding=UTF-8
diff --git a/src/main/Resources/log4j.conf b/src/main/Resources/log4j.conf
index 5137169..ce142d1 100644
--- a/src/main/Resources/log4j.conf
+++ b/src/main/Resources/log4j.conf
@@ -1,12 +1,9 @@
-log4j.rootLogger=INFO,stdout,app,error
+log4j.rootLogger=INFO,stdout,info,warn,error
-log4j.logger.app=info,error
+log4j.logger.info=info
+log4j.logger.warn=warn
log4j.logger.error=error
-log4j.additivity.msg=false
-log4j.additivity.monitor=false
-log4j.additivity.error=false
-
log4j.logger.org.springframework=warn
log4j.logger.org.apache=info,error
log4j.logger.org.aspectj.weaver=warn
@@ -23,25 +20,36 @@ log4j.logger.java.sql.PreparedStatement=info
#log4j.logger.org.apache.commons.httpclient.Wire=off
-################
+################打印到控制台
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{yyyy-MM-dd HH\:mm\:ss\:SSS}\:%l - \n%p\: %m%n
-################
-log4j.appender.app=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.app.File=log/APP.log
-log4j.appender.app.layout=org.apache.log4j.PatternLayout
-log4j.appender.app.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
-log4j.appender.app.DatePattern = '.'yyyy-MM-dd
-log4j.appender.app.encoding=UTF-8
-#log4j.appender.app.encoding=UTF-8
+################记录系统日志,监控客户端运行情况
+log4j.appender.info=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.info.File=log/INFO.log
+log4j.appender.info.layout=org.apache.log4j.PatternLayout
+log4j.appender.info.Threshold = INFO
+log4j.appender.info.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
+log4j.appender.info.DatePattern = '.'yyyy-MM-dd
+log4j.appender.info.encoding=UTF-8
################
-################error
+################记录系统告警日志
+log4j.appender.warn=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.warn.File=log/WARN.log
+log4j.appender.warn.layout=org.apache.log4j.PatternLayout
+log4j.appender.warn.Threshold = WARN
+log4j.appender.warn.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
+log4j.appender.warn.DatePattern = '.'yyyy-MM-dd
+log4j.appender.warn.encoding=UTF-8
+################
+
+################记录系统错误,监控程序是否出错
log4j.appender.error=org.apache.log4j.DailyRollingFileAppender
log4j.appender.error.File=log/ERROR.log
log4j.appender.error.layout=org.apache.log4j.PatternLayout
+log4j.appender.error.Threshold = ERROR
log4j.appender.error.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss:SSS}:%p %l - %m%n
log4j.appender.error.DatePattern = '.'yyyy-MM-dd
log4j.appender.error.encoding=UTF-8
diff --git a/src/main/java/luckyclient/caserun/BatchCaseExecute.java b/src/main/java/luckyclient/caserun/BatchCaseExecute.java
index a5d1e0e..5773b42 100644
--- a/src/main/java/luckyclient/caserun/BatchCaseExecute.java
+++ b/src/main/java/luckyclient/caserun/BatchCaseExecute.java
@@ -10,6 +10,7 @@ import luckyclient.caserun.exappium.iosex.IosBatchExecute;
import luckyclient.caserun.exinterface.BatchTestCaseExecution;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.ex.WebBatchExecute;
+import luckyclient.publicclass.AppiumConfig;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
@@ -44,7 +45,7 @@ public class BatchCaseExecute extends TestControl {
String.valueOf(task.getTaskId()), batchcase);
} else if (taskScheduling.getTaskType() == 2) {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
if ("Android".equals(properties.getProperty("platformName"))) {
AndroidBatchExecute.batchCaseExecuteForTast(taskScheduling.getProject().getProjectName(),
diff --git a/src/main/java/luckyclient/caserun/OneCaseExecute.java b/src/main/java/luckyclient/caserun/OneCaseExecute.java
index b1e2ad4..773b0d2 100644
--- a/src/main/java/luckyclient/caserun/OneCaseExecute.java
+++ b/src/main/java/luckyclient/caserun/OneCaseExecute.java
@@ -10,6 +10,7 @@ import luckyclient.caserun.exappium.iosex.IosOneCaseExecute;
import luckyclient.caserun.exinterface.TestCaseExecution;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.ex.WebOneCaseExecute;
+import luckyclient.publicclass.AppiumConfig;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.TaskExecute;
import luckyclient.serverapi.entity.TaskScheduling;
@@ -44,7 +45,7 @@ public class OneCaseExecute extends TestControl {
String.valueOf(task.getTaskId()));
} else if (taskScheduling.getTaskType() == 2) {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
if ("Android".equals(properties.getProperty("platformName"))) {
AndroidOneCaseExecute.oneCaseExecuteForTast(taskScheduling.getProject().getProjectName(), Integer.valueOf(caseId),
diff --git a/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java b/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java
index 4be9669..5aa9bf3 100644
--- a/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java
+++ b/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java
@@ -6,6 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
/**
@@ -45,7 +46,7 @@ public class AppDriverAnalyticCase {
params.put("property", property.trim().toLowerCase());
//setֵ
params.put("property_value", propertyValue.trim());
- luckyclient.publicclass.LogUtil.APP.info("Խproperty:"+property.trim()+"; property_value:"+propertyValue.trim());
+ LogUtil.APP.info("Խproperty:"+property.trim()+"; property_value:"+propertyValue.trim());
}
//set
params.put("operation", step.getStepOperation().toLowerCase());
@@ -53,7 +54,7 @@ public class AppDriverAnalyticCase {
//setֵ
params.put("operation_value", step.getStepParameters());
}
- luckyclient.publicclass.LogUtil.APP.info("operation:"+step.getStepOperation().toLowerCase()+"; operation_value:"+step.getStepParameters());
+ LogUtil.APP.info("operation:"+step.getStepOperation().toLowerCase()+"; operation_value:"+step.getStepParameters());
//ȡԤڽַ
resultstr = step.getExpectedResult();
@@ -69,19 +70,18 @@ public class AppDriverAnalyticCase {
params.put("checkproperty_value", expectedResults.substring(expectedResults.indexOf("=")+1, expectedResults.lastIndexOf(")")));
}
params.put("ExpectedResults", expectedResults);
- luckyclient.publicclass.LogUtil.APP.info("ԤڽExpectedResults:"+expectedResults);
+ LogUtil.APP.info("ԤڽExpectedResults:"+expectedResults);
}
- luckyclient.publicclass.LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
+ LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զűɣ","info",String.valueOf(step.getStepSerialNumber()),"");
}
}catch(Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű");
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զű","error",String.valueOf(step.getStepSerialNumber()),"");
}
- luckyclient.publicclass.LogUtil.ERROR.error(e,e);
+ LogUtil.APP.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű",e);
params.put("exception","ţ"+projectcase.getCaseSign()+"|쳣,Ϊջű");
return params;
}
diff --git a/src/main/java/luckyclient/caserun/exappium/AppTestControl.java b/src/main/java/luckyclient/caserun/exappium/AppTestControl.java
index a77d3c1..6bef1fa 100644
--- a/src/main/java/luckyclient/caserun/exappium/AppTestControl.java
+++ b/src/main/java/luckyclient/caserun/exappium/AppTestControl.java
@@ -1,5 +1,10 @@
package luckyclient.caserun.exappium;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.ios.IOSDriver;
@@ -13,13 +18,14 @@ import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
-import luckyclient.serverapi.entity.*;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
+import luckyclient.serverapi.entity.ProjectCase;
+import luckyclient.serverapi.entity.ProjectCaseParams;
+import luckyclient.serverapi.entity.ProjectCaseSteps;
+import luckyclient.serverapi.entity.TaskExecute;
+import luckyclient.serverapi.entity.TaskScheduling;
/**
* =================================================================
@@ -46,7 +52,7 @@ public class AppTestControl {
String taskid = "888888";
AndroidDriver androiddriver = null;
IOSDriver iosdriver = null;
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
try {
if ("Android".equals(properties.getProperty("platformName"))) {
androiddriver = AppiumInitialization.setAndroidAppium(properties);
@@ -64,7 +70,7 @@ public class AppTestControl {
if (testCases.size() != 0) {
pcplist = GetServerAPI.cgetParamsByProjectid(String.valueOf(testCases.get(0).getProjectId()));
}
- luckyclient.publicclass.LogUtil.APP.info("ǰƻжȡ " + testCases.size() + " ");
+ LogUtil.APP.info("ǰƻжȡ " + testCases.size() + " ");
int i = 0;
for (ProjectCase testcase : testCases) {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
@@ -72,7 +78,7 @@ public class AppTestControl {
continue;
}
i++;
- luckyclient.publicclass.LogUtil.APP.info("ʼִе" + i + "" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִе" + i + "" + testcase.getCaseSign() + "......");
try {
if ("Android".equals(properties.getProperty("platformName"))) {
AndroidCaseExecution.caseExcution(testcase, steps, taskid, androiddriver, caselog, pcplist);
@@ -81,15 +87,15 @@ public class AppTestControl {
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
- e.printStackTrace();
+ LogUtil.APP.error("ûִй׳InterruptedException쳣", e);
+
} catch (IOException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
+ LogUtil.APP.error("ûִй׳IOException쳣", e);
}
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
}
- luckyclient.publicclass.LogUtil.APP.info("ǰĿԼƻеѾȫִ...");
+ LogUtil.APP.info("ǰĿԼƻеѾȫִ...");
// رAPPԼappiumỰ
if ("Android".equals(properties.getProperty("platformName"))) {
androiddriver.closeApp();
@@ -105,7 +111,7 @@ public class AppTestControl {
TestControl.TASKID = taskId;
AndroidDriver androiddriver = null;
IOSDriver iosdriver = null;
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
AppiumService as=null;
//ԶAppiume
if(Boolean.valueOf(properties.getProperty("autoRunAppiumService"))){
@@ -128,21 +134,20 @@ public class AppTestControl {
try {
if ("Android".equals(properties.getProperty("platformName"))) {
androiddriver = AppiumInitialization.setAndroidAppium(properties);
- luckyclient.publicclass.LogUtil.APP.info("AndroidDriverʼ...APPIUM Serverhttp://"
+ LogUtil.APP.info("AndroidDriverʼ...APPIUM Serverhttp://"
+ properties.getProperty("appiumsever") + "/wd/hub");
} else if ("IOS".equals(properties.getProperty("platformName"))) {
iosdriver = AppiumInitialization.setIosAppium(properties);
- luckyclient.publicclass.LogUtil.APP.info("IOSDriverʼ...APPIUM Serverhttp://"
+ LogUtil.APP.info("IOSDriverʼ...APPIUM Serverhttp://"
+ properties.getProperty("appiumsever") + "/wd/hub");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ʼAppiumDriver APPIUM Serverhttp://"
+ LogUtil.APP.error("ʼAppiumDriver APPIUM Serverhttp://"
+ properties.getProperty("appiumsever") + "/wd/hub", e);
- e.printStackTrace();
}
LogOperation caselog = new LogOperation();
List cases = GetServerAPI.getCasesbyplanId(taskScheduling.getPlanId());
- luckyclient.publicclass.LogUtil.APP.info("ǰƻжȡ " + cases.size() + " ");
+ LogUtil.APP.info("ǰƻжȡ " + cases.size() + " ");
LogOperation.updateTaskExecuteStatus(taskId, cases.size());
for (ProjectCase testcase : cases) {
@@ -150,7 +155,7 @@ public class AppTestControl {
if (steps.size() == 0) {
continue;
}
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
try {
//뿪ʼִе
caselog.insertTaskCaseExecute(taskId, taskScheduling.getProjectId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
@@ -161,14 +166,13 @@ public class AppTestControl {
}
} catch (InterruptedException | IOException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
- e.printStackTrace();
+ LogUtil.APP.error("ûִй׳쳣", e);
}
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
}
tastcount = LogOperation.updateTaskExecuteData(taskId, cases.size());
String testtime = LogOperation.getTestTime(taskId);
- luckyclient.publicclass.LogUtil.APP.info("ǰĿ" + projectname + "ԼƻеѾȫִ...");
+ LogUtil.APP.info("ǰĿ" + projectname + "ԼƻеѾȫִ...");
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
HtmlMail.htmlContentFormat(tastcount, taskId, buildstatus, restartstatus, testtime, jobname),
taskId, taskScheduling, tastcount);
@@ -179,11 +183,11 @@ public class AppTestControl {
iosdriver.closeApp();
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿʧܣԶԶ˳ǰJENKINSмĿ");
+ LogUtil.APP.warn("ĿʧܣԶԶ˳ǰJENKINSмĿ");
MailSendInitialization.sendMailInitialization(jobname, "ĿʧܣԶԶ˳ǰȥJENKINS鿴", taskId, taskScheduling, tastcount);
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
+ LogUtil.APP.warn("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
MailSendInitialization.sendMailInitialization(jobname, "ĿTOMCATʧܣԶԶ˳ĿTOMCAT", taskId, taskScheduling, tastcount);
}
//رAppium߳
diff --git a/src/main/java/luckyclient/caserun/exappium/AppiumService.java b/src/main/java/luckyclient/caserun/exappium/AppiumService.java
index ff06cb8..bac3f15 100644
--- a/src/main/java/luckyclient/caserun/exappium/AppiumService.java
+++ b/src/main/java/luckyclient/caserun/exappium/AppiumService.java
@@ -6,12 +6,14 @@ import java.util.Properties;
import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
public class AppiumService extends Thread{
public void run(){
try{
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
File mainjsFile = new File(properties.getProperty("mainjsPath"));
String ip=properties.getProperty("appiumsever");
AppiumServiceBuilder builder =
@@ -24,12 +26,12 @@ public class AppiumService extends Thread{
service.start();
if (service == null || !service.isRunning()){
- luckyclient.publicclass.LogUtil.APP.error("ԶAppiumʧܣ飡");
+ LogUtil.APP.warn("ԶAppiumʧܣ飡");
}else{
- luckyclient.publicclass.LogUtil.APP.info("ԶAppiumɹIP:"+ip.split(":")[0].trim()+" ˿:"+ip.split(":")[1].trim());
+ LogUtil.APP.info("ԶAppiumɹIP:"+ip.split(":")[0].trim()+" ˿:"+ip.split(":")[1].trim());
}
}catch(Exception e){
- luckyclient.publicclass.LogUtil.APP.error("ԶAppium׳쳣飡",e);
+ LogUtil.APP.error("ԶAppium׳쳣飡",e);
}
}
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java
index 9f29174..4f80d7a 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java
@@ -16,6 +16,7 @@ import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.android.AndroidTouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
@@ -32,15 +33,17 @@ public class AndroidBaseAppium {
/**
* ֻͼ
+ *
* @param appium
* @param imagname
* @throws IOException
*/
- public static void screenShot(AndroidDriver appium, String imagname){
+ public static void screenShot(AndroidDriver appium, String imagname) {
imagname = imagname + ".png";
String relativelyPath = System.getProperty("user.dir");
- String pngpath=relativelyPath +File.separator+ "log"+File.separator+"ScreenShot" +File.separator+ imagname;
-
+ String pngpath = relativelyPath + File.separator + "log" + File.separator + "ScreenShot" + File.separator
+ + imagname;
+
try {
try {
Thread.sleep(3000);
@@ -52,13 +55,12 @@ public class AndroidBaseAppium {
File screenFile = new File(pngpath);
FileUtils.copyFile(imageFile, screenFile);
imageFile.deleteOnExit();
- luckyclient.publicclass.LogUtil.APP
- .info("ѶԵǰнͼִͨн־ϸ鿴Ҳǰͻϲ鿴..." + pngpath + "");
+ LogUtil.APP.info("ѶԵǰнͼִͨн־ϸ鿴Ҳǰͻϲ鿴..." + pngpath + "");
} catch (IOException e) {
e.printStackTrace();
}
}
-
+
/**
* @param args
* @throws IOException
@@ -72,10 +74,10 @@ public class AndroidBaseAppium {
/**
* @param args
- * js webview ֧4.14.4
+ * js webview ֧4.14.4
*/
- public static void webViewSwipe(AndroidDriver appium, Double sX, Double sY, Double eX, Double eY, Double duration)
- throws Exception {
+ public static void webViewSwipe(AndroidDriver appium, Double sX, Double sY, Double eX, Double eY,
+ Double duration) throws Exception {
JavascriptExecutor js;
HashMap swipeObject;
try {
@@ -100,9 +102,10 @@ public class AndroidBaseAppium {
/**
* @param args
- * ADBֱӻ ֧4.14.4
+ * ADBֱӻ ֧4.14.4
*/
- public static void adbSwipe(AndroidDriver appium, Double sX, Double sY, Double eX, Double eY) throws Exception {
+ public static void adbSwipe(AndroidDriver appium, Double sX, Double sY, Double eX, Double eY)
+ throws Exception {
int xLine;
int yLine;
int sX2;
@@ -143,12 +146,15 @@ public class AndroidBaseAppium {
tapObject.put("duration", duration);
js.executeScript("mobile: tap", tapObject);
}
-
+
/**
* סҳ水Ļϻ(ָ£ҳ)
+ *
* @param driver
- * @param second ʱ
- * @param num
+ * @param second
+ * ʱ
+ * @param num
+ *
*/
public static void swipePageUp(AndroidDriver driver, Double second, int num) {
int nanos = (int) (second * 1000);
@@ -156,7 +162,7 @@ public class AndroidBaseAppium {
int width = driver.manage().window().getSize().width;
int height = driver.manage().window().getSize().height;
AndroidTouchAction action = new AndroidTouchAction(driver);
-
+
for (int i = 0; i <= num; i++) {
action.press(PointOption.point(width / 2, height / 4)).waitAction(WaitOptions.waitOptions(duration))
.moveTo(PointOption.point(width / 2, height / 2)).release().perform();
@@ -165,11 +171,12 @@ public class AndroidBaseAppium {
/**
* סҳ水Ļ»(ָϣҳ)
+ *
* @param driver
* @param second
* @param num
*/
- public static void swipePageDown(AndroidDriver driver,Double second,int num){
+ public static void swipePageDown(AndroidDriver driver, Double second, int num) {
int nanos = (int) (second * 1000);
Duration duration = Duration.ofNanos(nanos);
int width = driver.manage().window().getSize().width;
@@ -183,6 +190,7 @@ public class AndroidBaseAppium {
/**
* סҳ水Ļ(ָҳ)
+ *
* @param driver
* @param second
* @param num
@@ -201,6 +209,7 @@ public class AndroidBaseAppium {
/**
* סҳ水Ļһ(ָңҳ)
+ *
* @param driver
* @param second
* @param num
@@ -216,5 +225,5 @@ public class AndroidBaseAppium {
.moveTo(PointOption.point(width - 10, height / 2)).release().perform();
}
}
-
+
}
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java
index 7fe54d7..21a2b41 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java
@@ -12,6 +12,8 @@ import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -38,7 +40,7 @@ public class AndroidBatchExecute {
AndroidDriver ad = null;
AppiumService as=null;
try {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
//ԶAppiume
if(Boolean.valueOf(properties.getProperty("autoRunAppiumService"))){
as =new AppiumService();
@@ -67,7 +69,7 @@ public class AndroidBatchExecute {
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
@@ -82,7 +84,7 @@ public class AndroidBatchExecute {
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java
index b206cae..478c63f 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java
@@ -80,10 +80,10 @@ public class AndroidCaseExecution extends TestCaseExecution{
if (0 != stepresult) {
setcaseresult = stepresult;
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
}
}
}
@@ -91,10 +91,10 @@ public class AndroidCaseExecution extends TestCaseExecution{
variable.clear();
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
if(setcaseresult==0){
- luckyclient.publicclass.LogUtil.APP.info(""+testcase.getCaseSign()+"ȫִнɹ...");
+ LogUtil.APP.info(""+testcase.getCaseSign()+"ȫִнɹ...");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȫִнɹ","info", "ending","");
}else{
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ִйʧܻ...鿴ԭ"+casenote);
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ִйʧܻ...鿴ԭ"+casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ִйʧܻ"+casenote,"error", "ending","");
}
//LogOperation.UpdateTastdetail(taskid, 0);
@@ -119,11 +119,11 @@ public class AndroidCaseExecution extends TestCaseExecution{
operation=ChangString.changparams(operation, variable,"");
operationValue=ChangString.changparams(operationValue, variable,"");
- luckyclient.publicclass.LogUtil.APP.info("νɣȴж......");
+ LogUtil.APP.info("νɣȴж......");
caselog.insertTaskCaseLog(taskid, caseId, ":"+operation+"; ֵ:"+operationValue,"info", String.valueOf(stepno),"");
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ν׳쳣---"+e.getMessage());
+ LogUtil.APP.error("ν׳쳣---"+e.getMessage());
return "ִʧܣʧ!";
}
@@ -145,7 +145,7 @@ public class AndroidCaseExecution extends TestCaseExecution{
ae = isElementExist(appium, property, propertyValue);
// жϴԪǷ
if (null==ae) {
- luckyclient.publicclass.LogUtil.APP.error("λʧܣisElementExistΪnull!");
+ LogUtil.APP.warn("λʧܣisElementExistΪnull!");
return "ִʧܣisElementExistλԪعʧܣ";
}
@@ -165,11 +165,11 @@ public class AndroidCaseExecution extends TestCaseExecution{
result = AndroidEncapsulateOperation.driverOperation(appium, operation, operationValue);
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("Ԫزʧܣ");
+ LogUtil.APP.warn("Ԫزʧܣ");
result = "ִʧܣԪزʧܣ";
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣"+e.getMessage());
+ LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣"+e.getMessage());
return "ִʧܣԪضλ̻Dzʧܻ쳣" + e.getMessage();
}
caselog.insertTaskCaseLog(taskid, caseId, result,"info", String.valueOf(stepno),"");
@@ -221,7 +221,7 @@ public class AndroidCaseExecution extends TestCaseExecution{
return ae;
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ǰλʧܣ"+e.getMessage());
+ LogUtil.APP.error("ǰλʧܣ"+e.getMessage());
return null;
}
@@ -236,19 +236,19 @@ public class AndroidCaseExecution extends TestCaseExecution{
if (null != result && !result.contains("ִʧܣ")) {
// Ԥڽ
if (null != expect && !expect.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("Ϊ" + expect + "");
+ LogUtil.APP.info("Ϊ" + expect + "");
// ֵģʽ
if (expect.length() > ASSIGNMENT_SIGN.length() && expect.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expect.substring(ASSIGNMENT_SIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ֵȫֱ
else if (expect.length() > ASSIGNMENT_GLOBALSIGN.length() && expect.startsWith(ASSIGNMENT_GLOBALSIGN)) {
variable.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
ParamsManageForSteps.GLOBAL_VARIABLE.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ƶ UIģʽ
@@ -258,13 +258,13 @@ public class AndroidCaseExecution extends TestCaseExecution{
AndroidElement ae = isElementExist(appium, checkproperty, checkPropertyValue);
if (null != ae) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳҵԤڽжǰִгɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжִʧܣ";
setresult = 1;
AndroidBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳûҵԤڽжǰִʧܣ" + "checkproperty" + checkproperty + " checkproperty_value" + checkPropertyValue + "", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -273,13 +273,13 @@ public class AndroidCaseExecution extends TestCaseExecution{
// ģƥԤڽģʽ
if (expect.length() > FUZZY_MATCHING_SIGN.length() && expect.startsWith(FUZZY_MATCHING_SIGN)) {
if (result.contains(expect.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽɹִн" + result, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ģƥԤڽʧܣ";
setresult = 1;
AndroidBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -288,26 +288,26 @@ public class AndroidCaseExecution extends TestCaseExecution{
Pattern pattern = Pattern.compile(expect.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(result);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ƥԤڽʧܣ";
setresult = 1;
AndroidBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
// ȷƥԤڽģʽ
else {
if (expect.equals(result)) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ȷƥԤڽʧܣ";
setresult = 1;
AndroidBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -317,15 +317,11 @@ public class AndroidCaseExecution extends TestCaseExecution{
casenote = (null != result) ? result : "";
setresult = 2;
AndroidBaseAppium.screenShot(appium, imagname);
- LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ǰִйн|λԪ|ʧܣ" + casenote, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
return setresult;
}
-
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
}
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java
index 310e820..7fd643a 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java
@@ -7,6 +7,7 @@ import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -33,13 +34,13 @@ public class AndroidCaseLocalDebug {
ProjectCase testcase = GetServerAPI.cgetCaseBysign(testCaseExternalId);
List pcplist = GetServerAPI
.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testCaseExternalId + "......");
+ LogUtil.APP.info("ʼִ" + testCaseExternalId + "......");
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
AndroidCaseExecution.caseExcution(testcase, steps, "888888", androiddriver, caselog, pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
@@ -57,7 +58,7 @@ public class AndroidCaseLocalDebug {
System.out.println("ǰܹ"+addtestcase.size());
for(String testCaseExternalId:addtestcase) {
try {
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ʼ÷Ŀ" + projectname + "ţ" + testCaseExternalId);
oneCasedebug(androiddriver, testCaseExternalId);
} catch (Exception e) {
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java
index 857b9a3..030eb04 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java
@@ -17,6 +17,7 @@ import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.ElementOption;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.caserun.publicdispose.ChangString;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
@@ -38,20 +39,20 @@ public class AndroidEncapsulateOperation {
switch (operation) {
case "selectbyvisibletext":
select.selectByVisibleText(operationValue);
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ͨVisibleTextѡ...VisibleTextֵ:" + operationValue + "");
break;
case "selectbyvalue":
select.selectByValue(operationValue);
- luckyclient.publicclass.LogUtil.APP.info("ͨValueѡ...Valueֵ:" + operationValue + "");
+ LogUtil.APP.info("ͨValueѡ...Valueֵ:" + operationValue + "");
break;
case "selectbyindex":
select.selectByIndex(Integer.valueOf(operationValue));
- luckyclient.publicclass.LogUtil.APP.info("ͨIndexѡ...Indexֵ:" + operationValue + "");
+ LogUtil.APP.info("ͨIndexѡ...Indexֵ:" + operationValue + "");
break;
case "isselect":
result = "ȡֵǡ" + ae.isSelected() + "";
- luckyclient.publicclass.LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + ae.isSelected() + "");
+ LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + ae.isSelected() + "");
break;
default:
break;
@@ -65,20 +66,20 @@ public class AndroidEncapsulateOperation {
switch (operation) {
case "gettext":
result = "ȡֵǡ" + ae.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
+ LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
break; // ȡ
case "gettagname":
result = "ȡֵǡ" + ae.getTagName() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
+ LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
break;
case "getattribute":
result = "ȡֵǡ" + ae.getAttribute(value) + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("getAttributeȡ" + value + "..." + value + "ֵ:" + result + "");
break;
case "getcssvalue":
result = "ȡֵǡ" + ae.getCssValue(value) + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("getCssValueȡ" + value + "..." + value + "ֵ:" + result + "");
break;
default:
@@ -97,35 +98,35 @@ public class AndroidEncapsulateOperation {
case "click":
ae.click();
result = "click...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("click...λ:" + property + "; λֵ:" + propertyValue + "");
break;
case "sendkeys":
ae.sendKeys(operationValue);
result = "sendKeys...λ:" + property + "; λֵ:" + propertyValue + "; ֵ:" + operationValue
+ "";
- luckyclient.publicclass.LogUtil.APP.info("sendkeys...λ:" + property + "; λֵ:" + propertyValue
+ LogUtil.APP.info("sendkeys...λ:" + property + "; λֵ:" + propertyValue
+ "; ֵ:" + operationValue + "");
break;
case "clear":
ae.clear();
result = "clear...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("clear...λ:" + property + "; λֵ:" + propertyValue + "");
break; //
case "isenabled":
result = "ȡֵǡ" + ae.isEnabled() + "";
- luckyclient.publicclass.LogUtil.APP.info("ǰжǷòֵΪ" + ae.isEnabled() + "");
+ LogUtil.APP.info("ǰжǷòֵΪ" + ae.isEnabled() + "");
break;
case "isdisplayed":
result = "ȡֵǡ" + ae.isDisplayed() + "";
- luckyclient.publicclass.LogUtil.APP.info("ǰжǷɼֵΪ" + ae.isDisplayed() + "");
+ LogUtil.APP.info("ǰжǷɼֵΪ" + ae.isDisplayed() + "");
break;
case "exjsob":
JavascriptExecutor jse = (JavascriptExecutor) appium;
jse.executeScript(operationValue, ae);
result = "ִJS..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info("ִJS..." + operationValue + "");
+ LogUtil.APP.info("ִJS..." + operationValue + "");
break;
case "longpresselement":
LongPressOptions lpoptions = new LongPressOptions();
@@ -138,7 +139,7 @@ public class AndroidEncapsulateOperation {
action.longPress(lpoptions).release().perform();
result = "longpresselementĻָԪϰס" + operationValue + "...λ:" + property + "; λֵ:"
+ propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
default:
break;
@@ -152,15 +153,15 @@ public class AndroidEncapsulateOperation {
switch (operation) {
case "alertaccept":
alert.accept();
- luckyclient.publicclass.LogUtil.APP.info("ͬ...");
+ LogUtil.APP.info("ͬ...");
break;
case "alertdismiss":
alert.dismiss();
- luckyclient.publicclass.LogUtil.APP.info("ȡ...");
+ LogUtil.APP.info("ȡ...");
break;
case "alertgettext":
result = "ȡֵǡ" + alert.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
+ LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
break;
default:
break;
@@ -188,25 +189,25 @@ public class AndroidEncapsulateOperation {
}
handlenum++;
}
- luckyclient.publicclass.LogUtil.APP.info("getContextȡھ..." + result);
+ LogUtil.APP.info("getContextȡھ..." + result);
break;
case "exjs":
JavascriptExecutor jse = (JavascriptExecutor) appium;
jse.executeScript(operationValue);
result = "ִJS..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info("ִJS..." + operationValue + "");
+ LogUtil.APP.info("ִJS..." + operationValue + "");
break;
case "exAdbShell":
Runtime.getRuntime().exec(operationValue);
result = "ִаadb..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info("ִаadb..." + operationValue + "");
+ LogUtil.APP.info("ִаadb..." + operationValue + "");
break;
case "keycode":
// ģֻ
if (ChangString.isNumeric(operationValue)) {
appium.pressKeyCode(Integer.valueOf(operationValue));
result = "ģ̷ָֻ...keycode" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
}
@@ -215,7 +216,7 @@ public class AndroidEncapsulateOperation {
case "hidekeyboard":
appium.hideKeyboard();
result = "ֻ...hideKeyboard";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "gotocontext":
Set ctNames = appium.getContextHandles();
@@ -229,19 +230,19 @@ public class AndroidEncapsulateOperation {
}
if (flag == 1) {
result = "лcontext" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "лcontextʧܣδҵcontextNameֵΪ" + operationValue + "Ķ";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "getcontext":
result = "ȡֵǡ" + appium.getContext() + "";
- luckyclient.publicclass.LogUtil.APP.info("ȡҳContext..." + appium.getContext() + "");
+ LogUtil.APP.info("ȡҳContext..." + appium.getContext() + "");
break;
case "gettitle":
result = "ȡֵǡ" + appium.getTitle() + "";
- luckyclient.publicclass.LogUtil.APP.info("ȡҳgettitle..." + appium.getTitle() + "");
+ LogUtil.APP.info("ȡҳgettitle..." + appium.getTitle() + "");
break;
case "swipeup":
String[] tempup = operationValue.split("\\|", -1);
@@ -251,14 +252,14 @@ public class AndroidEncapsulateOperation {
int num = Integer.valueOf(tempup[1]);
AndroidBaseAppium.swipePageUp(appium, second, num);
result = "swipeupҳϻ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipeupҳϻжϴ쳣" + tempup[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipeupҳϻжʱ쳣" + tempup[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipedown":
@@ -269,14 +270,14 @@ public class AndroidEncapsulateOperation {
int num = Integer.valueOf(tempdown[1]);
AndroidBaseAppium.swipePageDown(appium, second, num);
result = "swipedownҳ»...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipedownҳ»жϴ쳣" + tempdown[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipedownҳ»жʱ쳣" + tempdown[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipleft":
@@ -287,14 +288,14 @@ public class AndroidEncapsulateOperation {
int num = Integer.valueOf(templeft[1]);
AndroidBaseAppium.swipePageLeft(appium, second, num);
result = "swipleftҳ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipleftҳжϴ쳣" + templeft[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipleftҳжʱ쳣" + templeft[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipright":
@@ -305,14 +306,14 @@ public class AndroidEncapsulateOperation {
int num = Integer.valueOf(tempright[1]);
AndroidBaseAppium.swipePageRight(appium, second, num);
result = "swiprightҳһ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swiprightҳһжϴ쳣" + tempright[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swiprightҳһжʱ쳣" + tempright[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "longpressxy":
@@ -330,19 +331,19 @@ public class AndroidEncapsulateOperation {
action.longPress(lpoptions).release().perform();
result = "longpressxyĻָXYϰס" + longpressxy[2] + "...X|Y" + longpressx + "|" + longpressy
+ "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
action.longPress(PointOption.point(longpressx, longpressy)).release().perform();
result = "longpressxyĻָXYϳ...X|Y" + longpressx + "|" + longpressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "longpressxyָY괦쳣" + longpressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "longpressxyָX괦쳣" + longpressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "pressxy":
@@ -353,14 +354,14 @@ public class AndroidEncapsulateOperation {
int pressy = Integer.valueOf(pressxy[1]);
action.press(PointOption.point(pressx, pressy)).release().perform();
result = "pressxyĻָXYϵ...X|Y" + pressx + "|" + pressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "pressxyָY괦쳣" + pressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "pressxyָX괦쳣" + pressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "tapxy":
@@ -371,14 +372,14 @@ public class AndroidEncapsulateOperation {
int tapy = Integer.valueOf(tapxy[1]);
action.tap(PointOption.point(tapx, tapy)).release().perform();
result = "tapxyĻָXY...X|Y" + tapx + "|" + tapy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "tapxyָY괦쳣" + tapxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "tapxyָX괦쳣" + tapxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "jspressxy":
@@ -390,19 +391,19 @@ public class AndroidEncapsulateOperation {
if (null != jspressxy[2] && ChangString.isNumeric(jspressxy[2])) {
AndroidBaseAppium.clickScreenForJs(appium, jspressx, jspressy, Integer.valueOf(jspressxy[2]));
result = "jspressxyĻָXYϰ" + jspressxy[2] + "...X|Y" + jspressx + "|" + jspressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
AndroidBaseAppium.clickScreenForJs(appium, jspressx, jspressy, 2);
result = "jspressxyĻָXYϰ2(ʱж쳣ʹĬ2ʱ)...X|Y" + jspressx + "|" + jspressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "jspressxyָY괦쳣" + jspressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "jspressxyָX괦쳣" + jspressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "moveto":
@@ -421,34 +422,34 @@ public class AndroidEncapsulateOperation {
action.press(PointOption.point(startx, starty))
.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx, endy));
- luckyclient.publicclass.LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ "϶" + endxy[0] + "," + endxy[1] + "");
} else {
if (movexyi == 1) {
action.press(PointOption.point(startx, starty))
.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx - startx, endy - starty));
- luckyclient.publicclass.LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ "϶" + endxy[0] + "," + endxy[1] + "");
} else {
action.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx - startx, endy - starty));
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("" + movexyi + "϶" + endxy[0] + "," + endxy[1] + "");
}
startx = endx;
starty = endy;
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("жϽλó쳣" + movexy[movexyi] + "");
+ LogUtil.APP.warn("жϽλó쳣" + movexy[movexyi] + "");
}
}
action.release().perform();
result = "movetoȫ϶ͷŲɷ...ʼλá" + startxy[0] + "," + startxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "movetoָʼ괦쳣" + movexy[0] + ",飡";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "timeout":
@@ -458,10 +459,10 @@ public class AndroidEncapsulateOperation {
// Ԫسʱ30
appium.manage().timeouts().implicitlyWait(Integer.valueOf(operationValue), TimeUnit.SECONDS);
result = "ȫҳ&Ԫسȴʱ䡾" + operationValue + "...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "ȴʱת";
- luckyclient.publicclass.LogUtil.APP.info(result + "ԭΪжĵȴʱ䲻...");
+ LogUtil.APP.info(result + "ԭΪжĵȴʱ䲻...");
}
break;
case "screenshot":
@@ -469,7 +470,7 @@ public class AndroidEncapsulateOperation {
String imagname = "FunctionScreenShot_" + timeformat.format(new Date());
AndroidBaseAppium.screenShot(appium, imagname);
result = "ͼơ" + imagname + "...";
- luckyclient.publicclass.LogUtil.APP.info("ʹ÷ȡǰĻ..." + result);
+ LogUtil.APP.info("ʹ÷ȡǰĻ..." + result);
break;
default:
break;
diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java
index aa3514f..c16da8f 100644
--- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java
+++ b/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java
@@ -11,6 +11,8 @@ import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -37,7 +39,7 @@ public class AndroidOneCaseExecute {
AndroidDriver ad = null;
AppiumService as=null;
try {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
//ԶAppiume
if(Boolean.valueOf(properties.getProperty("autoRunAppiumService"))){
as =new AppiumService();
@@ -47,7 +49,7 @@ public class AndroidOneCaseExecute {
ad = AppiumInitialization.setAndroidAppium(properties);
} catch (IOException e1) {
- luckyclient.publicclass.LogUtil.APP.error("ʼAndroidDriver", e1);
+ LogUtil.APP.error("ʼAndroidDriver", e1);
e1.printStackTrace();
}
LogOperation caselog = new LogOperation();
@@ -55,13 +57,13 @@ public class AndroidOneCaseExecute {
ProjectCase testcase = GetServerAPI.cGetCaseByCaseId(caseId);
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List pcplist = GetServerAPI.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
try {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
} catch (InterruptedException e) {
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
LogOperation.updateTaskExecuteData(taskid, 0);
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java
index 3625bb4..2564eeb 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java
@@ -16,15 +16,14 @@ import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.ios.IOSTouchAction;
import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.PointOption;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
* ΪߵͶɹLuckyFrameؼȨϢϽ۸ κʻӭϵۡ QQ:1573584944 seagull1985
* =================================================================
- *
- * @author seagull
- *
+ * @author seagull
* @date 201822
*
*/
@@ -51,7 +50,7 @@ public class IosBaseAppium {
File screenFile = new File(pngpath);
FileUtils.copyFile(imageFile, screenFile);
imageFile.deleteOnExit();
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ѶԵǰнͼִͨн־ϸ鿴Ҳǰͻϲ鿴..." + pngpath + "");
} catch (IOException e) {
e.printStackTrace();
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java
index e98afb7..bcabab6 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java
@@ -12,6 +12,8 @@ import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -22,10 +24,8 @@ import luckyclient.serverapi.entity.TaskExecute;
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
* ΪߵͶɹLuckyFrameؼȨϢϽ۸ κʻӭϵۡ QQ:1573584944 seagull1985
- * =================================================================
- *
- * @author seagull
- *
+ * =================================================================
+ * @author seagull
* @date 201822
*
*/
@@ -38,7 +38,7 @@ public class IosBatchExecute {
IOSDriver iosd = null;
AppiumService as=null;
try {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
//ԶAppiume
if(Boolean.valueOf(properties.getProperty("autoRunAppiumService"))){
as =new AppiumService();
@@ -67,7 +67,7 @@ public class IosBatchExecute {
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
@@ -82,7 +82,7 @@ public class IosBatchExecute {
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java
index 9ae11b2..7cc04e3 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java
@@ -81,10 +81,10 @@ public class IosCaseExecution extends TestCaseExecution{
if (0 != stepresult) {
setcaseresult = stepresult;
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
}
}
@@ -93,10 +93,10 @@ public class IosCaseExecution extends TestCaseExecution{
variable.clear();
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
if(setcaseresult==0){
- luckyclient.publicclass.LogUtil.APP.info(""+testcase.getCaseSign()+"ȫִнɹ...");
+ LogUtil.APP.info(""+testcase.getCaseSign()+"ȫִнɹ...");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȫִнɹ","info", "ending","");
}else{
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ִйʧܻ...鿴ԭ"+casenote);
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ִйʧܻ...鿴ԭ"+casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ִйʧܻ"+casenote,"error", "ending","");
}
//LogOperation.UpdateTastdetail(taskid, 0);
@@ -121,11 +121,11 @@ public class IosCaseExecution extends TestCaseExecution{
operation=ChangString.changparams(operation, variable,"");
operationValue=ChangString.changparams(operationValue, variable,"");
- luckyclient.publicclass.LogUtil.APP.info("νɣȴж......");
+ LogUtil.APP.info("νɣȴж......");
caselog.insertTaskCaseLog(taskid, caseId, ":"+operation+"; ֵ:"+operationValue,"info", String.valueOf(stepno),"");
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ν׳쳣---"+e.getMessage());
+ LogUtil.APP.error("ν׳쳣---"+e.getMessage());
return "ִʧܣʧ!";
}
@@ -147,7 +147,7 @@ public class IosCaseExecution extends TestCaseExecution{
ae = isElementExist(appium, property, propertyValue);
// жϴԪǷ
if (null==ae) {
- luckyclient.publicclass.LogUtil.APP.error("λʧܣisElementExistΪnull!");
+ LogUtil.APP.warn("λʧܣisElementExistΪnull!");
return "ִʧܣisElementExistλԪعʧܣ";
}
@@ -167,11 +167,11 @@ public class IosCaseExecution extends TestCaseExecution{
result = IosEncapsulateOperation.driverOperation(appium, operation, operationValue);
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("Ԫزʧܣ");
+ LogUtil.APP.warn("Ԫزʧܣ");
result = "ִʧܣԪزʧܣ";
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣"+e.getMessage());
+ LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣"+e.getMessage());
return "ִʧܣԪضλ̻Dzʧܻ쳣" + e.getMessage();
}
caselog.insertTaskCaseLog(taskid, caseId, result,"info", String.valueOf(stepno),"");
@@ -229,7 +229,7 @@ public class IosCaseExecution extends TestCaseExecution{
return ae;
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ǰλʧܣ"+e.getMessage());
+ LogUtil.APP.error("ǰλʧܣ"+e.getMessage());
return null;
}
@@ -244,19 +244,19 @@ public class IosCaseExecution extends TestCaseExecution{
if (null != result && !result.contains("ִʧܣ")) {
// Ԥڽ
if (null != expect && !expect.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("Ϊ" + expect + "");
+ LogUtil.APP.info("Ϊ" + expect + "");
// ֵģʽ
if (expect.length() > ASSIGNMENT_SIGN.length() && expect.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expect.substring(ASSIGNMENT_SIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ֵȫֱ
else if (expect.length() > ASSIGNMENT_GLOBALSIGN.length() && expect.startsWith(ASSIGNMENT_GLOBALSIGN)) {
variable.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
ParamsManageForSteps.GLOBAL_VARIABLE.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ƶ UIģʽ
@@ -266,13 +266,13 @@ public class IosCaseExecution extends TestCaseExecution{
IOSElement ae = isElementExist(appium, checkproperty, checkPropertyValue);
if (null != ae) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳҵԤڽжǰִгɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжִʧܣ";
setresult = 1;
IosBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳûҵԤڽжǰִʧܣ" + "checkproperty" + checkproperty + " checkproperty_value" + checkPropertyValue + "", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -281,13 +281,13 @@ public class IosCaseExecution extends TestCaseExecution{
// ģƥԤڽģʽ
if (expect.length() > FUZZY_MATCHING_SIGN.length() && expect.startsWith(FUZZY_MATCHING_SIGN)) {
if (result.contains(expect.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽɹִн" + result, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ģƥԤڽʧܣ";
setresult = 1;
IosBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -296,26 +296,26 @@ public class IosCaseExecution extends TestCaseExecution{
Pattern pattern = Pattern.compile(expect.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(result);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ƥԤڽʧܣ";
setresult = 1;
IosBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
// ȷƥԤڽģʽ
else {
if (expect.equals(result)) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ȷƥԤڽʧܣ";
setresult = 1;
IosBaseAppium.screenShot(appium, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -325,7 +325,7 @@ public class IosCaseExecution extends TestCaseExecution{
casenote = (null != result) ? result : "";
setresult = 2;
IosBaseAppium.screenShot(appium, imagname);
- LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ǰִйн|λԪ|ʧܣ" + casenote, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java
index 13b0439..421ced9 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java
@@ -7,6 +7,7 @@ import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -33,13 +34,13 @@ public class IosCaseLocalDebug {
ProjectCase testcase = GetServerAPI.cgetCaseBysign(testCaseExternalId);
List pcplist = GetServerAPI
.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testCaseExternalId + "......");
+ LogUtil.APP.info("ʼִ" + testCaseExternalId + "......");
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
IosCaseExecution.caseExcution(testcase, steps, "888888", iosdriver, caselog, pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
@@ -55,7 +56,7 @@ public class IosCaseLocalDebug {
System.out.println("ǰܹ"+addtestcase.size());
for(String testCaseExternalId:addtestcase) {
try {
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ʼ÷Ŀ" + projectname + "ţ" + testCaseExternalId);
oneCasedebug(iosdriver, testCaseExternalId);
} catch (Exception e) {
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java
index eb93e4f..518421d 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java
@@ -17,6 +17,7 @@ import io.appium.java_client.touch.WaitOptions;
import io.appium.java_client.touch.offset.ElementOption;
import io.appium.java_client.touch.offset.PointOption;
import luckyclient.caserun.publicdispose.ChangString;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
@@ -38,20 +39,20 @@ public class IosEncapsulateOperation {
switch (operation) {
case "selectbyvisibletext":
select.selectByVisibleText(operationValue);
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ͨVisibleTextѡ...VisibleTextֵ:" + operationValue + "");
break;
case "selectbyvalue":
select.selectByValue(operationValue);
- luckyclient.publicclass.LogUtil.APP.info("ͨValueѡ...Valueֵ:" + operationValue + "");
+ LogUtil.APP.info("ͨValueѡ...Valueֵ:" + operationValue + "");
break;
case "selectbyindex":
select.selectByIndex(Integer.valueOf(operationValue));
- luckyclient.publicclass.LogUtil.APP.info("ͨIndexѡ...Indexֵ:" + operationValue + "");
+ LogUtil.APP.info("ͨIndexѡ...Indexֵ:" + operationValue + "");
break;
case "isselect":
result = "ȡֵǡ" + ie.isSelected() + "";
- luckyclient.publicclass.LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + ie.isSelected() + "");
+ LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + ie.isSelected() + "");
break;
default:
break;
@@ -65,20 +66,20 @@ public class IosEncapsulateOperation {
switch (operation) {
case "gettext":
result = "ȡֵǡ" + ie.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
+ LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
break; // ȡ
case "gettagname":
result = "ȡֵǡ" + ie.getTagName() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
+ LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
break;
case "getattribute":
result = "ȡֵǡ" + ie.getAttribute(value) + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("getAttributeȡ" + value + "..." + value + "ֵ:" + result + "");
break;
case "getcssvalue":
result = "ȡֵǡ" + ie.getCssValue(value) + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("getCssValueȡ" + value + "..." + value + "ֵ:" + result + "");
break;
default:
@@ -96,35 +97,35 @@ public class IosEncapsulateOperation {
case "click":
ie.click();
result = "click...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("click...λ:" + property + "; λֵ:" + propertyValue + "");
break;
case "sendkeys":
ie.sendKeys(operationValue);
result = "sendKeys...λ:" + property + "; λֵ:" + propertyValue + "; ֵ:" + operationValue
+ "";
- luckyclient.publicclass.LogUtil.APP.info("sendkeys...λ:" + property + "; λֵ:" + propertyValue
+ LogUtil.APP.info("sendkeys...λ:" + property + "; λֵ:" + propertyValue
+ "; ֵ:" + operationValue + "");
break;
case "clear":
ie.clear();
result = "clear...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("clear...λ:" + property + "; λֵ:" + propertyValue + "");
break; //
case "isenabled":
result = "ȡֵǡ" + ie.isEnabled() + "";
- luckyclient.publicclass.LogUtil.APP.info("ǰжǷòֵΪ" + ie.isEnabled() + "");
+ LogUtil.APP.info("ǰжǷòֵΪ" + ie.isEnabled() + "");
break;
case "isdisplayed":
result = "ȡֵǡ" + ie.isDisplayed() + "";
- luckyclient.publicclass.LogUtil.APP.info("ǰжǷɼֵΪ" + ie.isDisplayed() + "");
+ LogUtil.APP.info("ǰжǷɼֵΪ" + ie.isDisplayed() + "");
break;
case "exjsob":
JavascriptExecutor jse = (JavascriptExecutor) appium;
jse.executeScript(operationValue, ie);
result = "ִJS..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info("ִJS..." + operationValue + "");
+ LogUtil.APP.info("ִJS..." + operationValue + "");
break;
case "longpresselement":
LongPressOptions lpoptions = new LongPressOptions();
@@ -137,7 +138,7 @@ public class IosEncapsulateOperation {
action.longPress(lpoptions).release().perform();
result = "longpresselementĻָԪϰס" + operationValue + "...λ:" + property + "; λֵ:"
+ propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
default:
break;
@@ -151,15 +152,15 @@ public class IosEncapsulateOperation {
switch (operation) {
case "alertaccept":
alert.accept();
- luckyclient.publicclass.LogUtil.APP.info("ͬ...");
+ LogUtil.APP.info("ͬ...");
break;
case "alertdismiss":
alert.dismiss();
- luckyclient.publicclass.LogUtil.APP.info("ȡ...");
+ LogUtil.APP.info("ȡ...");
break;
case "alertgettext":
result = "ȡֵǡ" + alert.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
+ LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
break;
default:
break;
@@ -187,19 +188,19 @@ public class IosEncapsulateOperation {
}
handlenum++;
}
- luckyclient.publicclass.LogUtil.APP.info("getContextȡھ..." + result);
+ LogUtil.APP.info("getContextȡھ..." + result);
break;
case "exjs":
JavascriptExecutor jse = (JavascriptExecutor) appium;
jse.executeScript(operationValue);
result = "ִJS..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info("ִJS..." + operationValue + "");
+ LogUtil.APP.info("ִJS..." + operationValue + "");
break;
// ֻ
case "hideKeyboard":
appium.hideKeyboard();
result = "ֻ...hideKeyboard";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "gotocontext":
Set ctNames = appium.getContextHandles();
@@ -213,19 +214,19 @@ public class IosEncapsulateOperation {
}
if (flag == 1) {
result = "лcontext" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "лcontextʧܣδҵcontextNameֵΪ" + operationValue + "Ķ";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "getcontext":
result = "ȡֵǡ" + appium.getContext() + "";
- luckyclient.publicclass.LogUtil.APP.info("ȡҳContext..." + appium.getContext() + "");
+ LogUtil.APP.info("ȡҳContext..." + appium.getContext() + "");
break;
case "gettitle":
result = "ȡֵǡ" + appium.getTitle() + "";
- luckyclient.publicclass.LogUtil.APP.info("ȡҳgettitle..." + appium.getTitle() + "");
+ LogUtil.APP.info("ȡҳgettitle..." + appium.getTitle() + "");
break;
case "swipeup":
String[] tempup = operationValue.split("\\|", -1);
@@ -235,14 +236,14 @@ public class IosEncapsulateOperation {
int num = Integer.valueOf(tempup[1]);
IosBaseAppium.swipePageUp(appium, second, num);
result = "swipeupҳϻ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipeupҳϻжϴ쳣" + tempup[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipeupҳϻжʱ쳣" + tempup[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipedown":
@@ -253,14 +254,14 @@ public class IosEncapsulateOperation {
int num = Integer.valueOf(tempdown[1]);
IosBaseAppium.swipePageDown(appium, second, num);
result = "swipedownҳ»...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipedownҳ»жϴ쳣" + tempdown[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipedownҳ»жʱ쳣" + tempdown[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipleft":
@@ -271,14 +272,14 @@ public class IosEncapsulateOperation {
int num = Integer.valueOf(templeft[1]);
IosBaseAppium.swipePageLeft(appium, second, num);
result = "swipleftҳ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swipleftҳжϴ쳣" + templeft[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swipleftҳжʱ쳣" + templeft[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "swipright":
@@ -289,14 +290,14 @@ public class IosEncapsulateOperation {
int num = Integer.valueOf(tempright[1]);
IosBaseAppium.swipePageRight(appium, second, num);
result = "swiprightҳһ...|" + second + "|" + num + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "swiprightҳһжϴ쳣" + tempright[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "swiprightҳһжʱ쳣" + tempright[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "longpressxy":
@@ -314,19 +315,19 @@ public class IosEncapsulateOperation {
action.longPress(lpoptions).release().perform();
result = "longpressxyĻָXYϰס" + longpressxy[2] + "...X|Y" + longpressx + "|" + longpressy
+ "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
action.longPress(PointOption.point(longpressx, longpressy)).release().perform();
result = "longpressxyĻָXYϳ...X|Y" + longpressx + "|" + longpressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "longpressxyָY괦쳣" + longpressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "longpressxyָX괦쳣" + longpressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "pressxy":
@@ -337,14 +338,14 @@ public class IosEncapsulateOperation {
int pressy = Integer.valueOf(pressxy[1]);
action.press(PointOption.point(pressx, pressy)).release().perform();
result = "pressxyĻָXYϵ...X|Y" + pressx + "|" + pressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "pressxyָY괦쳣" + pressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "pressxyָX괦쳣" + pressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "tapxy":
@@ -355,14 +356,14 @@ public class IosEncapsulateOperation {
int tapy = Integer.valueOf(tapxy[1]);
action.tap(PointOption.point(tapx, tapy)).release().perform();
result = "tapxyĻָXY...X|Y" + tapx + "|" + tapy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "tapxyָY괦쳣" + tapxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "tapxyָX괦쳣" + tapxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "jspressxy":
@@ -374,19 +375,19 @@ public class IosEncapsulateOperation {
if (null != jspressxy[2] && ChangString.isNumeric(jspressxy[2])) {
IosBaseAppium.clickScreenForJs(appium, jspressx, jspressy, Integer.valueOf(jspressxy[2]));
result = "jspressxyĻָXYϰ" + jspressxy[2] + "...X|Y" + jspressx + "|" + jspressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
IosBaseAppium.clickScreenForJs(appium, jspressx, jspressy, 2);
result = "jspressxyĻָXYϰ2(ʱж쳣ʹĬ2ʱ)...X|Y" + jspressx + "|" + jspressy + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "jspressxyָY괦쳣" + jspressxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
} else {
result = "jspressxyָX괦쳣" + jspressxy[0] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "moveto":
@@ -405,34 +406,34 @@ public class IosEncapsulateOperation {
action.press(PointOption.point(startx, starty))
.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx, endy));
- luckyclient.publicclass.LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ "϶" + endxy[0] + "," + endxy[1] + "");
} else {
if (movexyi == 1) {
action.press(PointOption.point(startx, starty))
.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx - startx, endy - starty));
- luckyclient.publicclass.LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ LogUtil.APP.info("ӿʼ" + startxy[0] + "," + startxy[1]
+ "϶" + endxy[0] + "," + endxy[1] + "");
} else {
action.waitAction(WaitOptions.waitOptions(Duration.ofNanos(1500)))
.moveTo(PointOption.point(endx - startx, endy - starty));
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("" + movexyi + "϶" + endxy[0] + "," + endxy[1] + "");
}
startx = endx;
starty = endy;
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("жϽλó쳣" + movexy[movexyi] + "");
+ LogUtil.APP.warn("жϽλó쳣" + movexy[movexyi] + "");
}
}
action.release().perform();
result = "movetoȫ϶ͷŲɷ...ʼλá" + startxy[0] + "," + startxy[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "movetoָʼ괦쳣" + movexy[0] + ",飡";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
}
break;
case "timeout":
@@ -442,10 +443,10 @@ public class IosEncapsulateOperation {
// Ԫسʱ30
appium.manage().timeouts().implicitlyWait(Integer.valueOf(operationValue), TimeUnit.SECONDS);
result = "ȫҳ&Ԫسȴʱ䡾" + operationValue + "...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
} else {
result = "ȴʱת";
- luckyclient.publicclass.LogUtil.APP.info(result + "ԭΪжĵȴʱ䲻...");
+ LogUtil.APP.info(result + "ԭΪжĵȴʱ䲻...");
}
break;
case "screenshot":
@@ -453,7 +454,7 @@ public class IosEncapsulateOperation {
String imagname = "FunctionScreenShot_" + timeformat.format(new Date());
IosBaseAppium.screenShot(appium, imagname);
result = "ͼơ" + imagname + "...";
- luckyclient.publicclass.LogUtil.APP.info("ʹ÷ȡǰĻ..." + result);
+ LogUtil.APP.info("ʹ÷ȡǰĻ..." + result);
break;
default:
break;
diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java b/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java
index 191a1ff..a18d1d5 100644
--- a/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java
+++ b/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java
@@ -11,6 +11,8 @@ import luckyclient.caserun.exappium.AppiumService;
import luckyclient.caserun.exinterface.TestControl;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.AppiumConfig;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -20,10 +22,8 @@ import luckyclient.serverapi.entity.ProjectCaseSteps;
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
* ΪߵͶɹLuckyFrameؼȨϢϽ۸ κʻӭϵۡ QQ:1573584944 seagull1985
- * =================================================================
- *
- * @author seagull
- *
+ * =================================================================
+ * @author seagull
* @date 201822
*
*/
@@ -37,7 +37,7 @@ public class IosOneCaseExecute {
IOSDriver iosd = null;
AppiumService as=null;
try {
- Properties properties = luckyclient.publicclass.AppiumConfig.getConfiguration();
+ Properties properties = AppiumConfig.getConfiguration();
//ԶAppiume
if(Boolean.valueOf(properties.getProperty("autoRunAppiumService"))){
as =new AppiumService();
@@ -47,7 +47,7 @@ public class IosOneCaseExecute {
iosd = AppiumInitialization.setIosAppium(properties);
} catch (IOException e1) {
- luckyclient.publicclass.LogUtil.APP.error("ʼIOSDriver", e1);
+ LogUtil.APP.error("ʼIOSDriver", e1);
e1.printStackTrace();
}
LogOperation caselog = new LogOperation();
@@ -56,13 +56,13 @@ public class IosOneCaseExecute {
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List pcplist = GetServerAPI.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
try {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
} catch (InterruptedException e) {
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
LogOperation.updateTaskExecuteData(taskid, 0);
diff --git a/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java b/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java
index 25dd0f8..d702bc6 100644
--- a/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java
+++ b/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java
@@ -10,6 +10,7 @@ import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.InvokeMethod;
+import luckyclient.publicclass.LogUtil;
import luckyclient.publicclass.remoterinterface.HttpRequest;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
@@ -56,7 +57,7 @@ public class ApiTestCaseDebug {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
setcaseresult = 2;
- luckyclient.publicclass.LogUtil.APP.error("δҵ裬飡");
+ LogUtil.APP.warn("δҵ裬飡");
testnote = "δҵ裬飡";
}
// ѭв
@@ -70,7 +71,7 @@ public class ApiTestCaseDebug {
functionname = ChangString.changparams(functionname, variable, "");
} catch (Exception e) {
k = 0;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
+ LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
e.printStackTrace();
break; // ijһʧܺΪʧ˳
}
@@ -93,7 +94,7 @@ public class ApiTestCaseDebug {
}
String parameterValues = casescript.get("FunctionParams" + (j + 1));
parameterValues = ChangString.changparams(parameterValues, variable, "");
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename
+ LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename
+ " " + functionname + " " + (j + 1) + "" + parameterValues);
getParameterValues[j] = parameterValues;
}
@@ -102,17 +103,17 @@ public class ApiTestCaseDebug {
}
// öִ̬в
try {
- luckyclient.publicclass.LogUtil.APP.info("ʼ÷" + functionname + " .....");
+ LogUtil.APP.info("ʼ÷" + functionname + " .....");
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues,
steps.get(i).getStepType(), steps.get(i).getExtend());
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
if (null != expectedresults && !expectedresults.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("expectedResults=" + expectedresults + "");
+ LogUtil.APP.info("expectedResults=" + expectedresults + "");
// ֵ
if (expectedresults.length() > ASSIGNMENT_SIGN.length()
&& expectedresults.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expectedresults.substring(ASSIGNMENT_SIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵ"
+ expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
}
@@ -120,19 +121,19 @@ public class ApiTestCaseDebug {
else if (expectedresults.length() > FUZZY_MATCHING_SIGN.length()
&& expectedresults.startsWith(FUZZY_MATCHING_SIGN)) {
if (testnote.contains(expectedresults.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info(
+ LogUtil.APP.info(
"" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽɹִн" + testnote);
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1)
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1)
+ "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length())
+ "Խ" + testnote);
testnote = "" + (i + 1) + "ģƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -142,66 +143,66 @@ public class ApiTestCaseDebug {
Pattern pattern = Pattern.compile(expectedresults.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(testnote);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info(
+ LogUtil.APP.info(
"" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽɹִн" + testnote);
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1)
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1)
+ "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length())
+ "Խ" + testnote);
testnote = "" + (i + 1) + "ƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
// ȫ
else {
if (expectedresults.equals(testnote)) {
- luckyclient.publicclass.LogUtil.APP.info(
+ LogUtil.APP.info(
"" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽɹִн" + testnote);
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1)
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1)
+ "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
testnote = "" + (i + 1) + "ȷƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
}
} catch (Exception e) {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("÷̳" + functionname + " ¼űԼ");
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error("÷̳" + functionname + " ¼űԼ");
+ LogUtil.APP.error(e.getMessage(), e);
testnote = "CallCaseó";
e.printStackTrace();
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
variable.clear(); // մMAP
// ÷δòԽ
if (testnote.indexOf("CallCaseó") <= -1 && testnote.indexOf("") <= -1) {
- luckyclient.publicclass.LogUtil.APP.info(" " + testCaseExternalId + "ɹɹз鿴ִн");
+ LogUtil.APP.info(" " + testCaseExternalId + "ɹɹз鿴ִн");
} else {
- luckyclient.publicclass.LogUtil.APP.error(" " + testCaseExternalId + "ǵòеķ");
+ LogUtil.APP.warn(" " + testCaseExternalId + "ǵòеķ");
}
if (0 == setcaseresult) {
- luckyclient.publicclass.LogUtil.APP.info(" " + testCaseExternalId + "ȫִгɹ");
+ LogUtil.APP.info(" " + testCaseExternalId + "ȫִгɹ");
} else {
- luckyclient.publicclass.LogUtil.APP.error(" " + testCaseExternalId + "ִйʧܣ־");
+ LogUtil.APP.warn(" " + testCaseExternalId + "ִйʧܣ־");
}
}
@@ -215,7 +216,7 @@ public class ApiTestCaseDebug {
System.out.println("ǰܹ"+addtestcase.size());
for(String testCaseExternalId:addtestcase) {
try {
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ʼ÷Ŀ" + projectname + "ţ" + testCaseExternalId);
oneCaseDebug(projectname, testCaseExternalId);
} catch (Exception e) {
diff --git a/src/main/java/luckyclient/caserun/exinterface/TestCaseExecution.java b/src/main/java/luckyclient/caserun/exinterface/TestCaseExecution.java
index 76a0db7..c0d9b35 100644
--- a/src/main/java/luckyclient/caserun/exinterface/TestCaseExecution.java
+++ b/src/main/java/luckyclient/caserun/exinterface/TestCaseExecution.java
@@ -79,7 +79,7 @@ public class TestCaseExecution {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
setcaseresult = 2;
- luckyclient.publicclass.LogUtil.APP.error("δҵ裬飡");
+ LogUtil.APP.warn("δҵ裬飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "δҵ裬飡", "error", "1", "");
testnote = "δҵ裬飡";
}
@@ -93,7 +93,7 @@ public class TestCaseExecution {
functionname = ChangString.changparams(functionname, VARIABLE, "");
} catch (Exception e) {
k = 0;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
+ LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Ƿʧܣ飡", "error", String.valueOf(i + 1), "");
e.printStackTrace();
break; // ijһʧܺΪʧ˳
@@ -118,7 +118,7 @@ public class TestCaseExecution {
String parameterValues = casescript.get("FunctionParams" + (j + 1));
parameterValues = ChangString.changparams(parameterValues, VARIABLE, "");
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
+ LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues, "info", String.valueOf(i + 1), "");
getParameterValues[j] = parameterValues;
}
@@ -127,7 +127,7 @@ public class TestCaseExecution {
}
// öִ̬в
try {
- luckyclient.publicclass.LogUtil.APP.info("ʼ÷" + functionname + " .....");
+ LogUtil.APP.info("ʼ÷" + functionname + " .....");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ʼ÷" + functionname + " .....", "info", String.valueOf(i + 1), "");
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
@@ -137,25 +137,24 @@ public class TestCaseExecution {
if (0 != stepresult) {
setcaseresult = stepresult;
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+steps.get(i).getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+steps.get(i).getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+steps.get(i).getStepSerialNumber()+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+steps.get(i).getStepSerialNumber()+"ִʧܣִУ¸ִ......");
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.error("÷̳" + functionname + " ¼űԼ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "÷̳" + functionname + " ¼űԼ", "error", String.valueOf(i + 1), "");
- luckyclient.publicclass.LogUtil.ERROR.error(e, e);
+ LogUtil.APP.error("÷̳" + functionname + " ¼űԼ", e);
testnote = "CallCaseó";
setcaseresult = 1;
e.printStackTrace();
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -163,20 +162,20 @@ public class TestCaseExecution {
VARIABLE.clear(); // մMAP
// ÷δòԽ
if (!testnote.contains("CallCaseó") && !testnote.contains("")) {
- luckyclient.publicclass.LogUtil.APP.info(" " + testcase.getCaseSign() + "ɹɹз鿴ִн");
+ LogUtil.APP.info(" " + testcase.getCaseSign() + "ɹɹз鿴ִн");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ɹɹз鿴ִн", "info", "SETCASERESULT...", "");
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error(" " + testcase.getCaseSign() + "ǵòеķ");
+ LogUtil.APP.warn(" " + testcase.getCaseSign() + "ǵòеķ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ǵòеķ", "error", "SETCASERESULT...", "");
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 2);
}
if (0 == setcaseresult) {
- luckyclient.publicclass.LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
+ LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȫִгɹ", "info", "EXECUTECASESUC...", "");
} else {
- luckyclient.publicclass.LogUtil.APP.error(" " + testcase.getCaseSign() + "ִйʧܣ־");
+ LogUtil.APP.warn(" " + testcase.getCaseSign() + "ִйʧܣ־");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ִйʧܣ־", "error", "EXECUTECASESUC...", "");
}
LogOperation.updateTaskExecuteData(taskid, 0);
@@ -207,7 +206,7 @@ public class TestCaseExecution {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
setresult = 2;
- luckyclient.publicclass.LogUtil.APP.error("δҵ裬飡");
+ LogUtil.APP.warn("δҵ裬飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "δҵ裬飡", "error", "1", "");
testnote = "δҵ裬飡";
}
@@ -221,7 +220,7 @@ public class TestCaseExecution {
functionname = ChangString.changparams(functionname, variable, "");
} catch (Exception e) {
k = 0;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseId() + "Ƿʧܣ飡");
+ LogUtil.APP.error("" + testcase.getCaseId() + "Ƿʧܣ飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Ƿʧܣ飡", "error", String.valueOf(i + 1), "");
e.printStackTrace();
break; // ijһʧܺΪʧ˳
@@ -245,7 +244,7 @@ public class TestCaseExecution {
}
String parameterValues = casescript.get("FunctionParams" + (j + 1));
parameterValues = ChangString.changparams(parameterValues, variable, "");
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
+ LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues, "info", String.valueOf(i + 1), "");
getParameterValues[j] = parameterValues;
}
@@ -254,25 +253,25 @@ public class TestCaseExecution {
}
// öִ̬в
try {
- luckyclient.publicclass.LogUtil.APP.info("ʼ÷" + functionname + " .....");
+ LogUtil.APP.info("ʼ÷" + functionname + " .....");
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
if (null != expectedresults && !expectedresults.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("expectedResults=" + expectedresults + "");
+ LogUtil.APP.info("expectedResults=" + expectedresults + "");
// ֵ
if (expectedresults.length() > ASSIGNMENT_SIGN.length() && expectedresults.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expectedresults.substring(ASSIGNMENT_SIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
}
// ģƥ
else if (expectedresults.length() > FUZZY_MATCHING_SIGN.length() && expectedresults.startsWith(FUZZY_MATCHING_SIGN)) {
if (testnote.contains(expectedresults.substring(FUZZY_MATCHING_SIGN.length()))) {
setresult = 0;
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽɹִн" + testnote);
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
testnote = "" + (i + 1) + "ģƥԤڽʧܣ";
break; // ijһʧܺΪʧ˳
}
@@ -283,10 +282,10 @@ public class TestCaseExecution {
Matcher matcher = pattern.matcher(testnote);
if (matcher.find()) {
setresult = 0;
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽɹִн" + testnote);
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
testnote = "" + (i + 1) + "ƥԤڽʧܣ";
break; // ijһʧܺΪʧ˳
}
@@ -295,18 +294,17 @@ public class TestCaseExecution {
else {
if (expectedresults.equals(testnote)) {
setresult = 0;
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽɹִн" + testnote);
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
testnote = "" + (i + 1) + "ȷƥԤڽʧܣ";
break; // ijһʧܺΪʧ˳
}
}
}
} catch (Exception e) {
- LogUtil.ERROR.error("÷̳" + functionname + " ¼űԼ");
- LogUtil.ERROR.error(e, e);
+ LogUtil.APP.error("÷̳" + functionname + " ¼űԼ",e);
testnote = "CallCaseó";
setresult = 1;
e.printStackTrace();
@@ -315,9 +313,9 @@ public class TestCaseExecution {
}
variable.clear(); // մMAP
if (0 == setresult) {
- luckyclient.publicclass.LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
+ LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
} else {
- luckyclient.publicclass.LogUtil.APP.error(" " + testcase.getCaseSign() + "ִйʧܣ־");
+ LogUtil.APP.warn(" " + testcase.getCaseSign() + "ִйʧܣ־");
}
return testnote;
}
@@ -348,7 +346,7 @@ public class TestCaseExecution {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
setresult = 2;
- luckyclient.publicclass.LogUtil.APP.error("δҵ裬飡");
+ LogUtil.APP.warn("δҵ裬飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "δҵ裬飡", "error", "1", "");
testnote = "δҵ裬飡";
}
@@ -409,10 +407,10 @@ public class TestCaseExecution {
VARIABLE.clear(); // մMAP
if (0 == setresult) {
testnote = "" + testcase.getCaseSign() + "ִгɹ";
- luckyclient.publicclass.LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
+ LogUtil.APP.info(" " + testcase.getCaseSign() + "ȫִгɹ");
} else {
testnote = "" + testcase.getCaseSign() + "ִʧܣ־";
- luckyclient.publicclass.LogUtil.APP.error(" " + testcase.getCaseSign() + "ִйʧܣ־");
+ LogUtil.APP.warn(" " + testcase.getCaseSign() + "ִйʧܣ־");
}
return testnote;
}
@@ -440,7 +438,7 @@ public class TestCaseExecution {
functionname = ChangString.changparams(functionname, variable, "");
if (null != functionname && functionname.contains("쳣")) {
- LogUtil.APP.error(": " + casenum + ", " + functionname + "ʧܣ");
+ LogUtil.APP.warn(": " + casenum + ", " + functionname + "ʧܣ");
caselog.insertTaskCaseLog(taskid, projectCase.getCaseId(), ": " + casenum + ", " + functionname + "ʧܣ", "error", String.valueOf(step.getStepSerialNumber()), "");
result = "ִʧܣʧ!";
} else {
@@ -454,7 +452,7 @@ public class TestCaseExecution {
}
String parameterValues = params.get("FunctionParams" + (j + 1));
parameterValues = ChangString.changparams(parameterValues, variable, "");
- luckyclient.publicclass.LogUtil.APP.info(": " + casenum + ", ·" + packagename + "; " + functionname + " " + (j + 1) + "" + parameterValues);
+ LogUtil.APP.info(": " + casenum + ", ·" + packagename + "; " + functionname + " " + (j + 1) + "" + parameterValues);
caselog.insertTaskCaseLog(taskid, projectCase.getCaseId(), ": " + casenum + ", " + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues, "info", String.valueOf(step.getStepSerialNumber()), "");
getParameterValues[j] = parameterValues;
}
@@ -484,28 +482,28 @@ public class TestCaseExecution {
int setresult = 0;
try{
if (null != expectedresults && !expectedresults.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("expectedResults=" + expectedresults + "");
+ LogUtil.APP.info("expectedResults=" + expectedresults + "");
// ֵ
if (expectedresults.length() > ASSIGNMENT_SIGN.length() && expectedresults.startsWith(ASSIGNMENT_SIGN)) {
VARIABLE.put(expectedresults.substring(ASSIGNMENT_SIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ֵȫֱ
else if (expectedresults.length() > ASSIGNMENT_GLOBALSIGN.length() && expectedresults.startsWith(ASSIGNMENT_GLOBALSIGN)) {
VARIABLE.put(expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()), testnote);
ParamsManageForSteps.GLOBAL_VARIABLE.put(expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ģƥ
else if (expectedresults.length() > FUZZY_MATCHING_SIGN.length() && expectedresults.startsWith(FUZZY_MATCHING_SIGN)) {
if (testnote.contains(expectedresults.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽɹִн" + testnote, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote, "error", String.valueOf(step.getStepSerialNumber()), "");
testnote = "" + step.getStepSerialNumber() + "ģƥԤڽʧܣ";
}
@@ -515,11 +513,11 @@ public class TestCaseExecution {
Pattern pattern = Pattern.compile(expectedresults.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(testnote);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽɹִн" + testnote, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote, "error", String.valueOf(step.getStepSerialNumber()), "");
testnote = "" + step.getStepSerialNumber() + "ƥԤڽʧܣ";
}
@@ -527,11 +525,11 @@ public class TestCaseExecution {
// ȫ
else {
if (expectedresults.equals(testnote)) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽɹִн" + testnote, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
setresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote, "error", String.valueOf(step.getStepSerialNumber()), "");
testnote = "" + step.getStepSerialNumber() + "ȷƥԤڽʧܣ";
}
diff --git a/src/main/java/luckyclient/caserun/exinterface/TestControl.java b/src/main/java/luckyclient/caserun/exinterface/TestControl.java
index 4d90f09..503c545 100644
--- a/src/main/java/luckyclient/caserun/exinterface/TestControl.java
+++ b/src/main/java/luckyclient/caserun/exinterface/TestControl.java
@@ -12,6 +12,7 @@ import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -59,7 +60,7 @@ public class TestControl {
for (ProjectCase testcase : testCases) {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
if (steps.size() == 0) {
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + "ûҵ裬ֱ飡");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + "ûҵ裬ֱ飡");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ûҵ裬", "error", "1", "");
continue;
}
@@ -75,7 +76,7 @@ public class TestControl {
}
Thread.sleep(6000);
}
- luckyclient.publicclass.LogUtil.APP.info("ףûһҷѾȫִϣȥûʧܵɣ");
+ LogUtil.APP.info("ףûһҷѾȫִϣȥûʧܵɣ");
threadExecute.shutdown();
}
@@ -115,15 +116,15 @@ public class TestControl {
List steps = GetServerAPI.getStepsbycaseid(projectcase.getCaseId());
if (steps.size() == 0) {
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),projectcase.getCaseId(),projectcase.getCaseSign(), projectcase.getCaseName(), 2);
- luckyclient.publicclass.LogUtil.APP.error("" + projectcase.getCaseSign() + "ûҵ裬ֱ飡");
+ LogUtil.APP.warn("" + projectcase.getCaseSign() + "ûҵ裬ֱ飡");
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(), "ûҵ裬", "error", "1", "");
continue;
}
// ̼߳,ȼȼߵִɣż
if (casepriority < projectcase.getPriority()) {
- luckyclient.publicclass.LogUtil.APP.info("ţ" + projectcase.getCaseSign() + " casepriority"
+ LogUtil.APP.info("ţ" + projectcase.getCaseSign() + " casepriority"
+ casepriority + " projectcase.getPriority()" + projectcase.getPriority());
- luckyclient.publicclass.LogUtil.APP.info("THREAD_COUNT" + THREAD_COUNT);
+ LogUtil.APP.info("THREAD_COUNT" + THREAD_COUNT);
int i = 0;
while (THREAD_COUNT != 0) {
i++;
@@ -153,14 +154,14 @@ public class TestControl {
HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname),
taskid, taskScheduling, tastcount);
threadExecute.shutdown();
- luckyclient.publicclass.LogUtil.APP.info("ףûһҷѾȫִϣȥûʧܵɣ");
+ LogUtil.APP.info("ףûһҷѾȫִϣȥûʧܵɣ");
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿʧܣԶԶ˳ǰJENKINSмĿ");
+ LogUtil.APP.warn("ĿʧܣԶԶ˳ǰJENKINSмĿ");
MailSendInitialization.sendMailInitialization(jobname, "ĿʧܣԶԶ˳ǰȥJENKINS鿴", taskid,
taskScheduling, tastcount);
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
+ LogUtil.APP.warn("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
MailSendInitialization.sendMailInitialization(jobname, "ĿTOMCATʧܣԶԶ˳ĿTOMCAT", taskid,
taskScheduling, tastcount);
}
diff --git a/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java b/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java
index dedd919..18c8eca 100644
--- a/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java
+++ b/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java
@@ -12,6 +12,7 @@ import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.caserun.publicdispose.ParamsManageForSteps;
import luckyclient.dblog.LogOperation;
import luckyclient.publicclass.InvokeMethod;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
import luckyclient.serverapi.entity.ProjectCaseSteps;
@@ -83,7 +84,7 @@ public class ThreadForExecuteCase extends Thread {
functionname = ChangString.changparams(functionname, variable, "");
} catch (Exception e) {
k = 0;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
+ LogUtil.APP.error("" + testcase.getCaseSign() + "Ƿʧܣ飡");
caselog.insertTaskCaseLog(taskid, caseId, "Ƿʧܣ飡", "error", String.valueOf(i + 1), "");
e.printStackTrace();
break; // ijһʧܺΪʧ˳
@@ -107,7 +108,7 @@ public class ThreadForExecuteCase extends Thread {
}
String parameterValues = casescript.get("FunctionParams" + (j + 1));
parameterValues = ChangString.changparams(parameterValues, variable, "");
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
+ LogUtil.APP.info("" + testcase.getCaseSign() + "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues);
caselog.insertTaskCaseLog(taskid, caseId, "" + packagename + " " + functionname + " " + (j + 1) + "" + parameterValues, "info", String.valueOf(i + 1), "");
getParameterValues[j] = parameterValues;
}
@@ -116,41 +117,41 @@ public class ThreadForExecuteCase extends Thread {
}
// öִ̬в
try {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "ʼ÷" + functionname + " .....");
+ LogUtil.APP.info("" + testcase.getCaseSign() + "ʼ÷" + functionname + " .....");
caselog.insertTaskCaseLog(taskid, caseId, "ʼ÷" + functionname + " .....", "info", String.valueOf(i + 1), "");
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
if (null != expectedresults && !expectedresults.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("expectedResults=" + expectedresults + "");
+ LogUtil.APP.info("expectedResults=" + expectedresults + "");
// ֵ
if (expectedresults.length() > ASSIGNMENT_SIGN.length() && expectedresults.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expectedresults.substring(ASSIGNMENT_SIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, caseId, "Խ" + testnote + "ֵ" + expectedresults.substring(ASSIGNMENT_SIGN.length()) + "", "info", String.valueOf(i + 1), "");
}
// ֵȫֱ
else if (expectedresults.length() > ASSIGNMENT_GLOBALSIGN.length() && expectedresults.startsWith(ASSIGNMENT_GLOBALSIGN)) {
variable.put(expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()), testnote);
ParamsManageForSteps.GLOBAL_VARIABLE.put(expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()), testnote);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, caseId, "Խ" + testnote + "ֵȫֱ" + expectedresults.substring(ASSIGNMENT_GLOBALSIGN.length()) + "", "info", String.valueOf(i + 1), "");
}
// ģƥ
else if (expectedresults.length() > FUZZY_MATCHING_SIGN.length() && expectedresults.startsWith(FUZZY_MATCHING_SIGN)) {
if (testnote.contains(expectedresults.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "ģƥԤڽɹִн" + testnote, "info", String.valueOf(i + 1), "");
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "" + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote, "error", String.valueOf(i + 1), "");
testnote = "" + (i + 1) + "ģƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -159,52 +160,51 @@ public class ThreadForExecuteCase extends Thread {
Pattern pattern = Pattern.compile(expectedresults.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(testnote);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "ƥԤڽɹִн" + testnote, "info", String.valueOf(i + 1), "");
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "" + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote, "error", String.valueOf(i + 1), "");
testnote = "" + (i + 1) + "ƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
// ȫ
else {
if (expectedresults.equals(testnote)) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽɹִн" + testnote);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽɹִн" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "ȷƥԤڽɹִн" + testnote, "info", String.valueOf(i + 1), "");
} else {
setcaseresult = 1;
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote);
caselog.insertTaskCaseLog(taskid, caseId, "" + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote, "error", String.valueOf(i + 1), "");
testnote = "" + (i + 1) + "ȷƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.error("" + testcase.getCaseSign() + "÷̳" + functionname + " ¼űԼ");
+ LogUtil.APP.error("" + testcase.getCaseSign() + "÷̳" + functionname + " ¼űԼ",e);
caselog.insertTaskCaseLog(taskid, caseId, "÷̳" + functionname + " ¼űԼ", "error", String.valueOf(i + 1), "");
- luckyclient.publicclass.LogUtil.ERROR.error(e, e);
testnote = "CallCaseó÷̳" + functionname + " ¼űԼ";
setcaseresult = 1;
e.printStackTrace();
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -215,29 +215,27 @@ public class ThreadForExecuteCase extends Thread {
caselog.updateTaskCaseExecuteStatus(taskid, caseId, setcaseresult);
} else {
// ǵ÷ȫΪ
- luckyclient.publicclass.LogUtil.ERROR.error("" + testcase.getCaseSign() + "ִнΪο־ԭ.....");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + "ִнΪο־ԭ.....");
caselog.insertTaskCaseLog(taskid, caseId, "ִнΪο־ԭ.....","error", "SETCASERESULT...", "");
setcaseresult = 2;
caselog.updateTaskCaseExecuteStatus(taskid, caseId, setcaseresult);
}
if (0 == setcaseresult) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "ִнɹ......");
+ LogUtil.APP.info("" + testcase.getCaseSign() + "ִнɹ......");
caselog.insertTaskCaseLog(taskid, caseId, "ִȫɹ......", "info", "ending", "");
- luckyclient.publicclass.LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խɹ*********");
+ LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խɹ*********");
} else if (1 == setcaseresult) {
- luckyclient.publicclass.LogUtil.ERROR.error("" + testcase.getCaseSign() + "ִнʧ......");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + "ִнʧ......");
caselog.insertTaskCaseLog(taskid, caseId, "ִнʧ......", "error", "ending", "");
- luckyclient.publicclass.LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խʧ*********");
+ LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խʧ*********");
} else {
- luckyclient.publicclass.LogUtil.ERROR.error("" + testcase.getCaseSign() + "ִн......");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + "ִн......");
caselog.insertTaskCaseLog(taskid, caseId, "ִн......", "error", "ending", "");
- luckyclient.publicclass.LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խ*********");
+ LogUtil.APP.info("*********" + testcase.getCaseSign() + "ִ,Խ*********");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.error("" + testcase.getCaseSign() + "ִн̳......");
+ LogUtil.APP.error("" + testcase.getCaseSign() + "ִн̳......",e);
caselog.insertTaskCaseLog(taskid, caseId, "ִн̳......", "error", "ending", "");
- luckyclient.publicclass.LogUtil.ERROR.error(e, e);
- e.printStackTrace();
} finally {
variable.clear(); // һձ洢ռ
TestControl.THREAD_COUNT--; // ̼߳--ڼ߳Ƿȫִ
diff --git a/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java b/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java
index ea5a168..00b5902 100644
--- a/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java
+++ b/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java
@@ -10,6 +10,7 @@ import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase;
import luckyclient.caserun.publicdispose.ActionManageForSteps;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.InvokeMethod;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.api.PostServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
@@ -118,10 +119,10 @@ public class WebTestCaseDebug {
PostServerAPI.cPostDebugLog(userId, caseId, "ERROR", "" + (i + 1) + "ģƥԤڽʧܣԤڽ" + expectedresults.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + testnote,0);
testnote = "" + (i + 1) + "ģƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -136,10 +137,10 @@ public class WebTestCaseDebug {
PostServerAPI.cPostDebugLog(userId, caseId, "ERROR", "" + (i + 1) + "ƥԤڽʧܣԤڽ" + expectedresults.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + testnote,0);
testnote = "" + (i + 1) + "ƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -152,10 +153,10 @@ public class WebTestCaseDebug {
PostServerAPI.cPostDebugLog(userId, caseId, "ERROR", "" + (i + 1) + "ȷƥԤڽʧܣԤڽ" + expectedresults + "Խ" + testnote,0);
testnote = "" + (i + 1) + "ȷƥԤڽʧܣ";
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
@@ -166,10 +167,10 @@ public class WebTestCaseDebug {
testnote = "CallCaseó";
e.printStackTrace();
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+(i + 1)+"ִʧܣִУ¸ִ......");
}
}
}
diff --git a/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java b/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java
index b6ae0fb..49ae982 100644
--- a/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java
+++ b/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java
@@ -6,6 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
/**
@@ -58,16 +59,15 @@ public class InterfaceAnalyticCase{
}else{
params.put("ExpectedResults", subComment(resultstr));
}
- luckyclient.publicclass.LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
+ LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զűɣ","info",String.valueOf(step.getStepSerialNumber()),"");
}
}catch(Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű");
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զű","error",String.valueOf(step.getStepSerialNumber()),"");
}
- luckyclient.publicclass.LogUtil.ERROR.error(e,e);
+ LogUtil.APP.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű",e);
params.put("exception","ţ"+projectcase.getCaseSign()+"|쳣,Ϊջű");
return params;
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java b/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java
index 0f30fc1..50ff12f 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java
@@ -9,6 +9,8 @@ import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Augmenter;
+import luckyclient.publicclass.LogUtil;
+
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
@@ -38,11 +40,11 @@ public class BaseWebDrive {
try {
FileUtils.copyFile(scrFile, new File(pngpath));
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error("ͼʧܣ׳쳣鿴־...", e);
+ LogUtil.APP.error("ͼʧܣ׳쳣鿴־...", e);
e.printStackTrace();
}
scrFile.deleteOnExit();
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("ѶԵǰнͼִͨн־ϸ鿴Ҳǰͻϲ鿴..." + pngpath + "");
return result;
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java b/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java
index 314ec86..be17d2d 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java
@@ -7,6 +7,7 @@ import org.openqa.selenium.WebDriver;
import luckyclient.caserun.exwebdriver.ex.WebCaseExecution;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -33,12 +34,12 @@ public class CaseLocalDebug{
try {
ProjectCase testcase = GetServerAPI.cgetCaseBysign(testCaseExternalId);
List pcplist=GetServerAPI.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ"+testCaseExternalId+"......");
+ LogUtil.APP.info("ʼִ"+testCaseExternalId+"......");
List steps=GetServerAPI.getStepsbycaseid(testcase.getCaseId());
WebCaseExecution.caseExcution(testcase,steps, "888888",wd,caselog,pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ"+testcase.getCaseSign()+"ִ......һ");
+ LogUtil.APP.info("ǰ"+testcase.getCaseSign()+"ִ......һ");
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.ERROR.info("ûִй׳쳣", e);
+ LogUtil.APP.info("ûִй׳쳣", e);
e.printStackTrace();
}
//ر
@@ -55,7 +56,7 @@ public class CaseLocalDebug{
System.out.println("ǰܹ"+addtestcase.size());
for(String testCaseExternalId:addtestcase) {
try{
- luckyclient.publicclass.LogUtil.APP.info("ʼ÷Ŀ"+projectname+"ţ" + testCaseExternalId);
+ LogUtil.APP.info("ʼ÷Ŀ"+projectname+"ţ" + testCaseExternalId);
oneCasedebug(wd,testCaseExternalId);
}catch(Exception e){
continue;
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java b/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java
index 6e3b459..24fc646 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java
@@ -1,5 +1,27 @@
package luckyclient.caserun.exwebdriver;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openqa.selenium.Alert;
+import org.openqa.selenium.Cookie;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.NoSuchWindowException;
+import org.openqa.selenium.Point;
+import org.openqa.selenium.TimeoutException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.FluentWait;
+import org.openqa.selenium.support.ui.Select;
+
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -7,19 +29,6 @@ import com.alibaba.fastjson.JSONObject;
import luckyclient.caserun.exwebdriver.ocr.Ocr;
import luckyclient.caserun.publicdispose.ChangString;
import luckyclient.publicclass.LogUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.openqa.selenium.*;
-import org.openqa.selenium.interactions.Actions;
-import org.openqa.selenium.support.ui.ExpectedCondition;
-import org.openqa.selenium.support.ui.FluentWait;
-import org.openqa.selenium.support.ui.Select;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
/**
* =================================================================
@@ -43,21 +52,21 @@ public class EncapsulateOperation {
case "selectbyvisibletext":
select.selectByVisibleText(operationValue);
result = "ͨVisibleTextѡ...VisibleTextֵ:" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "selectbyvalue":
select.selectByValue(operationValue);
result = "ͨValueѡ...Valueֵ:" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "selectbyindex":
select.selectByIndex(Integer.valueOf(operationValue));
result = "ͨIndexѡ...Indexֵ:" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "isselect":
result = "ȡֵǡ" + we.isSelected() + "";
- luckyclient.publicclass.LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + we.isSelected() + "");
+ LogUtil.APP.info("ж϶ǷѾѡ...ֵ:" + we.isSelected() + "");
break;
default:
break;
@@ -71,23 +80,23 @@ public class EncapsulateOperation {
switch (operation) {
case "gettext":
result = "ȡֵǡ" + we.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
+ LogUtil.APP.info("getTextȡtext...textֵ:" + result + "");
break; // ȡ
case "gettagname":
result = "ȡֵǡ" + we.getTagName() + "";
- luckyclient.publicclass.LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
+ LogUtil.APP.info("getTagNameȡtagname...tagnameֵ:" + result + "");
break;
case "getattribute":
result = "ȡֵǡ" + we.getAttribute(value) + "";
- luckyclient.publicclass.LogUtil.APP.info("getAttributeȡ" + value + "..." + value + "ֵ:" + result + "");
+ LogUtil.APP.info("getAttributeȡ" + value + "..." + value + "ֵ:" + result + "");
break;
case "getcssvalue":
result = "ȡֵǡ" + we.getCssValue(value) + "";
- luckyclient.publicclass.LogUtil.APP.info("getCssValueȡ" + value + "..." + value + "ֵ:" + result + "");
+ LogUtil.APP.info("getCssValueȡ" + value + "..." + value + "ֵ:" + result + "");
break;
case "getcaptcha":
result = "ȡֵǡ" + Ocr.getCAPTCHA(wd, we) + "";
- luckyclient.publicclass.LogUtil.APP.info("getcaptchaȡ֤...ֵ֤:" + result + "");
+ LogUtil.APP.info("getcaptchaȡ֤...ֵ֤:" + result + "");
break;
default:
break;
@@ -104,41 +113,41 @@ public class EncapsulateOperation {
case "mouselkclick":
action.click(we).perform();
result = "mouselkclick...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouserkclick":
action.contextClick(we).perform();
result = "mouserkclickҼ...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mousedclick":
action.doubleClick(we).perform();
result = "mousedclick˫...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouseclickhold":
action.clickAndHold(we).perform();
result = "mouseclickholdͷ...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mousedrag":
int[] location = getLocationFromParam(operationValue, ",");
// String[] temp = operationValue.split(",", -1);
action.dragAndDropBy(we, location[0], location[1]).perform();
result = "mousedragƶ...λ:" + property + "; λֵ:" + propertyValue + "; (x,y):" + location[0] + "," + location[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouseto":
int[] location1 = getLocationFromParam(operationValue, ",");
// String[] temp1 = operationValue.split(",", -1);
action.moveToElement(we, location1[0], location1[1]).perform();
result = "mousetoƶ...λ:" + property + "; λֵ:" + propertyValue + "; (x,y):" + location1[0] + "," + location1[1] + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouserelease":
action.release(we).perform();
result = "mousereleaseͷ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
default:
break;
@@ -155,61 +164,61 @@ public class EncapsulateOperation {
case "mouselkclick":
action.click().perform();
result = "mouselkclickǰλ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouserkclick":
action.contextClick().perform();
result = "mouserkclickҼǰλ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mousedclick":
action.doubleClick().perform();
result = "mousedclick˫ǰλ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouseclickhold":
action.clickAndHold().perform();
result = "mouseclickholdǰλúͷ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouseto":
int[] location = getLocationFromParam(operationValue, ",");
// String[] temp1 = operationValue.split(",", -1);
action.moveByOffset(location[0], location[1]).perform();
result = "mousetoƶ...x" + location[0] + " y" + location[1];
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mouserelease":
action.release().perform();
result = "mousereleaseͷ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "mousekey":
switch (operationValue) {
case "tab":
action.sendKeys(Keys.TAB).perform();
result = "̲TAB...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "space":
action.sendKeys(Keys.SPACE).perform();
result = "̲SPACE...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "ctrl":
action.sendKeys(Keys.CONTROL).perform();
result = "̲CONTROL...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "shift":
action.sendKeys(Keys.SHIFT).perform();
result = "̲SHIFT...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "enter":
action.sendKeys(Keys.ENTER).perform();
result = "̲ENTER...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
default:
break;
@@ -228,30 +237,30 @@ public class EncapsulateOperation {
case "click":
we.click();
result = "click...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "sendkeys":
we.sendKeys(operationValue);
result = "sendKeys...λ:" + property + "; λֵ:" + propertyValue + "; ֵ:" + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "clear":
we.clear();
result = "clear...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break; //
case "gotoframe":
wd.switchTo().frame(we);
result = "gotoframeлFrame...λ:" + property + "; λֵ:" + propertyValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "isenabled":
result = "ȡֵǡ" + we.isEnabled() + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "isdisplayed":
result = "ȡֵǡ" + we.isDisplayed() + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "exjsob":
JavascriptExecutor jse = (JavascriptExecutor) wd;
@@ -291,16 +300,16 @@ public class EncapsulateOperation {
case "alertaccept":
alert.accept();
result = "ͬ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "alertdismiss":
alert.dismiss();
result = "ȡ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "alertgettext":
result = "ȡֵǡ" + alert.getText() + "";
- luckyclient.publicclass.LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
+ LogUtil.APP.info("ͨgetTextȡtext...Textֵ:" + alert.getText() + "");
break;
default:
break;
@@ -315,14 +324,14 @@ public class EncapsulateOperation {
case "open":
wd.get(operationValue);
result = "Openҳ..." + operationValue + "";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "addcookie":
List cookies = buildCookie(operationValue);
if (null != cookies && cookies.size() > 0) {
for (Cookie cookie : cookies) {
wd.manage().addCookie(cookie);
- luckyclient.publicclass.LogUtil.APP.info("Cookie:"+cookie+"ɹ");
+ LogUtil.APP.info("Cookie:"+cookie+"ɹ");
}
}
result = "cookie..." + operationValue + "";
@@ -343,7 +352,7 @@ public class EncapsulateOperation {
case "gotodefaultcontent":
wd.switchTo().defaultContent();
result = "gotodefaultcontentлĬҳλ...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
case "gotoparentframe":
wd.switchTo().parentFrame();
@@ -352,7 +361,7 @@ public class EncapsulateOperation {
break;
case "gettitle":
result = "ȡֵǡ" + wd.getTitle() + "";
- luckyclient.publicclass.LogUtil.APP.info("ȡҳTitle..." + wd.getTitle() + "");
+ LogUtil.APP.info("ȡҳTitle..." + wd.getTitle() + "");
break;
case "getwindowhandle":
result = getTargetWindowHandle(wd, operationValue);
@@ -371,10 +380,10 @@ public class EncapsulateOperation {
// Ԫسʱ30
wd.manage().timeouts().implicitlyWait(Integer.valueOf(operationValue), TimeUnit.SECONDS);
result = "ǰȴ" + operationValue + "...";
- luckyclient.publicclass.LogUtil.APP.info(result);
+ LogUtil.APP.info(result);
break;
} catch (NumberFormatException e) {
- luckyclient.publicclass.LogUtil.APP.error("ȴʱת");
+ LogUtil.APP.error("ȴʱת");
e.printStackTrace();
result = "ȴʱת";
break;
@@ -387,13 +396,13 @@ public class EncapsulateOperation {
private static List buildCookie(String operationValue) {
if (StringUtils.isBlank(operationValue)) {
- luckyclient.publicclass.LogUtil.APP.info("ȡCookieֵoperationValueΪգ");
+ LogUtil.APP.info("ȡCookieֵoperationValueΪգ");
return null;
}
try {
JSONArray objects = JSON.parseArray(operationValue);
if (null == objects) {
- luckyclient.publicclass.LogUtil.APP.info("ʽCookieַJSONArrayΪգ");
+ LogUtil.APP.info("ʽCookieַJSONArrayΪգ");
return null;
}
List result = new ArrayList<>(objects.size());
@@ -410,16 +419,16 @@ public class EncapsulateOperation {
//String expire = jsonObject.getString("expire");
if (!StringUtils.isBlank(name) && !StringUtils.isBlank(val)) {
Cookie cookie = new Cookie(name, val, domain, path, null);
- luckyclient.publicclass.LogUtil.APP.info("Cookieɹ"+cookie+"");
+ LogUtil.APP.info("Cookieɹ"+cookie+"");
result.add(cookie);
}else{
- luckyclient.publicclass.LogUtil.APP.error("cookie:" + jsonObject + ",namevalΪգ");
+ LogUtil.APP.warn("cookie:" + jsonObject + ",namevalΪգ");
}
}
return result;
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ʽCookieĸʽǷȷ"+operationValue+"");
+ LogUtil.APP.error("ʽCookieĸʽǷȷ"+operationValue+"");
return null;
}
}
@@ -456,7 +465,7 @@ public class EncapsulateOperation {
} else {
result = "ȡھֵʧܣWebDriverΪ";
}
- if (result.contains("ȡھֵʧ")) LogUtil.APP.error(result);
+ if (result.contains("ȡھֵʧ")) LogUtil.APP.warn(result);
else LogUtil.APP.info("ȡھֵɹĿ괰ھֵΪ" + result + "");
return result;
}
@@ -549,7 +558,7 @@ public class EncapsulateOperation {
try {
if (null == Wait(driver).until(windowToBeAvailableAndSwitchToIt(target))) {
result = "лھʧܣδҵֵΪ" + target + "Ķ";
- LogUtil.APP.error(result);
+ LogUtil.APP.warn(result);
} else {
result = "лھɹҵֵΪ" + target + "Ķ";
LogUtil.APP.info(result);
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java b/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java
index 288d4c1..910030e 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java
@@ -13,6 +13,8 @@ import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
+import luckyclient.publicclass.LogUtil;
+
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
@@ -38,13 +40,13 @@ public class WebDriverInitialization{
File directory = new File("");
String drivenpath=directory.getCanonicalPath()+File.separator+"BrowserDriven"+File.separator;
WebDriver webDriver = null;
- luckyclient.publicclass.LogUtil.APP.info("ʼWebDriver...鵽ǰϵͳǣ"+os);
+ LogUtil.APP.info("ʼWebDriver...鵽ǰϵͳǣ"+os);
if(drivertype==0){
if(os.startsWith("win")){
System.setProperty("webdriver.ie.driver",drivenpath+"IEDriverServer.exe");
webDriver = new InternetExplorerDriver();
}else{
- luckyclient.publicclass.LogUtil.APP.error("ǰϵͳIEWeb UIԣѡǹȸ");
+ LogUtil.APP.warn("ǰϵͳIEWeb UIԣѡǹȸ");
}
}else if(drivertype==1){
FirefoxOptions options = new FirefoxOptions();
@@ -54,7 +56,7 @@ public class WebDriverInitialization{
options.addArguments("start-maximized");
System.setProperty("webdriver.gecko.driver",drivenpath+"geckodriver_mac");
}else{
- luckyclient.publicclass.LogUtil.APP.info("ǰϵͳLinux,ĬʹheadlessʽFirefoxWeb UIԶ...");
+ LogUtil.APP.info("ǰϵͳLinux,ĬʹheadlessʽFirefoxWeb UIԶ...");
//
options.setHeadless(true);
//ɳ
@@ -71,7 +73,7 @@ public class WebDriverInitialization{
options.addArguments("start-maximized");
System.setProperty("webdriver.chrome.driver",drivenpath+"chromedriver_mac");
}else{
- luckyclient.publicclass.LogUtil.APP.info("ǰϵͳLinux,ĬʹheadlessʽChromeWeb UIԶ...");
+ LogUtil.APP.info("ǰϵͳLinux,ĬʹheadlessʽChromeWeb UIԶ...");
//
options.setHeadless(true);
//ɳ
@@ -85,11 +87,10 @@ public class WebDriverInitialization{
System.setProperty("webdriver.edge.driver",drivenpath+"MicrosoftWebDriver.exe");
webDriver = new EdgeDriver();
}else{
- luckyclient.publicclass.LogUtil.APP.error("ǰϵͳEdgeWeb UIԣѡǹȸ");
+ LogUtil.APP.warn("ǰϵͳEdgeWeb UIԣѡǹȸ");
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("ͱʶ"+drivertype);
- luckyclient.publicclass.LogUtil.APP.error("ȡͱʶδ壬ĬIEִ....");
+ LogUtil.APP.warn("ͱʶ"+drivertype+"ȡͱʶδ壬ĬIEִ....");
System.setProperty("webdriver.ie.driver",drivenpath+"IEDriverServer.exe");
webDriver = new InternetExplorerDriver();
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java b/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java
index 19fa882..9b5401d 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java
@@ -16,6 +16,7 @@ import luckyclient.jenkinsapi.BuildingInitialization;
import luckyclient.jenkinsapi.RestartServerInitialization;
import luckyclient.mail.HtmlMail;
import luckyclient.mail.MailSendInitialization;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -59,7 +60,7 @@ public class WebTestControl {
if (testCases.size() != 0) {
pcplist = GetServerAPI.cgetParamsByProjectid(String.valueOf(testCases.get(0).getProjectId()));
}
- luckyclient.publicclass.LogUtil.APP.info("ǰƻжȡ " + testCases.size() + " ");
+ LogUtil.APP.info("ǰƻжȡ " + testCases.size() + " ");
int i = 0;
for (ProjectCase testcase : testCases) {
List steps = GetServerAPI.getStepsbycaseid(testcase.getCaseId());
@@ -67,17 +68,17 @@ public class WebTestControl {
continue;
}
i++;
- luckyclient.publicclass.LogUtil.APP.info("ʼִе" + i + "" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִе" + i + "" + testcase.getCaseSign() + "......");
try {
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
}
- luckyclient.publicclass.LogUtil.APP.info("ǰĿԼƻеѾȫִ...");
+ LogUtil.APP.info("ǰĿԼƻеѾȫִ...");
// ر
wd.quit();
}
@@ -104,16 +105,16 @@ public class WebTestControl {
try {
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
} catch (WebDriverException e1) {
- luckyclient.publicclass.LogUtil.APP.error("ʼWebDriver WebDriverException", e1);
+ LogUtil.APP.error("ʼWebDriver WebDriverException", e1);
e1.printStackTrace();
} catch (IOException e2) {
- luckyclient.publicclass.LogUtil.APP.error("ʼWebDriver IOException", e2);
+ LogUtil.APP.error("ʼWebDriver IOException", e2);
e2.printStackTrace();
}
LogOperation caselog = new LogOperation();
List cases = GetServerAPI.getCasesbyplanId(taskScheduling.getPlanId());
- luckyclient.publicclass.LogUtil.APP.info("ǰƻжȡ " + cases.size() + " ");
+ LogUtil.APP.info("ǰƻжȡ " + cases.size() + " ");
LogOperation.updateTaskExecuteStatus(taskid, cases.size());
for (ProjectCase testcase : cases) {
@@ -121,34 +122,34 @@ public class WebTestControl {
if (steps.size() == 0) {
continue;
}
- luckyclient.publicclass.LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
+ LogUtil.APP.info("ʼִ" + testcase.getCaseSign() + "......");
try {
// 뿪ʼִе
caselog.insertTaskCaseExecute(taskid, taskScheduling.getProjectId(),testcase.getCaseId(),testcase.getCaseSign(), testcase.getCaseName(), 4);
WebCaseExecution.caseExcution(testcase, steps, taskid, wd, caselog, pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
- luckyclient.publicclass.LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
+ LogUtil.APP.info("ǰ" + testcase.getCaseSign() + "ִ......һ");
}
tastcount = LogOperation.updateTaskExecuteData(taskid, cases.size());
String testtime = LogOperation.getTestTime(taskid);
- luckyclient.publicclass.LogUtil.APP.info("ǰĿ" + projectname + "ԼƻеѾȫִ...");
+ LogUtil.APP.info("ǰĿ" + projectname + "ԼƻеѾȫִ...");
MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname),
HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname),
taskid, taskScheduling, tastcount);
// ر
wd.quit();
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿʧܣԶԶ˳ǰJENKINSмĿ");
+ LogUtil.APP.warn("ĿʧܣԶԶ˳ǰJENKINSмĿ");
MailSendInitialization.sendMailInitialization(jobname, "ĿʧܣԶԶ˳ǰȥJENKINS鿴", taskid,
taskScheduling, tastcount);
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
+ LogUtil.APP.warn("ĿTOMCATʧܣԶԶ˳ĿTOMCAT");
MailSendInitialization.sendMailInitialization(jobname, "ĿTOMCATʧܣԶԶ˳ĿTOMCAT", taskid,
taskScheduling, tastcount);
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java
index 5707013..15010f7 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java
@@ -10,6 +10,7 @@ import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.WebDriverInitialization;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -56,7 +57,7 @@ public class WebBatchExecute{
WebCaseExecution.caseExcution(testcase, steps, taskid,wd,caselog,pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
@@ -71,7 +72,7 @@ public class WebBatchExecute{
WebCaseExecution.caseExcution(testcase, steps,taskid,wd,caselog,pcplist);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java
index 81548b9..0a97143 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java
@@ -82,10 +82,10 @@ public class WebCaseExecution extends TestCaseExecution {
if (0 != stepresult) {
setcaseresult = stepresult;
if (testcase.getFailcontinue() == 0) {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣжϱִУ뵽һִ......");
break;
} else {
- luckyclient.publicclass.LogUtil.APP.error(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
+ LogUtil.APP.warn(""+testcase.getCaseSign()+"ڡ"+step.getStepSerialNumber()+"ִʧܣִУ¸ִ......");
}
}
}
@@ -93,10 +93,10 @@ public class WebCaseExecution extends TestCaseExecution {
variable.clear();
caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), setcaseresult);
if (setcaseresult == 0) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + "ȫִнɹ...");
+ LogUtil.APP.info("" + testcase.getCaseSign() + "ȫִнɹ...");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȫִнɹ", "info", "ending", "");
} else {
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + "ִйʧܻ...鿴ԭ" + casenote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + "ִйʧܻ...鿴ԭ" + casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ִйʧܻ" + casenote, "error", "ending", "");
}
}
@@ -120,11 +120,11 @@ public class WebCaseExecution extends TestCaseExecution {
operation = ChangString.changparams(operation, variable, "");
operationValue = ChangString.changparams(operationValue, variable, "");
- luckyclient.publicclass.LogUtil.APP.info("νɣȴж......");
+ LogUtil.APP.info("νɣȴж......");
caselog.insertTaskCaseLog(taskid, caseId, ":" + operation + "; ֵ:" + operationValue, "info", String.valueOf(stepno), "");
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ν׳쳣---" + e.getMessage());
+ LogUtil.APP.error("ν׳쳣---" + e.getMessage());
return "ִʧܣʧ!";
}
@@ -145,7 +145,7 @@ public class WebCaseExecution extends TestCaseExecution {
WebElement we = isElementExist(wd, property, propertyValue);
// жϴԪǷ
if (null == we) {
- luckyclient.publicclass.LogUtil.APP.error("λʧܣisElementExistΪnull!");
+ LogUtil.APP.warn("λʧܣisElementExistΪnull!");
return "ִʧܣλԪزڣ";
}
@@ -169,11 +169,11 @@ public class WebCaseExecution extends TestCaseExecution {
result = EncapsulateOperation.driverOperation(wd, operation, operationValue);
}
} else {
- luckyclient.publicclass.LogUtil.APP.error("Ԫزʧܣ");
+ LogUtil.APP.warn("Ԫزʧܣ");
result = "ִʧܣԪزʧܣ";
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣" + e.getMessage());
+ LogUtil.APP.error("Ԫضλ̻Dzʧܻ쳣" + e.getMessage());
return "ִʧܣԪضλ̻Dzʧܻ쳣" + e.getMessage();
}
@@ -218,7 +218,7 @@ public class WebCaseExecution extends TestCaseExecution {
return we;
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ǰλʧܣ" + e.getMessage());
+ LogUtil.APP.error("ǰλʧܣ" + e.getMessage());
return null;
}
@@ -233,18 +233,18 @@ public class WebCaseExecution extends TestCaseExecution {
if (null != result && !result.contains("ִʧܣ")) {
// Ԥڽ
if (null != expect && !expect.isEmpty()) {
- luckyclient.publicclass.LogUtil.APP.info("Ϊ" + expect + "");
+ LogUtil.APP.info("Ϊ" + expect + "");
// ֵģʽ
if (expect.length() > ASSIGNMENT_SIGN.length() && expect.startsWith(ASSIGNMENT_SIGN)) {
variable.put(expect.substring(ASSIGNMENT_SIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵ" + expect.substring(ASSIGNMENT_SIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// ֵȫֱ
else if (expect.length() > ASSIGNMENT_GLOBALSIGN.length() && expect.startsWith(ASSIGNMENT_GLOBALSIGN)) {
variable.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
ParamsManageForSteps.GLOBAL_VARIABLE.put(expect.substring(ASSIGNMENT_GLOBALSIGN.length()), result);
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "Խ" + result + "ֵȫֱ" + expect.substring(ASSIGNMENT_GLOBALSIGN.length()) + "", "info", String.valueOf(step.getStepSerialNumber()), "");
}
// WebUIģʽ
@@ -254,13 +254,13 @@ public class WebCaseExecution extends TestCaseExecution {
WebElement we = isElementExist(driver, checkproperty, checkPropertyValue);
if (null != we) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ڵǰҳҵԤڽжǰִгɹ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳҵԤڽжǰִгɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжִʧܣ";
setresult = 1;
BaseWebDrive.webScreenShot(driver, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ûڵǰҳҵԤڽжǰִʧܣ");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ڵǰҳûҵԤڽжǰִʧܣ" + "checkproperty" + checkproperty + " checkproperty_value" + checkPropertyValue + "", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -269,13 +269,13 @@ public class WebCaseExecution extends TestCaseExecution {
// ģƥԤڽģʽ
if (expect.length() > FUZZY_MATCHING_SIGN.length() && expect.startsWith(FUZZY_MATCHING_SIGN)) {
if (result.contains(expect.substring(FUZZY_MATCHING_SIGN.length()))) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽɹִн" + result, "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ģƥԤڽʧܣ";
setresult = 1;
BaseWebDrive.webScreenShot(driver, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ģƥԤڽʧܣԤڽ" + expect.substring(FUZZY_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -284,26 +284,26 @@ public class WebCaseExecution extends TestCaseExecution {
Pattern pattern = Pattern.compile(expect.substring(REGULAR_MATCHING_SIGN.length()));
Matcher matcher = pattern.matcher(result);
if (matcher.find()) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ƥԤڽʧܣ";
setresult = 1;
BaseWebDrive.webScreenShot(driver, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ƥԤڽʧܣԤڽ" + expect.substring(REGULAR_MATCHING_SIGN.length()) + "Խ" + result, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
// ȷƥԤڽģʽ
else {
if (expect.equals(result)) {
- luckyclient.publicclass.LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
+ LogUtil.APP.info("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽɹִн" + result);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽɹ", "info", String.valueOf(step.getStepSerialNumber()), "");
} else {
casenote = "" + step.getStepSerialNumber() + "ȷƥԤڽʧܣ";
setresult = 1;
BaseWebDrive.webScreenShot(driver, imagname);
- luckyclient.publicclass.LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"");
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ȷƥԤڽʧܣԤڽǣ"+expect+" ִн"+ result+"", "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
}
@@ -313,15 +313,11 @@ public class WebCaseExecution extends TestCaseExecution {
casenote = (null != result) ? result : "";
setresult = 2;
BaseWebDrive.webScreenShot(driver, imagname);
- LogUtil.APP.error("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
+ LogUtil.APP.warn("" + testcase.getCaseSign() + " " + step.getStepSerialNumber() + "ִн" + casenote);
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "ǰִйн|λԪ|ʧܣ" + casenote, "error", String.valueOf(step.getStepSerialNumber()), imagname);
}
return setresult;
}
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
-
}
\ No newline at end of file
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java
index 2421a22..ce86a4d 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java
@@ -6,6 +6,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseSteps;
/**
@@ -45,7 +46,7 @@ public class WebDriverAnalyticCase {
params.put("property", property.trim().toLowerCase());
//setֵ
params.put("property_value", propertyValue.trim());
- luckyclient.publicclass.LogUtil.APP.info("Խproperty:"+property.trim()+"; property_value:"+propertyValue.trim());
+ LogUtil.APP.info("Խproperty:"+property.trim()+"; property_value:"+propertyValue.trim());
}
//set
params.put("operation", step.getStepOperation().toLowerCase());
@@ -53,7 +54,7 @@ public class WebDriverAnalyticCase {
//setֵ
params.put("operation_value", step.getStepParameters());
}
- luckyclient.publicclass.LogUtil.APP.info("operation:"+step.getStepOperation().toLowerCase()+"; operation_value:"+step.getStepParameters());
+ LogUtil.APP.info("operation:"+step.getStepOperation().toLowerCase()+"; operation_value:"+step.getStepParameters());
//ȡԤڽַ
resultstr = step.getExpectedResult();
@@ -70,19 +71,18 @@ public class WebDriverAnalyticCase {
params.put("checkproperty_value", expectedResults.substring(expectedResults.indexOf("=")+1, expectedResults.lastIndexOf(")")));
}
params.put("ExpectedResults", expectedResults);
- luckyclient.publicclass.LogUtil.APP.info("ԤڽExpectedResults:"+expectedResults);
+ LogUtil.APP.info("ԤڽExpectedResults:"+expectedResults);
}
- luckyclient.publicclass.LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
+ LogUtil.APP.info("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զűɣ");
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զűɣ","info",String.valueOf(step.getStepSerialNumber()),"");
}
}catch(Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű");
+ LogUtil.APP.error("ţ"+projectcase.getCaseSign()+" ţ"+step.getStepSerialNumber()+" Զű",e);
if(null!=caselog){
caselog.insertTaskCaseLog(taskid, projectcase.getCaseId(),"ţ"+step.getStepSerialNumber()+" Զű","error",String.valueOf(step.getStepSerialNumber()),"");
}
- luckyclient.publicclass.LogUtil.APP.error(e,e);
params.put("exception","ţ"+projectcase.getCaseSign()+"|쳣,Ϊջű");
return params;
}
diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java
index 52f1c1b..e7512e4 100644
--- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java
+++ b/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java
@@ -9,6 +9,7 @@ import luckyclient.caserun.exinterface.TestControl;
import luckyclient.caserun.exwebdriver.WebDriverInitialization;
import luckyclient.dblog.DbLink;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.entity.ProjectCase;
import luckyclient.serverapi.entity.ProjectCaseParams;
@@ -36,7 +37,7 @@ public class WebOneCaseExecute{
try {
wd = WebDriverInitialization.setWebDriverForTask(drivertype);
} catch (IOException e1) {
- luckyclient.publicclass.LogUtil.APP.error("ʼWebDriver", e1);
+ LogUtil.APP.error("ʼWebDriver", e1);
e1.printStackTrace();
}
LogOperation caselog = new LogOperation();
@@ -45,13 +46,13 @@ public class WebOneCaseExecute{
LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid);
List pcplist=GetServerAPI.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
- luckyclient.publicclass.LogUtil.APP.info("ʼִ"+testcase.getCaseSign()+"......");
+ LogUtil.APP.info("ʼִ"+testcase.getCaseSign()+"......");
try {
List steps=GetServerAPI.getStepsbycaseid(testcase.getCaseId());
WebCaseExecution.caseExcution(testcase, steps, taskid,wd,caselog,pcplist);
- luckyclient.publicclass.LogUtil.APP.info("ǰ"+testcase.getCaseSign()+"ִ......һ");
+ LogUtil.APP.info("ǰ"+testcase.getCaseSign()+"ִ......һ");
} catch (InterruptedException e) {
- luckyclient.publicclass.LogUtil.APP.error("ûִй׳쳣", e);
+ LogUtil.APP.error("ûִй׳쳣", e);
e.printStackTrace();
}
LogOperation.updateTaskExecuteData(taskid, 0);
diff --git a/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java b/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java
index 547ebd9..0556a38 100644
--- a/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java
+++ b/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java
@@ -1,6 +1,7 @@
package luckyclient.caserun.publicdispose;
import luckyclient.driven.SubString;
+import luckyclient.publicclass.LogUtil;
/**
* ؼִ
@@ -21,10 +22,10 @@ public class ActionManageForSteps {
* @return
*/
public static String actionManage(String stepsaction,String testresult){
- luckyclient.publicclass.LogUtil.APP.info("Խǣ" + testresult);
- luckyclient.publicclass.LogUtil.APP.info("ڽ뵽Action()......ACTIONֵ"+stepsaction);
+ LogUtil.APP.info("Խǣ" + testresult);
+ LogUtil.APP.info("ڽ뵽Action()......ACTIONֵ"+stepsaction);
if(null==stepsaction||"".equals(stepsaction.trim())){
- luckyclient.publicclass.LogUtil.APP.info("Action()账......");
+ LogUtil.APP.info("Action()账......");
return testresult;
}
stepsaction=stepsaction.toLowerCase().trim();
@@ -52,7 +53,7 @@ public class ActionManageForSteps {
// ȡȴʱ
int time=Integer.parseInt(actionorder.substring(0, actionorder.lastIndexOf("#wait")));
if (time > 0) {
- luckyclient.publicclass.LogUtil.APP.info("Action(Wait):̵߳ȴ"+time+"...");
+ LogUtil.APP.info("Action(Wait):̵߳ȴ"+time+"...");
Thread.sleep(time * 1000);
}
} catch (InterruptedException e) {
@@ -60,7 +61,7 @@ public class ActionManageForSteps {
e.printStackTrace();
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("ʹõȴؼֵIJֱ˶飡");
+ LogUtil.APP.warn("ʹõȴؼֵIJֱ˶飡");
}
}else if(actionorder.endsWith("#getjv")){
String actionparams=actionorder.substring(0, actionorder.lastIndexOf("#getjv"));
@@ -74,7 +75,7 @@ public class ActionManageForSteps {
key=actionparams;
testresult=SubString.getJsonValue(testresult, key, index);
}
- luckyclient.publicclass.LogUtil.APP.info("Action(getJV):ȡJSONַָKeyֵǣ"+testresult);
+ LogUtil.APP.info("Action(getJV):ȡJSONַָKeyֵǣ"+testresult);
}else if(actionorder.endsWith("#subcentrestr")){
String actionparams=actionorder.substring(0, actionorder.lastIndexOf("#subcentrestr"));
String startstr="";
@@ -83,10 +84,10 @@ public class ActionManageForSteps {
startstr=actionparams.substring(actionparams.indexOf("[")+1, actionparams.indexOf("]"));
endstr=actionparams.substring(actionparams.lastIndexOf("[")+1, actionparams.lastIndexOf("]"));
testresult=SubString.subCentreStr(testresult, startstr, endstr);
- luckyclient.publicclass.LogUtil.APP.info("Action(subCentreStr):ȡԽָʼλַ"+testresult);
+ LogUtil.APP.info("Action(subCentreStr):ȡԽָʼλַ"+testresult);
}else{
testresult="趯subCentreStr [\"ʼַ\"][\"ַ\"]#subCentreStr ʽIJ趯ؼ:"+actionorder;
- luckyclient.publicclass.LogUtil.APP.error("趯subCentreStr [\"ʼַ\"][\"ַ\"]#subCentreStr ʽIJ趯ؼ:"+actionorder);
+ LogUtil.APP.warn("趯subCentreStr [\"ʼַ\"][\"ַ\"]#subCentreStr ʽIJ趯ؼ:"+actionorder);
}
}else if(actionorder.endsWith("#subcentrenum")){
String actionparams=actionorder.substring(0, actionorder.lastIndexOf("#subcentrenum"));
@@ -96,10 +97,10 @@ public class ActionManageForSteps {
startnum=actionparams.substring(actionparams.indexOf("[")+1, actionparams.indexOf("]"));
endnum=actionparams.substring(actionparams.lastIndexOf("[")+1, actionparams.lastIndexOf("]"));
testresult=SubString.subCentreNum(testresult, startnum, endnum);
- luckyclient.publicclass.LogUtil.APP.info("Action(subCentreNum):ȡԽָʼλַ"+testresult);
+ LogUtil.APP.info("Action(subCentreNum):ȡԽָʼλַ"+testresult);
}else{
testresult="趯subCentreNum [\"ʼַ\"][\"ַ\"]#subCentreNum ʽIJ趯ؼ:"+actionorder;
- luckyclient.publicclass.LogUtil.APP.error("趯subCentreNum [\"ʼλ()\"][\"λ()\"]#subCentreNum ʽIJ趯ؼ:"+actionorder);
+ LogUtil.APP.warn("趯subCentreNum [\"ʼλ()\"][\"λ()\"]#subCentreNum ʽIJ趯ؼ:"+actionorder);
}
}else if(actionorder.endsWith("#substrrgex")){
String actionparams=actionorder.substring(0, actionorder.lastIndexOf("#substrrgex"));
@@ -113,15 +114,15 @@ public class ActionManageForSteps {
key=actionparams;
testresult=SubString.subStrRgex(testresult, key, index);
}
- luckyclient.publicclass.LogUtil.APP.info("Action(subStrRgex):ȡJSONַָKeyֵǣ"+testresult);
+ LogUtil.APP.info("Action(subStrRgex):ȡJSONַָKeyֵǣ"+testresult);
}else{
testresult="δӦؼֱ֣˶ؼ֣"+actionorder;
- luckyclient.publicclass.LogUtil.APP.error("δӦؼֱ֣˶ؼ֣"+actionorder);
+ LogUtil.APP.warn("δӦؼֱ֣˶ؼ֣"+actionorder);
}
return testresult;
}catch(Exception e){
testresult="趯¼г쳣ֱӷزԽ"+actionorder;
- luckyclient.publicclass.LogUtil.APP.error("趯¼г쳣ֱӷزԽ"+actionorder);
+ LogUtil.APP.error("趯¼г쳣ֱӷزԽ"+actionorder);
return testresult;
}
}
diff --git a/src/main/java/luckyclient/caserun/publicdispose/ChangString.java b/src/main/java/luckyclient/caserun/publicdispose/ChangString.java
index b8944f1..96cf310 100644
--- a/src/main/java/luckyclient/caserun/publicdispose/ChangString.java
+++ b/src/main/java/luckyclient/caserun/publicdispose/ChangString.java
@@ -18,6 +18,8 @@ import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
+import luckyclient.publicclass.LogUtil;
+
/**
* Բ滻д
* =================================================================
@@ -49,7 +51,7 @@ public class ChangString {
// ڴΣд
if (varcount > 0) {
- luckyclient.publicclass.LogUtil.APP.info("" + changname + "" + str + "ҵ" + varcount + "滻");
+ LogUtil.APP.info("" + changname + "" + str + "ҵ" + varcount + "滻");
int changcount = 0;
// HASHMAPLINKMAPKEYҪ滻KEY
@@ -80,7 +82,7 @@ public class ChangString {
// "\\\\'"));
int viewcount = counter(str, "@" + entry.getKey());
str = str.replace("@" + entry.getKey(), entry.getValue());
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("" + changname + "ñ@" + entry.getKey() + "滻ֵ" + entry.getValue() + "");
str = str.replace("////CHANG////", "@@" + entry.getKey());
changcount = changcount + viewcount;
@@ -88,7 +90,7 @@ public class ChangString {
}
if (varcount != changcount) {
- luckyclient.publicclass.LogUtil.APP.error(changname + "ñδڲҵ飡" + str + "");
+ LogUtil.APP.warn(changname + "ñδڲҵ飡" + str + "");
}
}
str = str.replace("@@", "@");
@@ -218,10 +220,10 @@ public class ChangString {
if(entry.getValue() instanceof List){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼStringֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼStringֵ"+entry.getValue()+"");
JSONArray jsonarr = JSONArray.parseArray(value);
entry.setValue(jsonarr);
- luckyclient.publicclass.LogUtil.APP.info("滻Stringֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Stringֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -236,10 +238,10 @@ public class ChangString {
}catch(JSONException jsone){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼListֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼListֵ"+entry.getValue()+"");
JSONArray jsonarr = JSONArray.parseArray(value);
entry.setValue(jsonarr);
- luckyclient.publicclass.LogUtil.APP.info("滻Listֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Listֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -253,9 +255,9 @@ public class ChangString {
if(entry.getValue() instanceof String){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼStringֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼStringֵ"+entry.getValue()+"");
entry.setValue(value);
- luckyclient.publicclass.LogUtil.APP.info("滻Stringֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Stringֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -265,9 +267,9 @@ public class ChangString {
if(entry.getValue() instanceof Integer){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼIntegerֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼIntegerֵ"+entry.getValue()+"");
entry.setValue(Integer.valueOf(value));
- luckyclient.publicclass.LogUtil.APP.info("滻Integerֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Integerֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -277,9 +279,9 @@ public class ChangString {
if(entry.getValue() instanceof Long){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼLongֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼLongֵ"+entry.getValue()+"");
entry.setValue(Long.valueOf(value));
- luckyclient.publicclass.LogUtil.APP.info("滻Longֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Longֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -289,10 +291,10 @@ public class ChangString {
if(entry.getValue() instanceof BigDecimal){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼBigDecimalֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼBigDecimalֵ"+entry.getValue()+"");
BigDecimal bd = new BigDecimal(value);
entry.setValue(bd);
- luckyclient.publicclass.LogUtil.APP.info("滻BigDecimalֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻BigDecimalֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -302,9 +304,9 @@ public class ChangString {
if(entry.getValue() instanceof Boolean){
if(key.equals(entry.getKey())){
if(keyindex==COUNTER){
- luckyclient.publicclass.LogUtil.APP.info("ԭʼBooleanֵ"+entry.getValue()+"");
+ LogUtil.APP.info("ԭʼBooleanֵ"+entry.getValue()+"");
entry.setValue(Boolean.valueOf(value));
- luckyclient.publicclass.LogUtil.APP.info("滻Booleanֵ"+entry.getValue()+"");
+ LogUtil.APP.info("滻Booleanֵ"+entry.getValue()+"");
BCHANG=true;
}
COUNTER++;
@@ -324,10 +326,10 @@ public class ChangString {
*/
public static Map changjson(String json, String key, String value,int index) {
json=json.trim();
- luckyclient.publicclass.LogUtil.APP.info("ԭʼJSON"+json+"");
- luckyclient.publicclass.LogUtil.APP.info("滻JSON KEY"+key+"");
- luckyclient.publicclass.LogUtil.APP.info("滻JSON VALUE"+value+"");
- luckyclient.publicclass.LogUtil.APP.info("滻JSON KEYţ"+index+"");
+ LogUtil.APP.info("ԭʼJSON"+json+"");
+ LogUtil.APP.info("滻JSON KEY"+key+"");
+ LogUtil.APP.info("滻JSON VALUE"+value+"");
+ LogUtil.APP.info("滻JSON KEYţ"+index+"");
Map map = new HashMap(0);
map.put("json", json);
map.put("boolean", BCHANG.toString().toLowerCase());
@@ -337,12 +339,12 @@ public class ChangString {
JSONObject jsonStr = JSONObject.parseObject(json);
jsonStr=parseJsonString(json,key,value,index);
if (BCHANG) {
- luckyclient.publicclass.LogUtil.APP
+ LogUtil.APP
.info("JSONַ滻ɹJSON:" + jsonStr.toJSONString() + "");
}
map.put("json", jsonStr.toJSONString());
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ʽJSON쳣" + json, e);
+ LogUtil.APP.error("ʽJSON쳣" + json, e);
return map;
}
} else if (json.startsWith("[") && json.endsWith("]")) {
@@ -354,7 +356,7 @@ public class ChangString {
jsonStr=parseJsonString(jsonStr.toJSONString(),key,value,index);
if(BCHANG){
jsonarr.set(i, jsonStr);
- luckyclient.publicclass.LogUtil.APP.info(
+ LogUtil.APP.info(
"JSONARRAYַ滻ɹJSONARRAY:" + jsonarr.toJSONString() + "");
break;
}
@@ -362,7 +364,7 @@ public class ChangString {
map.put("json", jsonarr.toJSONString());
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ʽJSONArray쳣" + json, e);
+ LogUtil.APP.error("ʽJSONArray쳣" + json, e);
return map;
}
}
diff --git a/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java b/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java
index 2b163a0..af57075 100644
--- a/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java
+++ b/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java
@@ -8,6 +8,8 @@ import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import luckyclient.publicclass.LogUtil;
+
/**
* òд
* =================================================================
@@ -53,15 +55,15 @@ public class ParamsManageForSteps {
Random random = new Random();
String replacement = String.valueOf(random.nextInt(endnum - startnum + 1) + startnum);
params = m.replaceFirst(replacement);
- luckyclient.publicclass.LogUtil.APP.info("Params(" + matcherstr + "):滻ַ" + params);
+ LogUtil.APP.info("Params(" + matcherstr + "):滻ַ" + params);
m = pattern.matcher(params);
}
return params;
} catch (IllegalArgumentException iae) {
- luckyclient.publicclass.LogUtil.APP.error("ֲг쳣Ƿ");
+ LogUtil.APP.error("ֲг쳣Ƿ");
return params;
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
+ LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
return params;
}
}
@@ -90,18 +92,18 @@ public class ParamsManageForSteps {
matcherstr=df.format(new Date());
}
} catch (IllegalArgumentException iae) {
- luckyclient.publicclass.LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
+ LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
df = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
matcherstr=df.format(new Date());
} finally {
params = m.replaceFirst(matcherstr);
- luckyclient.publicclass.LogUtil.APP.info("Params(" + matcherstr + "):滻ַ" + params);
+ LogUtil.APP.info("Params(" + matcherstr + "):滻ַ" + params);
m = pattern.matcher(params);
}
}
return params;
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
+ LogUtil.APP.error("ֲг쳣ĸʽǷȷ");
return params;
}
}
diff --git a/src/main/java/luckyclient/dblog/DbLink.java b/src/main/java/luckyclient/dblog/DbLink.java
index 31da9d2..b59b1a6 100644
--- a/src/main/java/luckyclient/dblog/DbLink.java
+++ b/src/main/java/luckyclient/dblog/DbLink.java
@@ -3,6 +3,7 @@ package luckyclient.dblog;
import java.util.Properties;
import luckyclient.publicclass.DBOperation;
+import luckyclient.publicclass.SysConfig;
/**
* =================================================================
@@ -30,7 +31,7 @@ public class DbLink {
*
*/
public static DBOperation dbLogLink(){
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ Properties properties = SysConfig.getConfiguration();
String urlBase = "jdbc:mysql://"+properties.getProperty("mysql.db.ip")+":"+properties.getProperty("mysql.db.port")
+"/"+properties.getProperty("mysql.db.dbname")+"?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false";
String userNameBase = properties.getProperty("mysql.db.username");
diff --git a/src/main/java/luckyclient/dblog/LogOperation.java b/src/main/java/luckyclient/dblog/LogOperation.java
index 75d2021..89f8c0f 100644
--- a/src/main/java/luckyclient/dblog/LogOperation.java
+++ b/src/main/java/luckyclient/dblog/LogOperation.java
@@ -5,6 +5,7 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.api.GetServerAPI;
import luckyclient.serverapi.api.PostServerAPI;
import luckyclient.serverapi.entity.TaskExecute;
@@ -49,8 +50,8 @@ public class LogOperation {
String imgname) {
if (0 == exetype) {
if (logDetail.length()>5000) {
- luckyclient.publicclass.LogUtil.APP.info("־ϸ5000ַݿ洢־ϸӡ...");
- luckyclient.publicclass.LogUtil.APP.info(""+logStep+"־"+logGrade+",־ϸ"+logGrade+"...");
+ LogUtil.APP.info("־ϸ5000ַݿ洢־ϸӡ...");
+ LogUtil.APP.info(""+logStep+"־"+logGrade+",־ϸ"+logGrade+"...");
logDetail="־ϸ5000ַݿ⣬LOG4J־дӡǰ鿴...";
}
diff --git a/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java b/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java
index a5d20e8..2e044b4 100644
--- a/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java
+++ b/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java
@@ -1,6 +1,7 @@
package luckyclient.jenkinsapi;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
@@ -24,7 +25,7 @@ public class BuildingInitialization {
String result = JenkinsBuilding.buildingResult(buildname[i]);
if(result.indexOf("alt=\"Failed\"")>-1){
buildresult = "Ŀ"+buildname[i]+"ʧܣԶ˳";
- luckyclient.publicclass.LogUtil.APP.error("Ŀ"+buildname[i]+"ʧܣԶ˳");
+ LogUtil.APP.warn("Ŀ"+buildname[i]+"ʧܣԶ˳");
break;
}else if(result.indexOf("alt=\"Success\"")>-1){
k++;
@@ -33,7 +34,7 @@ public class BuildingInitialization {
if(buildresult.indexOf("Status:true")<=-1){
break;
}
- luckyclient.publicclass.LogUtil.APP.info("ڼ鹹еĿ(ÿ6һ)ҪĿ"+buildname.length+"Ŀǰɹ"+k+"");
+ LogUtil.APP.info("ڼ鹹еĿ(ÿ6һ)ҪĿ"+buildname.length+"Ŀǰɹ"+k+"");
if(k==buildname.length){
break;
}
@@ -48,7 +49,7 @@ public class BuildingInitialization {
String[] buildurl = LogOperation.getBuildName(tastid);
if(buildurl!=null){
- luckyclient.publicclass.LogUtil.APP.info("õIJĿйԵȡ");
+ LogUtil.APP.info("õIJĿйԵȡ");
for(int i=0;i> map = connection.getHeaderFields();
// еӦͷֶ
for (String key : map.keySet()) {
- luckyclient.publicclass.LogUtil.APP.info(key + "--->" + map.get(key));
+ LogUtil.APP.info(key + "--->" + map.get(key));
}
// BufferedReaderȡURLӦ
in = new BufferedReader(new InputStreamReader(
@@ -56,7 +58,7 @@ public class JenkinsBuilding {
result += line;
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("(GET)ʱ쳣", e);
+ LogUtil.APP.error("(GET)ʱ쳣", e);
e.printStackTrace();
}
// ʹfinallyر
@@ -102,7 +104,7 @@ public class JenkinsBuilding {
Map> map = connection.getHeaderFields();
// еӦͷֶ
for (String key : map.keySet()) {
- luckyclient.publicclass.LogUtil.APP.info(key + "--->" + map.get(key));
+ LogUtil.APP.info(key + "--->" + map.get(key));
}
// BufferedReaderȡURLӦ
in = new BufferedReader(new InputStreamReader(
@@ -112,7 +114,7 @@ public class JenkinsBuilding {
result += line;
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("(GET)ʱ쳣", e);
+ LogUtil.APP.error("(GET)ʱ쳣", e);
e.printStackTrace();
}
// ʹfinallyر
diff --git a/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java b/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java
index 7205c38..ac86738 100644
--- a/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java
+++ b/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java
@@ -1,6 +1,7 @@
package luckyclient.jenkinsapi;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
/**
* =================================================================
@@ -20,22 +21,21 @@ public class RestartServerInitialization {
try{
String[] command = LogOperation.getRestartComm(tastid);
if(command!=null){
- luckyclient.publicclass.LogUtil.APP.info("ָTOMCATԵȡ"+command.length);
+ LogUtil.APP.info("ָTOMCATԵȡ"+command.length);
if(command.length==5){
- luckyclient.publicclass.LogUtil.APP.info("ʼTOMCAT0"+command[0]+" 1"+command[1]
+ LogUtil.APP.info("ʼTOMCAT0"+command[0]+" 1"+command[1]
+" 2"+command[2]+" 3"+command[3]+" 4"+command[4]);
result = RmtShellExecutor.sshShell(command[0], command[1], command[2], Integer.valueOf(command[3]), command[4]);
}else{
- luckyclient.publicclass.LogUtil.APP.error("TOMCATв쳣Ϣ");
+ LogUtil.APP.warn("TOMCATв쳣Ϣ");
result = "TOMCATв쳣Ϣ";
}
}else{
result = "Status:true"+" ǰûҵҪTOMCAT";
- luckyclient.publicclass.LogUtil.APP.info("ǰûָҪTOMCAT");
+ LogUtil.APP.info("ǰûָҪTOMCAT");
}
}catch(Throwable e){
- luckyclient.publicclass.LogUtil.APP.error("TOMCATг쳣");
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(),e);
+ LogUtil.APP.error("TOMCATг쳣",e);
result = "TOMCATг쳣";
return result;
}
diff --git a/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java b/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java
index 867d38a..8802c03 100644
--- a/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java
+++ b/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java
@@ -6,6 +6,8 @@ import com.jcraft.jsch.Channel;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
+import luckyclient.publicclass.LogUtil;
+
/**
* Զִshellű
* @author l
@@ -31,7 +33,7 @@ public class RmtShellExecutor {
String result = "Status:true"+" ִгɹ";
try {
JSch jsch = new JSch();
- luckyclient.publicclass.LogUtil.APP.info("뵽TOMCAT");
+ LogUtil.APP.info("뵽TOMCAT");
//Կ
if (privateKey != null && !"".equals(privateKey)) {
if (passphrase != null && "".equals(passphrase)) {
@@ -45,18 +47,18 @@ public class RmtShellExecutor {
if(port <=0){
//ӷĬ϶˿
- luckyclient.publicclass.LogUtil.APP.info("TOMCATIPĬ϶˿ڡ");
+ LogUtil.APP.info("TOMCATIPĬ϶˿ڡ");
session = jsch.getSession(user, ip);
}else{
//ָĶ˿ӷ
- luckyclient.publicclass.LogUtil.APP.info("TOMCATIP˿ڡ");
+ LogUtil.APP.info("TOMCATIP˿ڡ");
session = jsch.getSession(user, ip ,port);
- luckyclient.publicclass.LogUtil.APP.info("TOMCATIP˿!");
+ LogUtil.APP.info("TOMCATIP˿!");
}
//Ӳϣ׳쳣
if (session == null) {
- luckyclient.publicclass.LogUtil.APP.error("TOMCATУӷsession is null");
+ LogUtil.APP.warn("TOMCATУӷsession is null");
result = "TOMCATУӷsession is null";
throw new Exception("session is null");
}
@@ -76,7 +78,7 @@ public class RmtShellExecutor {
OutputStream outstream = channel.getOutputStream();
//ҪִеSHELLҪ\nβʾس
- luckyclient.publicclass.LogUtil.APP.info("TOMCAT!");
+ LogUtil.APP.info("TOMCAT!");
String shellCommand = command+" \n";
outstream.write(shellCommand.getBytes());
outstream.flush();
@@ -87,20 +89,20 @@ public class RmtShellExecutor {
byte[] data = new byte[instream.available()];
int nLen = instream.read(data);
if (nLen < 0) {
- luckyclient.publicclass.LogUtil.APP.error("TOMCATУȡִн쳣");
+ LogUtil.APP.warn("TOMCATУȡִн쳣");
result = "TOMCATУȡִн쳣";
throw new Exception("network error.");
}
//תӡ
String temp = new String(data, 0, nLen,"iso8859-1");
- luckyclient.publicclass.LogUtil.APP.info("ʼӡTOMCATִн"+temp);
+ LogUtil.APP.info("ʼӡTOMCATִн"+temp);
}
outstream.close();
instream.close();
} catch (Exception e) {
result = "TOMCATУ쳣";
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
return result;
} finally {
if(null!=session){
diff --git a/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java b/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java
index e934dc2..52cbbb5 100644
--- a/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java
+++ b/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java
@@ -8,6 +8,7 @@ import java.util.Properties;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
+import luckyclient.publicclass.SysConfig;
/**
* Freemarkerģ弼ʼģ
@@ -15,7 +16,7 @@ import freemarker.template.Template;
* @author Administrator
*/
public class FreemarkerEmailTemplate {
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ Properties properties = SysConfig.getConfiguration();
/**
* ʼģĴλ
*/
diff --git a/src/main/java/luckyclient/mail/HtmlMail.java b/src/main/java/luckyclient/mail/HtmlMail.java
index b435338..06cc7fe 100644
--- a/src/main/java/luckyclient/mail/HtmlMail.java
+++ b/src/main/java/luckyclient/mail/HtmlMail.java
@@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import luckyclient.publicclass.LogUtil;
+import luckyclient.publicclass.SysConfig;
import luckyclient.publicclass.remoterinterface.HttpClientHelper;
import luckyclient.serverapi.entity.ProjectProtocolTemplate;
@@ -34,9 +36,9 @@ public class HtmlMail {
parameters.put("jobname", jobname);
try {
Map headmsg = new HashMap<>(0);
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ Properties properties = SysConfig.getConfiguration();
if ("true".equals(properties.getProperty("task.push.switch").toLowerCase())) {
- luckyclient.publicclass.LogUtil.APP.info("ʼƽִ̨....");
+ LogUtil.APP.info("ʼƽִ̨....");
Map pushparameters = new HashMap<>(0);
pushparameters.put("buildstatus", buildstatus);
pushparameters.put("restartstatus", restartstatus);
@@ -56,7 +58,7 @@ public class HtmlMail {
HttpClientHelper.httpClientPostJson(pushurl, pushparameters, headmsg,ppt);
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ƽִ̨쳣飡", e);
+ LogUtil.APP.error("ƽִ̨쳣飡", e);
e.printStackTrace();
return fet.getText("task-body", parameters);
}
diff --git a/src/main/java/luckyclient/mail/MailSendInitialization.java b/src/main/java/luckyclient/mail/MailSendInitialization.java
index d29eb9a..709edd5 100644
--- a/src/main/java/luckyclient/mail/MailSendInitialization.java
+++ b/src/main/java/luckyclient/mail/MailSendInitialization.java
@@ -3,6 +3,8 @@ package luckyclient.mail;
import java.util.Properties;
import luckyclient.dblog.LogOperation;
+import luckyclient.publicclass.LogUtil;
+import luckyclient.publicclass.SysConfig;
import luckyclient.serverapi.entity.TaskScheduling;
/**
@@ -43,13 +45,13 @@ public class MailSendInitialization {
}
}
if (!isSend) {
- luckyclient.publicclass.LogUtil.APP.info("ǰҪʼ֪ͨ!");
+ LogUtil.APP.info("ǰҪʼ֪ͨ!");
return;
}
String[] addresses = LogOperation.getEmailAddress(taskid);
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ Properties properties = SysConfig.getConfiguration();
if (addresses != null) {
- luckyclient.publicclass.LogUtil.APP.info("Խʼ֪ͨԵȡ");
+ LogUtil.APP.info("Խʼ֪ͨԵȡ");
//Ҫʼ
MailSenderInfo mailInfo = new MailSenderInfo();
//Ҫʼ
@@ -75,12 +77,12 @@ public class MailSendInitialization {
}
String addressesmail = stringBuilder.toString();
if (sms.sendHtmlMail(mailInfo)) {
- luckyclient.publicclass.LogUtil.APP.info("" + addressesmail + "IJԽ֪ͨʼɣ");
+ LogUtil.APP.info("" + addressesmail + "IJԽ֪ͨʼɣ");
} else {
- luckyclient.publicclass.LogUtil.APP.error("" + addressesmail + "IJԽ֪ͨʼʧܣ");
+ LogUtil.APP.warn("" + addressesmail + "IJԽ֪ͨʼʧܣ");
}
} else {
- luckyclient.publicclass.LogUtil.APP.info("ǰҪʼ֪ͨ");
+ LogUtil.APP.info("ǰҪʼ֪ͨ");
}
}
diff --git a/src/main/java/luckyclient/mail/MailSenderInfo.java b/src/main/java/luckyclient/mail/MailSenderInfo.java
index 3a1f020..a5e8552 100644
--- a/src/main/java/luckyclient/mail/MailSenderInfo.java
+++ b/src/main/java/luckyclient/mail/MailSenderInfo.java
@@ -1,10 +1,12 @@
package luckyclient.mail;
-import com.sun.mail.util.MailSSLSocketFactory;
-
import java.security.GeneralSecurityException;
import java.util.Properties;
+import com.sun.mail.util.MailSSLSocketFactory;
+
+import luckyclient.publicclass.LogUtil;
+
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
@@ -76,7 +78,7 @@ public class MailSenderInfo {
p.put("mail.smtp.ssl.socketFactory", sf);
}
} catch (GeneralSecurityException e) {
- luckyclient.publicclass.LogUtil.APP.error("ʼỰʧܻ쳣: " + e.getMessage());
+ LogUtil.APP.error("ʼỰʧܻ쳣: " + e.getMessage());
return null;
}
return p;
diff --git a/src/main/java/luckyclient/mail/SimpleMailSender.java b/src/main/java/luckyclient/mail/SimpleMailSender.java
index 3860ae5..2091d97 100644
--- a/src/main/java/luckyclient/mail/SimpleMailSender.java
+++ b/src/main/java/luckyclient/mail/SimpleMailSender.java
@@ -15,6 +15,8 @@ import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
+import luckyclient.publicclass.LogUtil;
+
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
@@ -119,7 +121,7 @@ public class SimpleMailSender {
return true;
} catch (MessagingException ex) {
ex.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error(ex);
+ LogUtil.APP.error("ʼ쳣", ex);
}
return false;
}
diff --git a/src/main/java/luckyclient/publicclass/InvokeMethod.java b/src/main/java/luckyclient/publicclass/InvokeMethod.java
index 785731f..e072dae 100644
--- a/src/main/java/luckyclient/publicclass/InvokeMethod.java
+++ b/src/main/java/luckyclient/publicclass/InvokeMethod.java
@@ -47,12 +47,12 @@ public class InvokeMethod {
if (steptype == 2) {
if(functionname.toLowerCase().endsWith(".py")){
//Pythonű
- luckyclient.publicclass.LogUtil.APP.info("ʼPythonű......");
+ LogUtil.APP.info("ʼPythonű......");
result = callPy(packagename, functionname, getParameterValues);
}else{
//JAVA
// ÷Ǿ̬õ
- luckyclient.publicclass.LogUtil.APP.info("ʼJAVA......");
+ LogUtil.APP.info("ʼJAVA......");
Object server = Class.forName(packagename).newInstance();
@SuppressWarnings("rawtypes")
Class[] getParameterTypes = null;
@@ -78,16 +78,16 @@ public class InvokeMethod {
} else if (steptype == 0) {
if(null==extend||"".equals(extend)||!extend.contains("")){
result = "ǰHTTPȷǷûöӦHTTPЭģ...";
- luckyclient.publicclass.LogUtil.APP.error("ǰHTTPȷǷûöӦHTTPЭģ...");
+ LogUtil.APP.warn("ǰHTTPȷǷûöӦHTTPЭģ...");
return result;
}
String templateidstr = extend.substring(1, extend.indexOf(""));
String templatenamestr = extend.substring(extend.indexOf("") + 1);
- luckyclient.publicclass.LogUtil.APP.info("ʹģ塾" + templatenamestr + "ID:" + templateidstr + "HTTP");
+ LogUtil.APP.info("ʹģ塾" + templatenamestr + "ID:" + templateidstr + "HTTP");
ProjectProtocolTemplate ppt = GetServerAPI.clientGetProjectProtocolTemplateByTemplateId(Integer.valueOf(templateidstr));
if (null == ppt) {
- luckyclient.publicclass.LogUtil.APP.error("ЭģΪգʹõЭģǷѾɾ");
+ LogUtil.APP.warn("ЭģΪգʹõЭģǷѾɾ");
return "ЭģΪգȷʹõģǷѾɾ";
}
@@ -134,9 +134,9 @@ public class InvokeMethod {
if (key.contains("[") && key.endsWith("]")) {
index = Integer.valueOf(key.substring(key.lastIndexOf("[") + 1, key.lastIndexOf("]")));
key = key.substring(0, key.lastIndexOf("["));
- luckyclient.publicclass.LogUtil.APP.info("滻JSONеIJֵ滻ָ" + index + "...");
+ LogUtil.APP.info("滻JSONеIJֵ滻ָ" + index + "...");
} else {
- luckyclient.publicclass.LogUtil.APP.info("滻JSONеIJֵδָţĬ滻1...");
+ LogUtil.APP.info("滻JSONеIJֵδָţĬ滻1...");
}
if(ptp.getParamValue().contains("\""+key+"\":")){
@@ -145,34 +145,34 @@ public class InvokeMethod {
ptp.setParamValue(map.get("json"));
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("滻"+key+"...");
+ LogUtil.APP.info("滻"+key+"...");
break;
}
}else if(ptp.getParamValue().contains(key)){
ptp.setParamValue(ptp.getParamValue().replace(key, value));
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("鵱ǰıJSON,ַ"+ptp.getParamValue()+"ֱӰѡ"+key+"滻ɡ"+value+"...");
+ LogUtil.APP.info("鵱ǰıJSON,ַ"+ptp.getParamValue()+"ֱӰѡ"+key+"滻ɡ"+value+"...");
break;
}else{
- luckyclient.publicclass.LogUtil.APP.error("ĴıģǷJSONʽıǷ滻Ĺؼ֡");
+ LogUtil.APP.warn("ĴıģǷJSONʽıǷ滻Ĺؼ֡");
}
}else{
if (ptp.getParamName().equals(key)) {
ptp.setParamValue(value);
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("ģв"+key+"ֵóɡ"+value+"");
+ LogUtil.APP.info("ģв"+key+"ֵóɡ"+value+"");
break;
}
}
}
if(replaceflag==0){
- luckyclient.publicclass.LogUtil.APP.error(""+key+"ûģҵ滻IJӦĬֵ"
+ LogUtil.APP.warn(""+key+"ûģҵ滻IJӦĬֵ"
+ "ʧܣЭģд˲Ƿڡ");
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("滻ģͷʧܣԭΪûм#"
+ LogUtil.APP.warn("滻ģͷʧܣԭΪûм#"
+ "עHTTP滻ʽǡheadmsg(ͷ#ͷֵ)|#ֵ|2#ֵ2");
}
@@ -191,26 +191,26 @@ public class InvokeMethod {
if (ptp.getParamType() == 1) {
JSONObject json = JSONObject.parseObject(tempparam);
params.put(ptp.getParamName().replace(""", "\""), json);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONObjectͲֵ:" + json.toString() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONObjectͲֵ:" + json.toString() + "");
} else if (ptp.getParamType() == 2) {
JSONArray jarr = JSONArray.parseArray(tempparam);
params.put(ptp.getParamName().replace(""", "\""), jarr);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONArrayͲֵ:" + jarr.toString() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONArrayͲֵ:" + jarr.toString() + "");
} else if (ptp.getParamType() == 3) {
File file = new File(tempparam);
params.put(ptp.getParamName().replace(""", "\""), file);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " FileͲֵ:" + file.getAbsolutePath() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " FileͲֵ:" + file.getAbsolutePath() + "");
} else if (ptp.getParamType() == 4) {
Double dp = Double.valueOf(tempparam);
params.put(ptp.getParamName().replace(""", "\""), dp);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " Ͳֵ:" + tempparam + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " Ͳֵ:" + tempparam + "");
} else if (ptp.getParamType() == 5) {
Boolean bn = Boolean.valueOf(tempparam);
params.put(ptp.getParamName().replace(""", "\""), bn);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " BooleanͲֵ:" + bn + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " BooleanͲֵ:" + bn + "");
} else {
params.put(ptp.getParamName().replace(""", "\""), ptp.getParamValue().replace(""", "\""));
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " StringͲֵ:" + ptp.getParamValue().replace(""", "\"") + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " StringͲֵ:" + ptp.getParamValue().replace(""", "\"") + "");
}
}
@@ -240,17 +240,17 @@ public class InvokeMethod {
} else if (functionname.toLowerCase().equals("httpclientget")) {
result = HttpClientHelper.httpClientGet(packagename, params, headmsg, ppt);
} else {
- luckyclient.publicclass.LogUtil.APP.error("HTTP쳣IJǣ" + functionname);
+ LogUtil.APP.warn("HTTP쳣IJǣ" + functionname);
result = "쳣鿴־";
}
} else if (steptype == 4) {
String templateidstr = extend.substring(1, extend.indexOf(""));
String templatenamestr = extend.substring(extend.indexOf("") + 1);
- luckyclient.publicclass.LogUtil.APP.info("ʹģ塾" + templatenamestr + "ID:" + templateidstr + " SOCKET");
+ LogUtil.APP.info("ʹģ塾" + templatenamestr + "ID:" + templateidstr + " SOCKET");
ProjectProtocolTemplate ppt = GetServerAPI.clientGetProjectProtocolTemplateByTemplateId(Integer.valueOf(templateidstr));
if (null == ppt) {
- luckyclient.publicclass.LogUtil.APP.error("ЭģΪգʹõЭģǷѾɾ");
+ LogUtil.APP.warn("ЭģΪգʹõЭģǷѾɾ");
return "ЭģΪգȷʹõģǷѾɾ";
}
@@ -295,9 +295,9 @@ public class InvokeMethod {
if (key.indexOf("[") >= 0 && key.endsWith("]")) {
index = Integer.valueOf(key.substring(key.lastIndexOf("[") + 1, key.lastIndexOf("]")));
key = key.substring(0, key.lastIndexOf("["));
- luckyclient.publicclass.LogUtil.APP.info("滻JSONеIJֵδָţĬ滻1...");
+ LogUtil.APP.info("滻JSONеIJֵδָţĬ滻1...");
} else {
- luckyclient.publicclass.LogUtil.APP.info("滻JSONеIJֵ滻ָ" + index + "...");
+ LogUtil.APP.info("滻JSONеIJֵ滻ָ" + index + "...");
}
Map map=ChangString.changjson(ptp.getParamValue(), key, value,index);
@@ -305,34 +305,34 @@ public class InvokeMethod {
ptp.setParamValue(map.get("json"));
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("滻"+key+"...");
+ LogUtil.APP.info("滻"+key+"...");
break;
}
}else if(ptp.getParamValue().indexOf(key)>=0){
ptp.setParamValue(ptp.getParamValue().replace(key, value));
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("鵱ǰıJSON,ַ"+ptp.getParamValue()+"ֱӰѡ"+key+"滻ɡ"+value+"...");
+ LogUtil.APP.info("鵱ǰıJSON,ַ"+ptp.getParamValue()+"ֱӰѡ"+key+"滻ɡ"+value+"...");
break;
}else{
- luckyclient.publicclass.LogUtil.APP.error("ĴıģǷJSONʽıǷ滻Ĺؼ֡");
+ LogUtil.APP.warn("ĴıģǷJSONʽıǷ滻Ĺؼ֡");
}
}else{
if (ptp.getParamName().equals(key)) {
ptp.setParamValue(value);
paramslist.set(i, ptp);
replaceflag=1;
- luckyclient.publicclass.LogUtil.APP.info("ģв"+key+"ֵóɡ"+value+"");
+ LogUtil.APP.info("ģв"+key+"ֵóɡ"+value+"");
break;
}
}
}
if(replaceflag==0){
- luckyclient.publicclass.LogUtil.APP.error(""+key+"ûģҵ滻IJӦĬֵ"
+ LogUtil.APP.warn(""+key+"ûģҵ滻IJӦĬֵ"
+ "ʧܣЭģд˲Ƿڡ");
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("滻ģͷʧܣԭΪûм#"
+ LogUtil.APP.warn("滻ģͷʧܣԭΪûм#"
+ "עHTTP滻ʽǡheadmsg(ͷ#ͷֵ)|#ֵ|2#ֵ2");
}
@@ -349,26 +349,26 @@ public class InvokeMethod {
if (ptp.getParamType() == 1) {
JSONObject json = JSONObject.parseObject(tempparam);
params.put(ptp.getParamName().replace(""", "\""), json);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONObjectͲֵ:" + json.toString() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONObjectͲֵ:" + json.toString() + "");
} else if (ptp.getParamType() == 2) {
JSONArray jarr = JSONArray.parseArray(tempparam);
params.put(ptp.getParamName().replace(""", "\""), jarr);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONArrayͲֵ:" + jarr.toString() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " JSONArrayͲֵ:" + jarr.toString() + "");
} else if (ptp.getParamType() == 3) {
File file = new File(tempparam);
params.put(ptp.getParamName().replace(""", "\""), file);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " FileͲֵ:" + file.getAbsolutePath() + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " FileͲֵ:" + file.getAbsolutePath() + "");
} else if (ptp.getParamType() == 4) {
Double dp = Double.valueOf(tempparam);
params.put(ptp.getParamName().replace(""", "\""), dp);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " Ͳֵ:" + tempparam + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " Ͳֵ:" + tempparam + "");
} else if (ptp.getParamType() == 5) {
Boolean bn = Boolean.valueOf(tempparam);
params.put(ptp.getParamName().replace(""", "\""), bn);
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " BooleanͲֵ:" + bn + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " BooleanͲֵ:" + bn + "");
} else {
params.put(ptp.getParamName().replace(""", "\""), ptp.getParamValue().replace(""", "\""));
- luckyclient.publicclass.LogUtil.APP.info("ģ" + ptp.getParamName() + " StringͲֵ:" + ptp.getParamValue().replace(""", "\"") + "");
+ LogUtil.APP.info("ģ" + ptp.getParamName() + " StringͲֵ:" + ptp.getParamValue().replace(""", "\"") + "");
}
}
@@ -378,12 +378,12 @@ public class InvokeMethod {
} else if (functionname.toLowerCase().equals("socketget")) {
result = HttpClientHelper.sendSocketGet(packagename, params, ppt.getEncoding().toLowerCase(), headmsg);
} else {
- luckyclient.publicclass.LogUtil.APP.error("SOCKET쳣IJǣ" + functionname);
+ LogUtil.APP.warn("SOCKET쳣IJǣ" + functionname);
result = "쳣鿴־";
}
}
} catch (Throwable e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
return "쳣鿴־";
}
return result;
@@ -457,7 +457,7 @@ public class InvokeMethod {
args[1]=packagename+File.separator+functionname;
//args[1]="E:\\PycharmProjects\\untitled\\venv\\testaaa.py";
}
- luckyclient.publicclass.LogUtil.APP.info("Pythonű·:"+args[1]);
+ LogUtil.APP.info("Pythonű·:"+args[1]);
for(int i=0;i < params;i++){
args[2+i]=getParameterValues[i].toString();
}
@@ -479,16 +479,16 @@ public class InvokeMethod {
// ӡϢ
if(outerrStream.toString().equals("")){
result = outStream.toString().trim();
- luckyclient.publicclass.LogUtil.APP.info("ɹPythonűؽ:"+result);
+ LogUtil.APP.info("ɹPythonűؽ:"+result);
}else{
result = outerrStream.toString().trim();
if(result.indexOf("ModuleNotFoundError")>-1){
- luckyclient.publicclass.LogUtil.APP.error("Pythonű쳣PythonģδõPythonűעϵͳ·(: sys.path.append(\"E:\\PycharmProjects\\untitled\\venv\\Lib\\site-packages\"))"
+ LogUtil.APP.warn("Pythonű쳣PythonģδõPythonűעϵͳ·(: sys.path.append(\"E:\\PycharmProjects\\untitled\\venv\\Lib\\site-packages\"))"
+ "ϸϢ:"+result);
}else if(result.indexOf("No such file or directory")>-1){
- luckyclient.publicclass.LogUtil.APP.error("Pythonű쳣ָ·δҵPythonűԭпPythonű·ǴPythonָһ£ϸϢ:"+result);
+ LogUtil.APP.warn("Pythonű쳣ָ·δҵPythonűԭпPythonű·ǴPythonָһ£ϸϢ:"+result);
}else{
- luckyclient.publicclass.LogUtil.APP.error("Pythonű쳣Ϣ:"+result);
+ LogUtil.APP.warn("Pythonű쳣Ϣ:"+result);
}
}
}
diff --git a/src/main/java/luckyclient/publicclass/LogUtil.java b/src/main/java/luckyclient/publicclass/LogUtil.java
index 3d56aa3..ce08dd8 100644
--- a/src/main/java/luckyclient/publicclass/LogUtil.java
+++ b/src/main/java/luckyclient/publicclass/LogUtil.java
@@ -3,8 +3,8 @@ package luckyclient.publicclass;
import java.lang.reflect.Field;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* ϵͳ־¼
@@ -14,20 +14,12 @@ import org.apache.commons.logging.LogFactory;
public class LogUtil {
/**
- * ¼ϵͳ־ϵͳ
+ * Ҫʹ־info,warn,error
+ * info ¼ͻϵͳ־ؿͻ
+ * warn ¼ͻҵϵĸ澯־
+ * error ¼ͻִй׳쳣Լش
*/
- public static final Log APP = LogFactory.getLog("app");
-
- /**
- * ¼ҵ־ҵִ
- */
- public static final Log MSG = LogFactory.getLog("msg");
-
- /**
- * ¼ϵͳسǷ
- */
- public static final Log ERROR = LogFactory.getLog("error");
-
+ public static final Logger APP = LoggerFactory.getLogger("info");
public static StringBuffer getFieldValue(Object bean){
StringBuffer sb = new StringBuffer();
@@ -58,7 +50,7 @@ public class LogUtil {
}
}
catch(Exception ex){
- LogUtil.ERROR.error(ex,ex);
+ LogUtil.APP.error("־쳣",ex);
}
return sb;
}
diff --git a/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java b/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java
index b5c3a92..44d76ab 100644
--- a/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java
+++ b/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java
@@ -56,6 +56,7 @@ import org.apache.http.ssl.SSLContexts;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import luckyclient.publicclass.LogUtil;
import luckyclient.serverapi.entity.ProjectProtocolTemplate;
/**
@@ -86,12 +87,12 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
//
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLPost(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLPost(Ϊkey-value)...");
return "ЭģǴıʹsendHttpURLPost(Ϊkey-value)...";
}else{
for (Entry e : params.entrySet()) {
@@ -99,7 +100,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(e.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("HTTPURLPostϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
+ LogUtil.APP.info("HTTPURLPostϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
}
}
}
@@ -120,11 +121,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPURLPostͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPURLPostͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key, value);
}else{
con.setRequestProperty(key, value);
@@ -160,14 +161,14 @@ public class HttpClientHelper {
resultBuffer.append("Content-Length=0");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
osw = null;
throw new RuntimeException(e);
} finally {
@@ -181,7 +182,7 @@ public class HttpClientHelper {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
} finally {
@@ -213,11 +214,11 @@ public class HttpClientHelper {
StringBuffer resultBuffer = null;
//
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendURLPost(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendURLPost(Ϊkey-value)...");
return "ЭģǴıʹsendURLPost(Ϊkey-value)...";
}else{
for (Entry e : params.entrySet()) {
@@ -225,7 +226,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(e.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("URLPostϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
+ LogUtil.APP.info("URLPostϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
}
}
}
@@ -245,11 +246,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻URLPostͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻URLPostͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key, value);
}else{
con.setRequestProperty(key, value);
@@ -292,14 +293,14 @@ public class HttpClientHelper {
resultBuffer.append("Content-Length=0");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
osw = null;
throw new RuntimeException(e);
}
@@ -308,7 +309,7 @@ public class HttpClientHelper {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -327,7 +328,7 @@ public class HttpClientHelper {
*/
public static String sendGetAndSaveFile(String urlParam, Map params, String fileSavePath, Map headmsg,ProjectProtocolTemplate ppt) {
//
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
int timeout=ppt.getTimeout();
int responsehead=ppt.getIsResponseHead();
int responsecode=ppt.getIsResponseCode();
@@ -335,14 +336,14 @@ public class HttpClientHelper {
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendGetAndSaveFile(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendGetAndSaveFile(Ϊkey-value)...");
}else{
for (Entry entry : params.entrySet()) {
sbParams.append(entry.getKey());
sbParams.append("=");
sbParams.append(entry.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("HTTPSaveFileϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("HTTPSaveFileϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
}
@@ -362,11 +363,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPSaveFileͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPSaveFileͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key, value);
}else{
con.setRequestProperty(key, value);
@@ -394,14 +395,14 @@ public class HttpClientHelper {
os.flush();
return resultBuffer.toString()+"ļɹǰͻ·:" + fileSavePath + " 鿴";
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
os = null;
throw new RuntimeException(e);
} finally {
@@ -415,7 +416,7 @@ public class HttpClientHelper {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
} finally {
@@ -445,11 +446,11 @@ public class HttpClientHelper {
StringBuffer resultBuffer = null;
//
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLGet(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLGet(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLGet(Ϊkey-value)...";
}else{
for (Entry entry : params.entrySet()) {
@@ -457,7 +458,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(entry.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("HTTPURLGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("HTTPURLGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
}
@@ -476,11 +477,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPURLGetͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPURLGetͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key, value);
}else{
con.setRequestProperty(key, value);
@@ -506,14 +507,14 @@ public class HttpClientHelper {
resultBuffer.append("ȡӦ쳣!Ӧ룺"+con.getResponseCode());
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
} finally {
@@ -544,11 +545,11 @@ public class HttpClientHelper {
StringBuffer resultBuffer = null;
//
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendURLGet(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendURLGet(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendURLGet(Ϊkey-value)...";
}else{
for (Entry entry : params.entrySet()) {
@@ -556,7 +557,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(entry.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("URLGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("URLGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
@@ -579,11 +580,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻URLGetͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻URLGetͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key, value);
}else{
con.setRequestProperty(key, value);
@@ -610,14 +611,14 @@ public class HttpClientHelper {
resultBuffer.append("ȡӦ쳣!");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -645,7 +646,7 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
HttpPost httpPost = new HttpPost(urlParam);
httpPost.setHeader("Content-Type", "application/json");
@@ -658,11 +659,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPPostJsonͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPPostJsonͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpPost.setHeader(key, value);
}else{
httpPost.setHeader(key, value);
@@ -673,12 +674,12 @@ public class HttpClientHelper {
try {
if(params.size()>0){
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.info("ͣTEXT,HTTPPostJsonϢ..."+params.get("_forTextJson").toString()+"");
+ LogUtil.APP.info("ͣTEXT,HTTPPostJsonϢ..."+params.get("_forTextJson").toString()+"");
StringEntity entity = new StringEntity(params.get("_forTextJson").toString(),charset);
httpPost.setEntity(entity);
}else{
String jsonString = JSON.toJSONString(params);
- luckyclient.publicclass.LogUtil.APP.info("ͣFORM,HTTPPostJsonϢ..."+jsonString+"");
+ LogUtil.APP.info("ͣFORM,HTTPPostJsonϢ..."+jsonString+"");
StringEntity entity = new StringEntity(jsonString,charset);
httpPost.setEntity(entity);
}
@@ -707,14 +708,14 @@ public class HttpClientHelper {
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -743,7 +744,7 @@ public class HttpClientHelper {
StringBuffer resultBuffer = null;
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
HttpPost httpPost = new HttpPost(urlParam);
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(timeout)
@@ -754,11 +755,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPClientPostͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPClientPostͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpPost.setHeader(key, value);
}else{
httpPost.setHeader(key, value);
@@ -769,14 +770,14 @@ public class HttpClientHelper {
try {
if(params.size()>0){
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPost(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPost(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPost(Ϊkey-value)...";
}else{
//ƴӲ
List nvps = new ArrayList ();
for (Map.Entry m :params.entrySet()) {
nvps.add(new BasicNameValuePair(m.getKey(), m.getValue().toString()));
- luckyclient.publicclass.LogUtil.APP.info("HTTPClientPostϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
+ LogUtil.APP.info("HTTPClientPostϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
}
httpPost.setEntity(new UrlEncodedFormEntity(nvps,charset));
}
@@ -805,14 +806,14 @@ public class HttpClientHelper {
resultBuffer.append("ȡӦ쳣Ӧ룺"+response.getStatusLine().getStatusCode());
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -841,7 +842,7 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
HttpPost httpPost = new HttpPost(urlParam);
RequestConfig requestConfig = RequestConfig.custom()
@@ -853,11 +854,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻httpClientUploadFileͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻httpClientUploadFileͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpPost.setHeader(key, value);
}else{
httpPost.setHeader(key, value);
@@ -868,7 +869,7 @@ public class HttpClientHelper {
try {
if(params.size()>0){
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientUploadFile(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientUploadFile(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientUploadFile(Ϊkey-value)...";
}else{
//ƴӲ
@@ -879,10 +880,10 @@ public class HttpClientHelper {
for (Map.Entry m :params.entrySet()) {
if (m.getValue() instanceof File) {
entityBuilder.addBinaryBody(m.getKey(), (File)m.getValue());
- luckyclient.publicclass.LogUtil.APP.info("httpClientUploadFile ϴļϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
+ LogUtil.APP.info("httpClientUploadFile ϴļϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
}else{
entityBuilder.addTextBody(m.getKey(), m.getValue().toString());
- luckyclient.publicclass.LogUtil.APP.info("httpClientUploadFileϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
+ LogUtil.APP.info("httpClientUploadFileϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
}
}
HttpEntity reqEntity =entityBuilder.build();
@@ -913,14 +914,14 @@ public class HttpClientHelper {
resultBuffer.append("ȡӦ쳣Ӧ룺"+response.getStatusLine().getStatusCode());
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -948,14 +949,14 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
BufferedReader br = null;
//
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientGet(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientGet(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientGet(Ϊkey-value)...";
}else{
for (Entry entry : params.entrySet()) {
@@ -964,11 +965,11 @@ public class HttpClientHelper {
try {
sbParams.append(URLEncoder.encode(String.valueOf(entry.getValue()), charset));
} catch (UnsupportedEncodingException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
}
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("HTTPClientGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("HTTPClientGetϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
@@ -986,11 +987,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPClientGetͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPClientGetͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpGet.setHeader(key, value);
}else{
httpGet.setHeader(key, value);
@@ -1018,14 +1019,14 @@ public class HttpClientHelper {
resultBuffer.append(temp);
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -1045,12 +1046,12 @@ public class HttpClientHelper {
public static String sendSocketPost(String urlParam, Map params, String charset,
Map headmsg) {
String result = "";
- luckyclient.publicclass.LogUtil.APP.info("Socketַ:"+urlParam+"");
+ LogUtil.APP.info("Socketַ:"+urlParam+"");
//
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketPost(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketPost(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketPost(Ϊkey-value)...";
}else{
for (Entry entry : params.entrySet()) {
@@ -1058,7 +1059,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(entry.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("SocketPostϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("SocketPostϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
}
@@ -1083,11 +1084,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻SocketͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻SocketͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
sb.append(key+": "+value+" \r\n");
}else{
sb.append(key+": "+value+" \r\n");
@@ -1118,14 +1119,14 @@ public class HttpClientHelper {
// ȡӦݣҪݣ
result = readLine(is, contentLength, charset);
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
osw = null;
throw new RuntimeException(e);
} finally {
@@ -1133,7 +1134,7 @@ public class HttpClientHelper {
try {
socket.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
socket = null;
throw new RuntimeException(e);
}
@@ -1144,7 +1145,7 @@ public class HttpClientHelper {
try {
is.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
is = null;
throw new RuntimeException(e);
} finally {
@@ -1153,7 +1154,7 @@ public class HttpClientHelper {
socket.close();
} catch (IOException e) {
socket = null;
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
@@ -1173,12 +1174,12 @@ public class HttpClientHelper {
*/
public static String sendSocketGet(String urlParam, Map params, String charset,Map headmsg) {
String result = "";
- luckyclient.publicclass.LogUtil.APP.info("Socketַ:"+urlParam+"");
+ LogUtil.APP.info("Socketַ:"+urlParam+"");
//
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketGet(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketGet(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendSocketGet(Ϊkey-value)...";
}else{
for (Entry entry : params.entrySet()) {
@@ -1186,7 +1187,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(entry.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("SocketPostϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
+ LogUtil.APP.info("SocketPostϢ...key:"+entry.getKey()+" value:"+entry.getValue()+"");
}
}
@@ -1212,11 +1213,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻SocketͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻SocketͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
sb.append(key+": "+value+" \r\n");
}else{
sb.append(key+": "+value+" \r\n");
@@ -1247,14 +1248,14 @@ public class HttpClientHelper {
// ȡӦݣҪݣ
result = readLine(is, contentLength, charset);
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
osw = null;
throw new RuntimeException(e);
} finally {
@@ -1262,7 +1263,7 @@ public class HttpClientHelper {
try {
socket.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
socket = null;
throw new RuntimeException(e);
}
@@ -1273,7 +1274,7 @@ public class HttpClientHelper {
try {
is.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
is = null;
throw new RuntimeException(e);
} finally {
@@ -1281,7 +1282,7 @@ public class HttpClientHelper {
try {
socket.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
socket = null;
throw new RuntimeException(e);
}
@@ -1343,11 +1344,11 @@ public class HttpClientHelper {
StringBuffer resultBuffer = null;
//
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
StringBuffer sbParams = new StringBuffer();
if (params != null && params.size() > 0) {
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLDel(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLDel(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹsendHttpURLDel(Ϊkey-value)...";
}else{
for (Entry e : params.entrySet()) {
@@ -1355,7 +1356,7 @@ public class HttpClientHelper {
sbParams.append("=");
sbParams.append(e.getValue());
sbParams.append("&");
- luckyclient.publicclass.LogUtil.APP.info("HttpURLDelϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
+ LogUtil.APP.info("HttpURLDelϢ...key:"+e.getKey()+" value:"+e.getValue()+"");
}
}
}
@@ -1375,11 +1376,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
con.setRequestProperty(key,value);
}else{
con.setRequestProperty(key,value);
@@ -1412,14 +1413,14 @@ public class HttpClientHelper {
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (osw != null) {
try {
osw.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
osw = null;
throw new RuntimeException(e);
} finally {
@@ -1433,7 +1434,7 @@ public class HttpClientHelper {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
} finally {
@@ -1468,7 +1469,7 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
HttpPut httpput = new HttpPut(urlParam);
httpput.setHeader("Content-Type", "application/json");
@@ -1481,11 +1482,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpput.setHeader(key,value);
}else{
httpput.setHeader(key,value);
@@ -1496,12 +1497,12 @@ public class HttpClientHelper {
try {
if(params.size()>0){
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.info("ͣTEXT,HTTPClientPutJsonϢ..."+params.get("_forTextJson").toString()+"");
+ LogUtil.APP.info("ͣTEXT,HTTPClientPutJsonϢ..."+params.get("_forTextJson").toString()+"");
StringEntity entity = new StringEntity(params.get("_forTextJson").toString(),charset);
httpput.setEntity(entity);
}else{
String jsonString = JSON.toJSONString(params);
- luckyclient.publicclass.LogUtil.APP.info("ͣFORM,HTTPClientPutJsonϢ..."+jsonString+"");
+ LogUtil.APP.info("ͣFORM,HTTPClientPutJsonϢ..."+jsonString+"");
StringEntity entity = new StringEntity(jsonString,charset);
httpput.setEntity(entity);
}
@@ -1531,14 +1532,14 @@ public class HttpClientHelper {
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -1566,7 +1567,7 @@ public class HttpClientHelper {
int responsecode=ppt.getIsResponseCode();
StringBuffer resultBuffer = null;
- luckyclient.publicclass.LogUtil.APP.info("HTTPַ:"+urlParam+"");
+ LogUtil.APP.info("HTTPַ:"+urlParam+"");
CloseableHttpClient httpclient=iniHttpClient(urlParam,cerpath);
HttpPut httpput = new HttpPut(urlParam);
RequestConfig requestConfig = RequestConfig.custom()
@@ -1578,11 +1579,11 @@ public class HttpClientHelper {
for (Map.Entry m :headmsg.entrySet()) {
String key=m.getKey();
String value=m.getValue();
- luckyclient.publicclass.LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
+ LogUtil.APP.info("ʼ|滻HTTPͷϢ...key:"+key+" value:"+value+"");
if(null!=value&&value.indexOf("Base64(")==0){
String valuesub=value.substring(value.indexOf("Base64(")+7,value.lastIndexOf(")"));
value="Basic " + DatatypeConverter.printBase64Binary((valuesub).getBytes());
- luckyclient.publicclass.LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
+ LogUtil.APP.info("ͷ"+key+"ֵ"+value+"FORMATBASE64ʽ...");
httpput.setHeader(key,value);
}else{
httpput.setHeader(key,value);
@@ -1593,14 +1594,14 @@ public class HttpClientHelper {
try {
if(params.size()>0){
if(1==params.size()&¶ms.containsKey("_forTextJson")){
- luckyclient.publicclass.LogUtil.APP.error("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPut(Ϊkey-value)...");
+ LogUtil.APP.warn("ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPut(Ϊkey-value)...");
return "ЭģǴıģʽ(httpClientPostJsonԼhttpClientPutJson)ʹhttpClientPut(Ϊkey-value)...";
}else{
//ƴӲ
List nvps = new ArrayList ();
for (Map.Entry m :params.entrySet()) {
nvps.add(new BasicNameValuePair(m.getKey(), m.getValue().toString()));
- luckyclient.publicclass.LogUtil.APP.info("ʼHTTPClientPutϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
+ LogUtil.APP.info("ʼHTTPClientPutϢ...key:"+m.getKey()+" value:"+m.getValue()+"");
}
httpput.setEntity(new UrlEncodedFormEntity(nvps,charset));
}
@@ -1630,14 +1631,14 @@ public class HttpClientHelper {
}
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
@@ -1656,12 +1657,12 @@ public class HttpClientHelper {
SSLContext sslContext = null;
FileInputStream instream = null;
KeyStore trustStore = null;
- luckyclient.publicclass.LogUtil.APP.info("֤·"+keyStorePath+" Կ"+keyStorepass);
+ LogUtil.APP.info("֤·"+keyStorePath+" Կ"+keyStorepass);
try {
trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
- luckyclient.publicclass.LogUtil.APP.info("ʼȡ֤ļ...");
+ LogUtil.APP.info("ʼȡ֤ļ...");
instream = new FileInputStream(new File(keyStorePath));
- luckyclient.publicclass.LogUtil.APP.info("ʼ֤ԼԿ...");
+ LogUtil.APP.info("ʼ֤ԼԿ...");
trustStore.load(instream, keyStorepass.toCharArray());
// ԼCAǩ֤
sslContext = SSLContexts.custom().loadTrustMaterial(trustStore, new TrustSelfSignedStrategy()).build();
@@ -1673,12 +1674,12 @@ public class HttpClientHelper {
sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tms, new java.security.SecureRandom());
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
} finally {
try {
instream.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
}
}
return sslContext;
@@ -1701,12 +1702,12 @@ public class HttpClientHelper {
//ƹ֤ķʽhttps
SSLContext sslContext=null;
if(null==cerpath||"".equals(cerpath.trim())){
- luckyclient.publicclass.LogUtil.APP.info("ʼHTTPS֤...");
+ LogUtil.APP.info("ʼHTTPS֤...");
TrustManager[] trustManagers = {new MyX509TrustManager()};
sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, trustManagers, new SecureRandom());
}else{
- luckyclient.publicclass.LogUtil.APP.info("ʼHTTPS˫֤...");
+ LogUtil.APP.info("ʼHTTPS˫֤...");
String strcerpath[]=cerpath.split(";",-1);
sslContext = sslContextKeyStore(strcerpath[0], strcerpath[1]);
}
diff --git a/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java b/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java
index fb07cb7..fa08478 100644
--- a/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java
+++ b/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java
@@ -20,6 +20,9 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
+import luckyclient.publicclass.LogUtil;
+import luckyclient.publicclass.SysConfig;
+
/**
* =================================================================
* һƵκδǰ¶Գĺҵ;ҲԳĺκʽκĿĵٷ
@@ -32,7 +35,7 @@ import org.apache.http.impl.client.HttpClients;
*
*/
public class HttpRequest {
- final static Properties PROPERTIES = luckyclient.publicclass.SysConfig.getConfiguration();
+ final static Properties PROPERTIES = SysConfig.getConfiguration();
private final static String WEB_URL = "http://" + PROPERTIES.getProperty("server.web.ip") + ":"
+ PROPERTIES.getProperty("server.web.port");
@@ -59,14 +62,14 @@ public class HttpRequest {
resultBuffer.append(temp);
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- luckyclient.publicclass.LogUtil.APP.error(e.getMessage(), e);
+ LogUtil.APP.error(e.getMessage(), e);
br = null;
throw new RuntimeException(e);
}
diff --git a/src/main/java/springboot/HttpImpl.java b/src/main/java/springboot/HttpImpl.java
index 577a22a..aa8cfd1 100644
--- a/src/main/java/springboot/HttpImpl.java
+++ b/src/main/java/springboot/HttpImpl.java
@@ -19,6 +19,8 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FilenameUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -28,6 +30,7 @@ import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import luckyclient.publicclass.SysConfig;
import luckyclient.publicclass.remoterinterface.HttpRequest;
import luckyclient.serverapi.entity.monitor.Server;
import springboot.model.RunBatchCaseEntity;
@@ -45,7 +48,7 @@ import springboot.model.WebDebugCaseEntity;
*/
@RestController
public class HttpImpl {
-
+ private static final Logger log = LoggerFactory.getLogger(HttpImpl.class);
private static final String os=System.getProperty("os.name").toLowerCase();
/**
* Զ
@@ -66,38 +69,37 @@ public class HttpImpl {
} catch (IOException e) {
e.printStackTrace();
}
- luckyclient.publicclass.LogUtil.APP.info("ʼתRunTaskEntityִʵ...");
+ log.info("ʼתRunTaskEntityִʵ...");
RunTaskEntity runTaskEntity = JSONObject.parseObject(sb.toString(), RunTaskEntity.class);
- luckyclient.publicclass.LogUtil.APP.info("TaskId:"+runTaskEntity.getTaskId()
+ log.info("TaskId:"+runTaskEntity.getTaskId()
+" SchedulingName:"+runTaskEntity.getSchedulingName()+" LoadPath:"+runTaskEntity.getLoadPath());
try{
- luckyclient.publicclass.LogUtil.APP.info("ʼȡͻ·...");
+ log.info("ʼȡͻ·...");
File file =new File(System.getProperty("user.dir")+runTaskEntity.getLoadPath());
- luckyclient.publicclass.LogUtil.APP.info("ͻ·"+file.getAbsolutePath());
+ log.info("ͻ·"+file.getAbsolutePath());
if (!file .isDirectory())
{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˲·ڣ顾"+file.getPath()+"");
+ log.warn("ͻ˲·ڣ顾"+file.getPath()+"");
return "ͻ˲·ڣ顾"+file.getPath()+"";
}
- luckyclient.publicclass.LogUtil.APP.info("ʼRuntime...");
+ log.info("ʼRuntime...");
Runtime run = Runtime.getRuntime();
StringBuffer sbf=new StringBuffer();
sbf.append(runTaskEntity.getTaskId()).append(" ");
sbf.append(runTaskEntity.getLoadPath());
- luckyclient.publicclass.LogUtil.APP.info("ģʽԳ...ƣ"+runTaskEntity.getSchedulingName()+" ID"+runTaskEntity.getTaskId());
+ log.info("ģʽԳ...ƣ"+runTaskEntity.getSchedulingName()+" ID"+runTaskEntity.getTaskId());
if(os.startsWith("win")){
- luckyclient.publicclass.LogUtil.APP.info("ʼwindowsд...");
+ log.info("ʼwindowsд...");
run.exec("cmd.exe /k start " + "task.cmd" +" "+ sbf.toString(), null,new File(System.getProperty("user.dir")+File.separator));
- luckyclient.publicclass.LogUtil.APP.info("windowsд...");
+ log.info("windowsд...");
}else{
- luckyclient.publicclass.LogUtil.APP.info("ʼLinuxű...");
+ log.info("ʼLinuxű...");
Process ps = Runtime.getRuntime().exec(System.getProperty("user.dir")+File.separator+"task.sh"+ " " +sbf.toString());
ps.waitFor();
- luckyclient.publicclass.LogUtil.APP.info("Linuxű...");
+ log.info("Linuxű...");
}
- } catch (Exception e) {
- e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ģʽԳ쳣",e);
+ } catch (Exception e) {
+ log.error("ģʽԳ쳣",e);
return "ģʽԳ쳣";
}
return "ģʽԳ";
@@ -129,13 +131,13 @@ public class HttpImpl {
String loadpath = jsonObject.getString("loadpath");
String testCaseExternalId = jsonObject.getString("testCaseExternalId");
String version = jsonObject.getString("version");
- luckyclient.publicclass.LogUtil.APP.info("ģʽԳ...Ŀ"+projectname+" ID"+taskid);
- luckyclient.publicclass.LogUtil.APP.info("ţ"+testCaseExternalId+" 汾"+version);
+ log.info("ģʽԳ...Ŀ"+projectname+" ID"+taskid);
+ log.info("ţ"+testCaseExternalId+" 汾"+version);
try{
File file =new File(System.getProperty("user.dir")+loadpath);
if (!file .isDirectory())
{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˲·ڣ顾"+file.getPath()+"");
+ log.warn("ͻ˲·ڣ顾"+file.getPath()+"");
return "ͻ˲·ڣ顾"+file.getPath()+"";
}
Runtime run = Runtime.getRuntime();
@@ -152,7 +154,7 @@ public class HttpImpl {
}
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ģʽԳ쳣",e);
+ log.error("ģʽԳ쳣",e);
return "ģʽԳ쳣";
}
return "ģʽԳ";
@@ -176,43 +178,43 @@ public class HttpImpl {
} catch (IOException e) {
e.printStackTrace();
}
- luckyclient.publicclass.LogUtil.APP.info("ʼתRunBatchCaseEntityִʵ...");
+ log.info("ʼתRunBatchCaseEntityִʵ...");
RunBatchCaseEntity runBatchCaseEntity = JSONObject.parseObject(sbd.toString(), RunBatchCaseEntity.class);
String projectName = runBatchCaseEntity.getProjectname();
String taskId = runBatchCaseEntity.getTaskid();
String loadPath = runBatchCaseEntity.getLoadpath();
String batchCase = runBatchCaseEntity.getBatchcase();
- luckyclient.publicclass.LogUtil.APP.info(""+batchCase);
+ log.info(""+batchCase);
try{
- luckyclient.publicclass.LogUtil.APP.info("ʼȡͻ·...");
+ log.info("ʼȡͻ·...");
File file =new File(System.getProperty("user.dir")+loadPath);
- luckyclient.publicclass.LogUtil.APP.info("ͻ·"+file.getAbsolutePath());
+ log.info("ͻ·"+file.getAbsolutePath());
if (!file .isDirectory())
{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˲·ڣ顾"+file.getPath()+"");
+ log.warn("ͻ˲·ڣ顾"+file.getPath()+"");
return "ͻ˲·ڣ顾"+file.getPath()+"";
}
- luckyclient.publicclass.LogUtil.APP.info("ʼRuntime...");
+ log.info("ʼRuntime...");
Runtime run = Runtime.getRuntime();
StringBuffer sb=new StringBuffer();
sb.append(taskId).append(" ");
sb.append(batchCase).append(" ");
sb.append(loadPath);
- luckyclient.publicclass.LogUtil.APP.info("ģʽԳ...Ŀ"+projectName+" ID"+taskId);
+ log.info("ģʽԳ...Ŀ"+projectName+" ID"+taskId);
if(os.startsWith("win")){
- luckyclient.publicclass.LogUtil.APP.info("ʼwindowsд...");
+ log.info("ʼwindowsд...");
run.exec("cmd.exe /k start " + "task_batch.cmd" + " " +sb.toString(), null,new File(System.getProperty("user.dir")+File.separator));
- luckyclient.publicclass.LogUtil.APP.info("windowsд...");
+ log.info("windowsд...");
}else{
- luckyclient.publicclass.LogUtil.APP.info("ʼLinuxű...");
+ log.info("ʼLinuxű...");
Process ps = Runtime.getRuntime().exec(System.getProperty("user.dir")+File.separator+"task_batch.sh"+ " " +sb.toString());
ps.waitFor();
- luckyclient.publicclass.LogUtil.APP.info("Linuxű...");
+ log.info("Linuxű...");
}
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ģʽԳ쳣",e);
+ log.error("ģʽԳ쳣",e);
return "ģʽԳ쳣";
}
return "ģʽԳ";
@@ -237,12 +239,12 @@ public class HttpImpl {
e.printStackTrace();
}
WebDebugCaseEntity webDebugCaseEntity = JSONObject.parseObject(sbd.toString(), WebDebugCaseEntity.class);
- luckyclient.publicclass.LogUtil.APP.info("Web˵ID"+webDebugCaseEntity.getCaseId()+" ID"+webDebugCaseEntity.getUserId());
+ log.info("Web˵ID"+webDebugCaseEntity.getCaseId()+" ID"+webDebugCaseEntity.getUserId());
try{
File file =new File(System.getProperty("user.dir")+webDebugCaseEntity.getLoadpath());
if (!file .isDirectory())
{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˲·ڣ顾"+file.getPath()+"");
+ log.warn("ͻ˲·ڣ顾"+file.getPath()+"");
return "ͻ˲·ڣ顾"+file.getPath()+"";
}
Runtime run = Runtime.getRuntime();
@@ -258,7 +260,7 @@ public class HttpImpl {
}
} catch (Exception e) {
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("WebģʽԳ쳣",e);
+ log.error("WebģʽԳ쳣",e);
return "WebģʽԳ쳣";
}
return "WebģʽԳ";
@@ -286,7 +288,7 @@ public class HttpImpl {
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ȡ־·ͻ־·Ƿ!downLoadPath: "+downLoadPath,e);
+ log.error("ȡ־·ͻ־·Ƿ!downLoadPath: "+downLoadPath,e);
return "ȡ־·ͻ־·Ƿ!downLoadPath: "+downLoadPath;
}
BufferedReader bos = new BufferedReader(isr);
@@ -297,11 +299,11 @@ public class HttpImpl {
sb.append(str).append("##n##");
}
bos.close();
- luckyclient.publicclass.LogUtil.APP.info("˶ȡ־ɹ!");
+ log.info("˶ȡ־ɹ!");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ͻתBufferedReaderʧܣԭ",e);
+ log.error("ͻתBufferedReaderʧܣԭ",e);
return "ͻתBufferedReaderʧܣԭ";
}
return sb.toString();
@@ -325,11 +327,11 @@ public class HttpImpl {
BufferedInputStream is = new BufferedInputStream(new FileInputStream(file));
is.read(b);
is.close();
- luckyclient.publicclass.LogUtil.APP.info("˻ȡͼƬ"+downLoadPath);
+ log.info("˻ȡͼƬ"+downLoadPath);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ļڣ飺"+downLoadPath,e);
+ log.error("ļڣ飺"+downLoadPath,e);
return b;
} catch (IOException e) {
// TODO Auto-generated catch block
@@ -344,11 +346,11 @@ public class HttpImpl {
if (!jarfile.isEmpty()){
if (!FilenameUtils.getExtension(jarfile.getOriginalFilename())
.equalsIgnoreCase("jar")) {
- luckyclient.publicclass.LogUtil.APP.error("ļʽ.jarϴʧ");
+ log.warn("ļʽ.jarϴʧ");
return "ļʽ.jarϴʧ";
}
}else{
- luckyclient.publicclass.LogUtil.APP.error("ϴļΪգ飡");
+ log.warn("ϴļΪգ飡");
return "ϴļΪգ飡";
}
@@ -357,7 +359,7 @@ public class HttpImpl {
String path = System.getProperty("user.dir")+loadpath;
if (!new File(path) .isDirectory())
{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˲·ڣ顾"+path+"");
+ log.warn("ͻ˲·ڣ顾"+path+"");
return "ͻ˲·ڣ顾"+path+"";
}
String pathName = path +File.separator+ name;
@@ -373,17 +375,17 @@ public class HttpImpl {
os.write(jarfileByte);
os.flush();
os.close();
- luckyclient.publicclass.LogUtil.APP.info("ϴJAR"+name+"ͻĿ¼"+file.getAbsolutePath()+"ɹ!");
+ log.info("ϴJAR"+name+"ͻĿ¼"+file.getAbsolutePath()+"ɹ!");
return "ϴJAR"+name+"ͻĿ¼"+file.getAbsolutePath()+"ɹ!";
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ͻδҵȷ·ļϴʧܣļ·ƣ"+pathName,e);
+ log.error("ͻδҵȷ·ļϴʧܣļ·ƣ"+pathName,e);
return "ͻδҵȷ·ļϴʧܣļ·ƣ"+pathName;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- luckyclient.publicclass.LogUtil.APP.error("ͻIOExceptionaδҵ·ļ·ƣ"+pathName,e);
+ log.error("ͻIOExceptionaδҵ·ļ·ƣ"+pathName,e);
return "ͻIOExceptionaδҵ·ļ·ƣ"+pathName;
}
}
@@ -396,7 +398,7 @@ public class HttpImpl {
*/
@GetMapping("/getClientStatus")
private String getClientStatus(HttpServletRequest req) throws RemoteException{
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ Properties properties = SysConfig.getConfiguration();
String verison=properties.getProperty("client.verison");
return "{\"status\":\"success\",\"version\":\""+verison+"\"}";
}
@@ -423,31 +425,26 @@ public class HttpImpl {
* @date 201956
*/
public static boolean checkHostNet() {
- luckyclient.publicclass.LogUtil.APP.info("ͻ,Ժ......");
- Properties properties = luckyclient.publicclass.SysConfig.getConfiguration();
+ log.info("ͻ,Ժ......");
+ Properties properties = SysConfig.getConfiguration();
String version=properties.getProperty("client.verison");
String webip=properties.getProperty("server.web.ip");
Integer webport=Integer.valueOf(properties.getProperty("server.web.port"));
try {
String result = HttpRequest.loadJSON("/openGetApi/clientGetServerVersion.do");
if(version.equals(result)){
- luckyclient.publicclass.LogUtil.APP.info("ͻ˷Webã"+webip+":"+webport+" ͨ......");
+ log.info("ͻ˷Webã"+webip+":"+webport+" ͨ......");
}else{
- luckyclient.publicclass.LogUtil.APP.error("ͻ˰汾"+version);
- luckyclient.publicclass.LogUtil.APP.error("˰汾"+result);
- luckyclient.publicclass.LogUtil.APP.error("ͻ˰汾һ£пܻᵼδ֪⣬...");
+ log.warn("ͻ˰汾"+version);
+ log.warn("˰汾"+result);
+ log.warn("ͻ˰汾һ£пܻᵼδ֪⣬...");
}
} catch (Exception e) {
- luckyclient.publicclass.LogUtil.APP.error("ͻü쳣ȷĿĿ¼µĿͻļ(sys_config.properties)ǷѾȷá",e);
+ log.error("ͻü쳣ȷĿĿ¼µĿͻļ(sys_config.properties)ǷѾȷá",e);
return false;
}
return true;
}
-
- public static void main(String[] args) throws Exception {
- // TODO Auto-generated method stub
- checkHostNet();
- }
}
diff --git a/src/main/java/springboot/RunService.java b/src/main/java/springboot/RunService.java
index 4e91bfd..8e169fa 100644
--- a/src/main/java/springboot/RunService.java
+++ b/src/main/java/springboot/RunService.java
@@ -5,6 +5,8 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import org.apache.log4j.PropertyConfigurator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -20,15 +22,16 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RunService {
+ private static final Logger log = LoggerFactory.getLogger(RunService.class);
public static void main(String[] args) {
// TODO Auto-generated method stub
PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator +"bootlog4j.conf");
SpringApplication.run(RunService.class, args);
try {
String host = InetAddress.getLocalHost().getHostAddress();
- luckyclient.publicclass.LogUtil.APP.info("ͻ˼,Ժ......IP"+host);
+ log.info("ͻ˼,Ժ......IP"+host);
} catch (UnknownHostException e) {
- luckyclient.publicclass.LogUtil.APP.error("ȡIP쳣......", e);
+ log.error("ȡIP쳣......", e);
}
HttpImpl.checkHostNet();
}