From 7bb87e75855016a91518f9446ff84f3d610fd6b5 Mon Sep 17 00:00:00 2001 From: seagull <24163551@qq.com> Date: Thu, 7 Nov 2019 10:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BB=A5=E5=8F=8A=E7=B1=BB=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 + src/main/Resources/application.properties | 2 - src/main/Resources/findJAR.cmd | 2 +- src/main/Resources/sys_config.properties | 13 +- src/main/Resources/task.cmd | 2 +- src/main/Resources/task.sh | 2 +- src/main/Resources/task_batch.cmd | 2 +- src/main/Resources/task_batch.sh | 2 +- src/main/Resources/task_onecase.cmd | 2 +- src/main/Resources/task_onecase.sh | 2 +- src/main/Resources/web_debugcase.cmd | 2 +- src/main/Resources/web_debugcase.sh | 2 +- .../publicdispose/ActionManageForSteps.java | 84 --------- src/main/java/luckyclient/dblog/DbLink.java | 21 --- .../java/luckyclient/driven/SubString.java | 4 +- .../BatchCaseExecute.java | 22 +-- .../OneCaseExecute.java | 22 +-- .../RunAutomationTest.java | 16 +- .../WebDebugExecute.java | 8 +- .../appium}/AppDriverAnalyticCase.java | 14 +- .../appium}/AppTestControl.java | 49 +++--- .../appium}/AppiumInitialization.java | 2 +- .../appium}/AppiumService.java | 6 +- .../appium}/androidex/AndroidBaseAppium.java | 4 +- .../androidex/AndroidBatchExecute.java | 35 ++-- .../androidex/AndroidCaseExecution.java | 32 ++-- .../androidex/AndroidCaseLocalDebug.java | 19 +- .../AndroidEncapsulateOperation.java | 6 +- .../androidex/AndroidOneCaseExecute.java | 31 ++-- .../appium}/iosex/IosBaseAppium.java | 4 +- .../appium}/iosex/IosBatchExecute.java | 35 ++-- .../appium}/iosex/IosCaseExecution.java | 32 ++-- .../appium}/iosex/IosCaseLocalDebug.java | 19 +- .../iosex/IosEncapsulateOperation.java | 6 +- .../appium}/iosex/IosOneCaseExecute.java | 31 ++-- .../dispose}/ActionContext.java | 126 +++++++------- .../dispose}/ChangString.java | 4 +- .../dispose}/ParamsManageForSteps.java | 9 +- .../dispose}/actionkeyword/Action.java | 34 ++-- .../actionkeyword/ActionKeyWordParser.java | 2 +- .../actionkeyword/GetJsonActionParser.java | 4 +- .../dispose}/actionkeyword/HeaderParser.java | 58 +++---- .../actionkeyword/JsonPathActionParser.java | 4 +- .../SubCentreNumActionParser.java | 68 ++++---- .../SubCentresStrActionParser.java | 4 +- .../actionkeyword/SubStrRegxActionParser.java | 70 ++++---- .../actionkeyword/ThreadWaitAction.java | 76 ++++---- .../httpinterface}/ApiTestCaseDebug.java | 20 +-- .../BatchTestCaseExecution.java | 12 +- .../httpinterface}/TestCaseExecution.java | 49 +++--- .../httpinterface}/TestControl.java | 41 +++-- .../httpinterface}/ThreadForBatchCase.java | 2 +- .../httpinterface}/ThreadForExecuteCase.java | 26 +-- .../httpinterface}/WebTestCaseDebug.java | 20 +-- .../analyticsteps/InterfaceAnalyticCase.java | 14 +- .../webdriver}/BaseWebDrive.java | 4 +- .../webdriver}/CaseLocalDebug.java | 21 ++- .../webdriver}/EncapsulateOperation.java | 8 +- .../webdriver}/TestGoogle.java | 2 +- .../webdriver}/WebDriverInitialization.java | 4 +- .../webdriver}/WebTestControl.java | 47 +++-- .../webdriver}/ex/WebBatchExecute.java | 33 ++-- .../webdriver}/ex/WebCaseExecution.java | 32 ++-- .../webdriver}/ex/WebDriverAnalyticCase.java | 14 +- .../webdriver}/ex/WebOneCaseExecute.java | 29 ++-- .../webdriver}/ocr/Ocr.java | 2 +- .../api/GetServerApi.java | 20 +-- .../api/PostServerApi.java | 10 +- .../api/serverOperation.java} | 17 +- .../entity/BaseEntity.java | 2 +- .../{serverapi => remote}/entity/Project.java | 2 +- .../entity/ProjectCase.java | 2 +- .../entity/ProjectCaseDebug.java | 2 +- .../entity/ProjectCaseModule.java | 2 +- .../entity/ProjectCaseParams.java | 2 +- .../entity/ProjectCaseSteps.java | 2 +- .../entity/ProjectPlan.java | 2 +- .../entity/ProjectPlanCase.java | 2 +- .../entity/ProjectProtocolTemplate.java | 2 +- .../entity/ProjectTemplateParams.java | 2 +- .../entity/TaskCaseExecute.java | 2 +- .../entity/TaskCaseLog.java | 2 +- .../entity/TaskExecute.java | 2 +- .../entity/TaskScheduling.java | 2 +- .../entity/monitor/Arith.java | 2 +- .../entity/monitor/Cpu.java | 2 +- .../entity/monitor/IpUtils.java | 2 +- .../entity/monitor/Jvm.java | 4 +- .../entity/monitor/Mem.java | 2 +- .../entity/monitor/Server.java | 2 +- .../entity/monitor/Sys.java | 2 +- .../entity/monitor/SysFile.java | 2 +- .../jenkins}/BuildingInitialization.java | 8 +- .../tool/jenkins/JenkinsBaseApi.java | 164 ++++++++++++++++++ .../jenkins}/JenkinsBuilding.java | 4 +- .../tool/jenkins/JenkinsConnect.java | 69 ++++++++ .../luckyclient/tool/jenkins/JobBuildApi.java | 144 +++++++++++++++ .../mail/FreemarkerEmailTemplate.java | 6 +- .../luckyclient/{ => tool}/mail/HtmlMail.java | 10 +- .../mail/MailSendInitialization.java | 12 +- .../{ => tool}/mail/MailSenderInfo.java | 4 +- .../{ => tool}/mail/MyAuthenticator.java | 2 +- .../{ => tool}/mail/SimpleMailSender.java | 4 +- .../shell}/RestartServerInitialization.java | 8 +- .../shell}/RmtShellExecutor.java | 4 +- .../{publicclass => utils}/AppiumConfig.java | 2 +- .../{publicclass => utils}/Constants.java | 4 +- .../{publicclass => utils}/DateUtils.java | 2 +- .../{publicclass => utils}/DbOperation.java | 2 +- .../{publicclass => utils}/DbToolkit.java | 2 +- .../{publicclass => utils}/InvokeMethod.java | 14 +- .../{publicclass => utils}/JarClassFind.java | 2 +- .../{publicclass => utils}/LogUtil.java | 2 +- .../{publicclass => utils}/SysConfig.java | 2 +- .../httputils}/HttpClientHelper.java | 8 +- .../httputils}/HttpRequest.java | 6 +- .../httputils}/MyX509TrustManager.java | 2 +- src/main/java/springboot/HttpImpl.java | 6 +- 118 files changed, 1117 insertions(+), 851 deletions(-) delete mode 100644 src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java delete mode 100644 src/main/java/luckyclient/dblog/DbLink.java rename src/main/java/luckyclient/{caserun => execution}/BatchCaseExecute.java (77%) rename src/main/java/luckyclient/{caserun => execution}/OneCaseExecute.java (78%) rename src/main/java/luckyclient/{caserun => execution}/RunAutomationTest.java (77%) rename src/main/java/luckyclient/{caserun => execution}/WebDebugExecute.java (83%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/AppDriverAnalyticCase.java (92%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/AppTestControl.java (84%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/AppiumInitialization.java (97%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/AppiumService.java (91%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidBaseAppium.java (95%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidBatchExecute.java (74%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidCaseExecution.java (93%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidCaseLocalDebug.java (81%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidEncapsulateOperation.java (97%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/androidex/AndroidOneCaseExecute.java (71%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosBaseAppium.java (96%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosBatchExecute.java (74%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosCaseExecution.java (93%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosCaseLocalDebug.java (81%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosEncapsulateOperation.java (97%) rename src/main/java/luckyclient/{caserun/exappium => execution/appium}/iosex/IosOneCaseExecute.java (71%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/ActionContext.java (88%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/ChangString.java (95%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/ParamsManageForSteps.java (92%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/Action.java (78%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/ActionKeyWordParser.java (80%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/GetJsonActionParser.java (88%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/HeaderParser.java (87%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/JsonPathActionParser.java (90%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/SubCentreNumActionParser.java (91%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/SubCentresStrActionParser.java (91%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/SubStrRegxActionParser.java (90%) rename src/main/java/luckyclient/{caserun/publicdispose => execution/dispose}/actionkeyword/ThreadWaitAction.java (84%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/ApiTestCaseDebug.java (92%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/BatchTestCaseExecution.java (86%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/TestCaseExecution.java (92%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/TestControl.java (85%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/ThreadForBatchCase.java (92%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/ThreadForExecuteCase.java (95%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/WebTestCaseDebug.java (94%) rename src/main/java/luckyclient/{caserun/exinterface => execution/httpinterface}/analyticsteps/InterfaceAnalyticCase.java (91%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/BaseWebDrive.java (93%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/CaseLocalDebug.java (77%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/EncapsulateOperation.java (97%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/TestGoogle.java (91%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/WebDriverInitialization.java (95%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/WebTestControl.java (80%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/ex/WebBatchExecute.java (72%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/ex/WebCaseExecution.java (93%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/ex/WebDriverAnalyticCase.java (92%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/ex/WebOneCaseExecute.java (67%) rename src/main/java/luckyclient/{caserun/exwebdriver => execution/webdriver}/ocr/Ocr.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/api/GetServerApi.java (87%) rename src/main/java/luckyclient/{serverapi => remote}/api/PostServerApi.java (92%) rename src/main/java/luckyclient/{dblog/LogOperation.java => remote/api/serverOperation.java} (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/BaseEntity.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/Project.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectCase.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectCaseDebug.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectCaseModule.java (94%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectCaseParams.java (94%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectCaseSteps.java (94%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectPlan.java (94%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectPlanCase.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectProtocolTemplate.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/ProjectTemplateParams.java (94%) rename src/main/java/luckyclient/{serverapi => remote}/entity/TaskCaseExecute.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/TaskCaseLog.java (93%) rename src/main/java/luckyclient/{serverapi => remote}/entity/TaskExecute.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/TaskScheduling.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Arith.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Cpu.java (92%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/IpUtils.java (96%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Jvm.java (91%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Mem.java (92%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Server.java (95%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/Sys.java (92%) rename src/main/java/luckyclient/{serverapi => remote}/entity/monitor/SysFile.java (92%) rename src/main/java/luckyclient/{jenkinsapi => tool/jenkins}/BuildingInitialization.java (89%) create mode 100644 src/main/java/luckyclient/tool/jenkins/JenkinsBaseApi.java rename src/main/java/luckyclient/{jenkinsapi => tool/jenkins}/JenkinsBuilding.java (95%) create mode 100644 src/main/java/luckyclient/tool/jenkins/JenkinsConnect.java create mode 100644 src/main/java/luckyclient/tool/jenkins/JobBuildApi.java rename src/main/java/luckyclient/{ => tool}/mail/FreemarkerEmailTemplate.java (92%) rename src/main/java/luckyclient/{ => tool}/mail/HtmlMail.java (90%) rename src/main/java/luckyclient/{ => tool}/mail/MailSendInitialization.java (90%) rename src/main/java/luckyclient/{ => tool}/mail/MailSenderInfo.java (94%) rename src/main/java/luckyclient/{ => tool}/mail/MyAuthenticator.java (93%) rename src/main/java/luckyclient/{ => tool}/mail/SimpleMailSender.java (96%) rename src/main/java/luckyclient/{jenkinsapi => tool/shell}/RestartServerInitialization.java (87%) rename src/main/java/luckyclient/{jenkinsapi => tool/shell}/RmtShellExecutor.java (95%) rename src/main/java/luckyclient/{publicclass => utils}/AppiumConfig.java (92%) rename src/main/java/luckyclient/{publicclass => utils}/Constants.java (93%) rename src/main/java/luckyclient/{publicclass => utils}/DateUtils.java (95%) rename src/main/java/luckyclient/{publicclass => utils}/DbOperation.java (95%) rename src/main/java/luckyclient/{publicclass => utils}/DbToolkit.java (96%) rename src/main/java/luckyclient/{publicclass => utils}/InvokeMethod.java (96%) rename src/main/java/luckyclient/{publicclass => utils}/JarClassFind.java (96%) rename src/main/java/luckyclient/{publicclass => utils}/LogUtil.java (93%) rename src/main/java/luckyclient/{publicclass => utils}/SysConfig.java (91%) rename src/main/java/luckyclient/{publicclass/remoterinterface => utils/httputils}/HttpClientHelper.java (97%) rename src/main/java/luckyclient/{publicclass/remoterinterface => utils/httputils}/HttpRequest.java (95%) rename src/main/java/luckyclient/{publicclass/remoterinterface => utils/httputils}/MyX509TrustManager.java (92%) diff --git a/pom.xml b/pom.xml index 3114b53..da4e99b 100644 --- a/pom.xml +++ b/pom.xml @@ -302,5 +302,11 @@ com.jayway.jsonpath json-path + + + com.offbytwo.jenkins + jenkins-client + 0.3.8 + diff --git a/src/main/Resources/application.properties b/src/main/Resources/application.properties index 96d465e..6a2ad1a 100644 --- a/src/main/Resources/application.properties +++ b/src/main/Resources/application.properties @@ -1,6 +1,4 @@ spring.application.name = LuckyFrameClient server.port = 6633 - - spring.servlet.multipart.max-file-size=30MB spring.servlet.multipart.max-request-size=30MB \ No newline at end of file diff --git a/src/main/Resources/findJAR.cmd b/src/main/Resources/findJAR.cmd index 8b0289c..966e12f 100644 --- a/src/main/Resources/findJAR.cmd +++ b/src/main/Resources/findJAR.cmd @@ -1,5 +1,5 @@ set classpath=%CLASSPATH%;.\lib;.\bin; @echo 查找重复jar包,输入包路径或是直接类名 @echo path="D:\\web_task\\TestFrame\\lib\\" -java -D luckyclient.publicclass.JarClassFind "D:\\web_task\\TestFrame\\lib\\" "TestLinkAPI" +java -D luckyclient.utils.JarClassFind "D:\\web_task\\TestFrame\\lib\\" "TestLinkAPI" pause \ No newline at end of file diff --git a/src/main/Resources/sys_config.properties b/src/main/Resources/sys_config.properties index 99f0435..e2c2a28 100644 --- a/src/main/Resources/sys_config.properties +++ b/src/main/Resources/sys_config.properties @@ -2,7 +2,7 @@ client.verison=3.1 Beta server.web.ip=localhost server.web.port=80 -#==================================邮件============================================ +#================================ 邮件======================================= #smtp邮件IP 例:smtp.qq.com mail.smtp.ip=smtp.qq.com #smtp邮件端口 例:25 @@ -15,8 +15,15 @@ mail.smtp.username=xxxxx@xx.com mail.smtp.password=xxxxx #邮件模板路径 mail.freemarker.template=/email_template/ -#==================================向第三方应用推送任务执行结果(JSON)============================================ +#==================向第三方应用推送任务执行结果(JSON)======================== #第三方平台推送开关 true打开 false关闭 task.push.switch=false #第三方平台推送URL -task.push.url=localhost \ No newline at end of file +task.push.url=localhost +#==================Jenkins API配置======================== +#jenkins访问地址,示例: http://192.168.100.100:8080/jenkins/ +jenkins.url=http://localhost +#jenkins用户名 +jenkins.username=test +#jenkins密码 +jenkins.password=test1 \ No newline at end of file diff --git a/src/main/Resources/task.cmd b/src/main/Resources/task.cmd index d1866a5..da93010 100644 --- a/src/main/Resources/task.cmd +++ b/src/main/Resources/task.cmd @@ -2,7 +2,7 @@ title set classpath=%CLASSPATH%;.\luckyclient; @echo 指定任务执行 @echo 项目名称 任务ID -java -Djava.ext.dirs=./lib;.%2 luckyclient.caserun.RunAutomationTest %1 +java -Djava.ext.dirs=./lib;.%2 luckyclient.execution.RunAutomationTest %1 @echo 当前测试任务执行窗口将在90秒后退出 ping 127.0.0.1 -n 90 >nul exit \ No newline at end of file diff --git a/src/main/Resources/task.sh b/src/main/Resources/task.sh index 5f4143b..c5ca477 100644 --- a/src/main/Resources/task.sh +++ b/src/main/Resources/task.sh @@ -3,7 +3,7 @@ BASE_DIR="." LIB="${BASE_DIR}/lib" DRIVENPATH="${BASE_DIR}/$2" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" -START_CLASS="luckyclient.caserun.RunAutomationTest $1" +START_CLASS="luckyclient.execution.RunAutomationTest $1" echo ${LIB} diff --git a/src/main/Resources/task_batch.cmd b/src/main/Resources/task_batch.cmd index 1e0fa9f..f002e4c 100644 --- a/src/main/Resources/task_batch.cmd +++ b/src/main/Resources/task_batch.cmd @@ -2,7 +2,7 @@ title set classpath=%CLASSPATH%;.\luckyclient; @echo 批量执行用例 @echo 参数说明 依次为:项目名称 tastId 用例集 -java -Djava.ext.dirs=./lib;.%3 luckyclient.caserun.BatchCaseExecute %1 %2 +java -Djava.ext.dirs=./lib;.%3 luckyclient.execution.BatchCaseExecute %1 %2 @echo 当前用例批量执行窗口将在90秒后退出 ping 127.0.0.1 -n 90 >nul exit diff --git a/src/main/Resources/task_batch.sh b/src/main/Resources/task_batch.sh index b65795f..fa1b474 100644 --- a/src/main/Resources/task_batch.sh +++ b/src/main/Resources/task_batch.sh @@ -3,7 +3,7 @@ BASE_DIR="." LIB="${BASE_DIR}/lib" DRIVENPATH="${BASE_DIR}/$3" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" -START_CLASS="luckyclient.caserun.BatchCaseExecute $1 $2" +START_CLASS="luckyclient.execution.BatchCaseExecute $1 $2" echo ${LIB} diff --git a/src/main/Resources/task_onecase.cmd b/src/main/Resources/task_onecase.cmd index 0547696..290b472 100644 --- a/src/main/Resources/task_onecase.cmd +++ b/src/main/Resources/task_onecase.cmd @@ -2,7 +2,7 @@ title set classpath=%CLASSPATH%;.\luckyclient; @echo 项目单条用例执行 @echo 参数说明 依次为:项目名称 tastId 用例编号 用例版本号 -java -Djava.ext.dirs=./lib;.%4 luckyclient.caserun.OneCaseExecute %1 %2 %3 +java -Djava.ext.dirs=./lib;.%4 luckyclient.execution.OneCaseExecute %1 %2 %3 @echo 当前用例单条执行窗口将在90秒后退出 ping 127.0.0.1 -n 90 >nul exit diff --git a/src/main/Resources/task_onecase.sh b/src/main/Resources/task_onecase.sh index b020ec1..225a2e0 100644 --- a/src/main/Resources/task_onecase.sh +++ b/src/main/Resources/task_onecase.sh @@ -3,7 +3,7 @@ BASE_DIR="." LIB="${BASE_DIR}/lib" DRIVENPATH="${BASE_DIR}/$4" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" -START_CLASS="luckyclient.caserun.OneCaseExecute $1 $2 $3" +START_CLASS="luckyclient.execution.OneCaseExecute $1 $2 $3" echo ${LIB} diff --git a/src/main/Resources/web_debugcase.cmd b/src/main/Resources/web_debugcase.cmd index b9b31c1..bc6ac32 100644 --- a/src/main/Resources/web_debugcase.cmd +++ b/src/main/Resources/web_debugcase.cmd @@ -2,7 +2,7 @@ title Web set classpath=%CLASSPATH%;.\luckyclient; @echo Web界面调试用例接口 @echo 参数说明 依次为:用例编号 执行者 -java -Djava.ext.dirs=./lib;.%3 luckyclient.caserun.WebDebugExecute %1 %2 +java -Djava.ext.dirs=./lib;.%3 luckyclient.execution.WebDebugExecute %1 %2 @echo 当前用例调试窗口将在90秒后退出 ping 127.0.0.1 -n 90 >nul exit \ No newline at end of file diff --git a/src/main/Resources/web_debugcase.sh b/src/main/Resources/web_debugcase.sh index 3f2dd9e..612507e 100644 --- a/src/main/Resources/web_debugcase.sh +++ b/src/main/Resources/web_debugcase.sh @@ -3,7 +3,7 @@ BASE_DIR="." LIB="${BASE_DIR}/lib" DRIVENPATH="${BASE_DIR}/$3" JAVA_OPTS=" -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=512m -XX:+PrintGCDateStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=1024k -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/mtdperf.hprof -server -Dfile.encoding=UTF-8" -START_CLASS="luckyclient.caserun.WebDebugExecute $1 $2" +START_CLASS="luckyclient.execution.WebDebugExecute $1 $2" echo ${LIB} diff --git a/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java b/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java deleted file mode 100644 index f0c028f..0000000 --- a/src/main/java/luckyclient/caserun/publicdispose/ActionManageForSteps.java +++ /dev/null @@ -1,84 +0,0 @@ -package luckyclient.caserun.publicdispose; - -import org.apache.commons.lang.StringUtils; - -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; - -/** - * 动作关键字处理 - * ================================================================= - * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 - * 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull - * ================================================================= - * @author Seagull - * @date 2019年1月15日 - */ -public class ActionManageForSteps { - - /** - * 解析用例步骤 - * @param stepsaction - * @param testresult - * @return - */ - public static String actionManage(String stepsaction,String testresult){ - LogUtil.APP.info("Action(动作)处理前,测试结果是:{}",testresult); - LogUtil.APP.info("现在进入到Action(动作)处理......ACTION值:{}",stepsaction); - if(null==stepsaction||"".equals(stepsaction.trim())){ - LogUtil.APP.info("Action(动作)无需处理......"); - return testresult; - } - - //去除测试响应头域消息 - if(testresult.startsWith(Constants.RESPONSE_HEAD)){ - testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1); - } - - //去除测试响应头域消息 - if(testresult.startsWith(Constants.RESPONSE_CODE)){ - testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1); - } - - stepsaction=stepsaction.trim(); - String[] temp=stepsaction.split("\\|",-1); - for(String actionorder:temp){ - if(null!=actionorder&&!"".equals(actionorder.trim())){ - testresult=actionExecute(actionorder,testresult); - } - } - return testresult; - } - - /** - * 动作关键字执行 - * @param actionKeyWord - * @param testResult - * @return - */ - private static String actionExecute(String actionKeyWord,String testResult){ - try{ - - String keyWord = actionKeyWord.substring(actionKeyWord.lastIndexOf("#")+1, actionKeyWord.length()); - String actionParams = actionKeyWord.substring(0, actionKeyWord.lastIndexOf("#")); - if(StringUtils.isNotEmpty(keyWord)&& keyWord.length()>0){ - ActionContext actionContext = new ActionContext(keyWord.toLowerCase()); - testResult = actionContext.parse(actionParams, testResult, actionKeyWord); - }else { - testResult="关键字语法书写有误,请检查关键字:"+actionKeyWord; - LogUtil.APP.warn("关键字语法书写有误,请检查关键字:{}",actionKeyWord); - } - return testResult; - }catch(Exception e){ - testResult="处理步骤动作事件过程中出现异常,直接返回测试结果:"+actionKeyWord; - LogUtil.APP.error("处理步骤动作事件过程中出现异常,直接返回测试结果!" ,e); - return testResult; - } - } - - public static void main(String[] args) { - String testresult = Constants.RESPONSE_HEAD+"gfdssa"+Constants.RESPONSE_END+"21111"+Constants.RESPONSE_END+"111"; - testresult = testresult.substring(testresult.indexOf(Constants.RESPONSE_END)+1); - System.out.println(testresult); - } -} diff --git a/src/main/java/luckyclient/dblog/DbLink.java b/src/main/java/luckyclient/dblog/DbLink.java deleted file mode 100644 index 1f54694..0000000 --- a/src/main/java/luckyclient/dblog/DbLink.java +++ /dev/null @@ -1,21 +0,0 @@ -package luckyclient.dblog; - -/** - * ================================================================= - * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 - * 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 - * 有任何疑问欢迎联系作者讨论。 QQ:1573584944 seagull1985 - * ================================================================= - * - * @author: seagull - * @date 2017年12月1日 上午9:29:40 - * - */ -public class DbLink { - - /** - * 任务执行类型: 0 任务调度模式 1 控制台模式 - */ - public static int exetype; - -} diff --git a/src/main/java/luckyclient/driven/SubString.java b/src/main/java/luckyclient/driven/SubString.java index 898bab5..79d248c 100644 --- a/src/main/java/luckyclient/driven/SubString.java +++ b/src/main/java/luckyclient/driven/SubString.java @@ -16,8 +16,8 @@ import com.alibaba.fastjson.parser.Feature; import com.jayway.jsonpath.JsonPath; import com.jayway.jsonpath.PathNotFoundException; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.Constants; +import luckyclient.utils.LogUtil; /** * 公用驱动 diff --git a/src/main/java/luckyclient/caserun/BatchCaseExecute.java b/src/main/java/luckyclient/execution/BatchCaseExecute.java similarity index 77% rename from src/main/java/luckyclient/caserun/BatchCaseExecute.java rename to src/main/java/luckyclient/execution/BatchCaseExecute.java index 47f4b65..6d26152 100644 --- a/src/main/java/luckyclient/caserun/BatchCaseExecute.java +++ b/src/main/java/luckyclient/execution/BatchCaseExecute.java @@ -1,20 +1,20 @@ -package luckyclient.caserun; +package luckyclient.execution; import java.io.File; import java.util.Properties; import org.apache.log4j.PropertyConfigurator; -import luckyclient.caserun.exappium.androidex.AndroidBatchExecute; -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.publicclass.LogUtil; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.appium.androidex.AndroidBatchExecute; +import luckyclient.execution.appium.iosex.IosBatchExecute; +import luckyclient.execution.httpinterface.BatchTestCaseExecution; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.ex.WebBatchExecute; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/OneCaseExecute.java b/src/main/java/luckyclient/execution/OneCaseExecute.java similarity index 78% rename from src/main/java/luckyclient/caserun/OneCaseExecute.java rename to src/main/java/luckyclient/execution/OneCaseExecute.java index 92e9cf0..895e634 100644 --- a/src/main/java/luckyclient/caserun/OneCaseExecute.java +++ b/src/main/java/luckyclient/execution/OneCaseExecute.java @@ -1,20 +1,20 @@ -package luckyclient.caserun; +package luckyclient.execution; import java.io.File; import java.util.Properties; import org.apache.log4j.PropertyConfigurator; -import luckyclient.caserun.exappium.androidex.AndroidOneCaseExecute; -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.publicclass.LogUtil; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.appium.androidex.AndroidOneCaseExecute; +import luckyclient.execution.appium.iosex.IosOneCaseExecute; +import luckyclient.execution.httpinterface.TestCaseExecution; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.ex.WebOneCaseExecute; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/RunAutomationTest.java b/src/main/java/luckyclient/execution/RunAutomationTest.java similarity index 77% rename from src/main/java/luckyclient/caserun/RunAutomationTest.java rename to src/main/java/luckyclient/execution/RunAutomationTest.java index 5ff090c..47b36b4 100644 --- a/src/main/java/luckyclient/caserun/RunAutomationTest.java +++ b/src/main/java/luckyclient/execution/RunAutomationTest.java @@ -1,16 +1,16 @@ -package luckyclient.caserun; +package luckyclient.execution; import java.io.File; import org.apache.log4j.PropertyConfigurator; -import luckyclient.caserun.exappium.AppTestControl; -import luckyclient.caserun.exinterface.TestControl; -import luckyclient.caserun.exwebdriver.WebTestControl; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.appium.AppTestControl; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.WebTestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/WebDebugExecute.java b/src/main/java/luckyclient/execution/WebDebugExecute.java similarity index 83% rename from src/main/java/luckyclient/caserun/WebDebugExecute.java rename to src/main/java/luckyclient/execution/WebDebugExecute.java index e9372c2..2bc0b8d 100644 --- a/src/main/java/luckyclient/caserun/WebDebugExecute.java +++ b/src/main/java/luckyclient/execution/WebDebugExecute.java @@ -1,12 +1,12 @@ -package luckyclient.caserun; +package luckyclient.execution; import java.io.File; import org.apache.log4j.PropertyConfigurator; -import luckyclient.caserun.exinterface.TestControl; -import luckyclient.caserun.exinterface.WebTestCaseDebug; -import luckyclient.publicclass.LogUtil; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.httpinterface.WebTestCaseDebug; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java b/src/main/java/luckyclient/execution/appium/AppDriverAnalyticCase.java similarity index 92% rename from src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java rename to src/main/java/luckyclient/execution/appium/AppDriverAnalyticCase.java index b1e0d5c..99ff4d5 100644 --- a/src/main/java/luckyclient/caserun/exappium/AppDriverAnalyticCase.java +++ b/src/main/java/luckyclient/execution/appium/AppDriverAnalyticCase.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium; +package luckyclient.execution.appium; import java.util.HashMap; import java.util.Map; @@ -7,11 +7,11 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ChangString; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 @@ -37,7 +37,7 @@ public class AppDriverAnalyticCase { * @author Seagull * @date 2019年1月17日 */ - public static Map analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,LogOperation caselog, Map variable){ + public static Map analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,serverOperation caselog, Map variable){ Map params = new HashMap(0); String resultstr = null; diff --git a/src/main/java/luckyclient/caserun/exappium/AppTestControl.java b/src/main/java/luckyclient/execution/appium/AppTestControl.java similarity index 84% rename from src/main/java/luckyclient/caserun/exappium/AppTestControl.java rename to src/main/java/luckyclient/execution/appium/AppTestControl.java index 1234d1d..7ee2482 100644 --- a/src/main/java/luckyclient/caserun/exappium/AppTestControl.java +++ b/src/main/java/luckyclient/execution/appium/AppTestControl.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium; +package luckyclient.execution.appium; import java.io.IOException; import java.util.ArrayList; @@ -9,23 +9,22 @@ import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; -import luckyclient.caserun.exappium.androidex.AndroidCaseExecution; -import luckyclient.caserun.exappium.iosex.IosCaseExecution; -import luckyclient.caserun.exinterface.TestControl; -import luckyclient.dblog.DbLink; -import luckyclient.dblog.LogOperation; -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.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.appium.androidex.AndroidCaseExecution; +import luckyclient.execution.appium.iosex.IosCaseExecution; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.tool.jenkins.BuildingInitialization; +import luckyclient.tool.mail.HtmlMail; +import luckyclient.tool.mail.MailSendInitialization; +import luckyclient.tool.shell.RestartServerInitialization; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -48,7 +47,7 @@ public class AppTestControl { public static void manualExecutionPlan(String planname) { // 不记日志到数据库 - DbLink.exetype = 1; + serverOperation.exetype = 1; String taskid = "888888"; AndroidDriver androiddriver = null; IOSDriver iosdriver = null; @@ -64,7 +63,7 @@ public class AppTestControl { // TODO Auto-generated catch block LogUtil.APP.error("控制台模式初始化Appium Driver异常!", e); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); List testCases = GetServerApi.getCasesbyplanname(planname); List pcplist = new ArrayList(); if (testCases.size() != 0) { @@ -107,7 +106,7 @@ public class AppTestControl { public static void taskExecutionPlan(TaskExecute task) throws InterruptedException { // 记录日志到数据库 String taskId=task.getTaskId().toString(); - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskId; AndroidDriver androiddriver = null; IOSDriver iosdriver = null; @@ -142,10 +141,10 @@ public class AppTestControl { } catch (Exception e) { LogUtil.APP.error("初始化AppiumDriver出错 !APPIUM Server【http://{}/wd/hub】",properties.getProperty("appiumsever"), e); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); List cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId()); LogUtil.APP.info("当前计划【{}】中共有【{}】条待测试用例...",task.getTaskName(),cases.size()); - LogOperation.updateTaskExecuteStatusIng(taskId, cases.size()); + serverOperation.updateTaskExecuteStatusIng(taskId, cases.size()); int i = 0; for (ProjectCase testcase : cases) { i++; @@ -168,8 +167,8 @@ public class AppTestControl { } LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign()); } - tastcount = LogOperation.updateTaskExecuteData(taskId, cases.size(),2); - String testtime = LogOperation.getTestTime(taskId); + tastcount = serverOperation.updateTaskExecuteData(taskId, cases.size(),2); + String testtime = serverOperation.getTestTime(taskId); LogUtil.APP.info("当前项目【{]】测试计划中的用例已经全部执行完成...",projectname); MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname), HtmlMail.htmlContentFormat(tastcount, taskId, buildstatus, restartstatus, testtime, jobname), diff --git a/src/main/java/luckyclient/caserun/exappium/AppiumInitialization.java b/src/main/java/luckyclient/execution/appium/AppiumInitialization.java similarity index 97% rename from src/main/java/luckyclient/caserun/exappium/AppiumInitialization.java rename to src/main/java/luckyclient/execution/appium/AppiumInitialization.java index 6c7e27b..28fae74 100644 --- a/src/main/java/luckyclient/caserun/exappium/AppiumInitialization.java +++ b/src/main/java/luckyclient/execution/appium/AppiumInitialization.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium; +package luckyclient.execution.appium; import java.io.File; import java.io.IOException; diff --git a/src/main/java/luckyclient/caserun/exappium/AppiumService.java b/src/main/java/luckyclient/execution/appium/AppiumService.java similarity index 91% rename from src/main/java/luckyclient/caserun/exappium/AppiumService.java rename to src/main/java/luckyclient/execution/appium/AppiumService.java index 7994130..9828c12 100644 --- a/src/main/java/luckyclient/caserun/exappium/AppiumService.java +++ b/src/main/java/luckyclient/execution/appium/AppiumService.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium; +package luckyclient.execution.appium; import java.io.File; import java.util.Properties; @@ -6,8 +6,8 @@ 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; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidBaseAppium.java similarity index 95% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidBaseAppium.java index cac08d7..2e9b58b 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBaseAppium.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidBaseAppium.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.io.File; import java.io.IOException; @@ -16,7 +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; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidBatchExecute.java similarity index 74% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidBatchExecute.java index 9e39b31..3524f03 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidBatchExecute.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidBatchExecute.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.io.IOException; import java.net.MalformedURLException; @@ -7,18 +7,17 @@ import java.util.Properties; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; -import luckyclient.caserun.exappium.AppiumInitialization; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; +import luckyclient.execution.appium.AppiumInitialization; +import luckyclient.execution.appium.AppiumService; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -35,7 +34,7 @@ public class AndroidBatchExecute { public static void batchCaseExecuteForTast(String projectname, String taskid, String batchcase) throws IOException, InterruptedException { // 记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; AndroidDriver ad = null; AppiumService as=null; @@ -53,7 +52,7 @@ public class AndroidBatchExecute { // TODO Auto-generated catch block LogUtil.APP.error("安卓手机根据配置自动启动Appiume服务出现异常",e); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); TaskExecute task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid)); List pcplist = GetServerApi .cgetParamsByProjectid(task.getProjectId().toString()); @@ -64,7 +63,7 @@ public class AndroidBatchExecute { ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i)); List steps = GetServerApi.getStepsbycaseid(testcase.getCaseId()); // 删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist); } catch (InterruptedException e) { @@ -78,7 +77,7 @@ public class AndroidBatchExecute { ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i])); List steps = GetServerApi.getStepsbycaseid(testcase.getCaseId()); // 删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { AndroidCaseExecution.caseExcution(testcase, steps, taskid, ad, caselog, pcplist); } catch (InterruptedException e) { @@ -87,7 +86,7 @@ public class AndroidBatchExecute { } } } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); ad.closeApp(); //关闭Appium服务的线程 if(as!=null){ diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidCaseExecution.java similarity index 93% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidCaseExecution.java index 5ec58e0..a1ae1f6 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseExecution.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidCaseExecution.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.io.IOException; import java.util.Date; @@ -10,18 +10,18 @@ import java.util.regex.Pattern; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; -import luckyclient.caserun.exappium.AppDriverAnalyticCase; -import luckyclient.caserun.exinterface.TestCaseExecution; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.publicdispose.ActionManageForSteps; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.appium.AppDriverAnalyticCase; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.dispose.ChangString; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.execution.httpinterface.TestCaseExecution; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.Constants; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -38,7 +38,7 @@ public class AndroidCaseExecution{ private static String casenote = "备注初始化"; private static String imagname = ""; - public static void caseExcution(ProjectCase testcase, List steps,String taskid, AndroidDriver appium,LogOperation caselog,List pcplist) + public static void caseExcution(ProjectCase testcase, List steps,String taskid, AndroidDriver appium,serverOperation caselog,List pcplist) throws InterruptedException, IOException { caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3); // 把公共参数加入到MAP中 @@ -102,7 +102,7 @@ public class AndroidCaseExecution{ //LogOperation.UpdateTastdetail(taskid, 0); } - public static String androidRunStep(Map params, AndroidDriver appium,String taskid,Integer caseId,int stepno,LogOperation caselog) { + public static String androidRunStep(Map params, AndroidDriver appium,String taskid,Integer caseId,int stepno,serverOperation caselog) { String result = ""; String property; String propertyValue; @@ -223,7 +223,7 @@ public class AndroidCaseExecution{ } - public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, AndroidDriver appium, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException { + public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, AndroidDriver appium, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException { int setresult = 0; java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss"); imagname = timeformat.format(new Date()); diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidCaseLocalDebug.java similarity index 81% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidCaseLocalDebug.java index dfb0beb..43075bd 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidCaseLocalDebug.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidCaseLocalDebug.java @@ -1,17 +1,16 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.io.IOException; import java.util.List; 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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -27,8 +26,8 @@ public class AndroidCaseLocalDebug { public static void oneCasedebug(AndroidDriver androiddriver, String testCaseExternalId) { // 不记录日志到数据库 - DbLink.exetype = 1; - LogOperation caselog = new LogOperation(); + serverOperation.exetype = 1; + serverOperation caselog = new serverOperation(); try { ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId); diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidEncapsulateOperation.java similarity index 97% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidEncapsulateOperation.java index d92f227..6524223 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidEncapsulateOperation.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidEncapsulateOperation.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.time.Duration; import java.util.Date; @@ -16,8 +16,8 @@ import io.appium.java_client.touch.LongPressOptions; 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; +import luckyclient.execution.dispose.ChangString; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java b/src/main/java/luckyclient/execution/appium/androidex/AndroidOneCaseExecute.java similarity index 71% rename from src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java rename to src/main/java/luckyclient/execution/appium/androidex/AndroidOneCaseExecute.java index 48fe404..1b5030e 100644 --- a/src/main/java/luckyclient/caserun/exappium/androidex/AndroidOneCaseExecute.java +++ b/src/main/java/luckyclient/execution/appium/androidex/AndroidOneCaseExecute.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.androidex; +package luckyclient.execution.appium.androidex; import java.io.IOException; import java.util.List; @@ -6,17 +6,16 @@ import java.util.Properties; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; -import luckyclient.caserun.exappium.AppiumInitialization; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.appium.AppiumInitialization; +import luckyclient.execution.appium.AppiumService; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -34,7 +33,7 @@ public class AndroidOneCaseExecute { public static void oneCaseExecuteForTast(String projectname, Integer caseId, int version, String taskid) throws IOException, InterruptedException { // 记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; AndroidDriver ad = null; AppiumService as=null; @@ -51,10 +50,10 @@ public class AndroidOneCaseExecute { } catch (IOException e1) { LogUtil.APP.error("初始化AndroidDriver出错!", e1); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); // 删除旧的日志 ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId); - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); List pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId())); LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign()); try { @@ -64,7 +63,7 @@ public class AndroidOneCaseExecute { } catch (InterruptedException e) { LogUtil.APP.error("用户执行过程中抛出异常!", e); } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); ad.closeApp(); //关闭Appium服务的线程 if(as!=null){ diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java b/src/main/java/luckyclient/execution/appium/iosex/IosBaseAppium.java similarity index 96% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java rename to src/main/java/luckyclient/execution/appium/iosex/IosBaseAppium.java index 0664adb..3651eec 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosBaseAppium.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosBaseAppium.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.io.File; import java.io.IOException; @@ -16,7 +16,7 @@ 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; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java b/src/main/java/luckyclient/execution/appium/iosex/IosBatchExecute.java similarity index 74% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java rename to src/main/java/luckyclient/execution/appium/iosex/IosBatchExecute.java index f8ec6e1..5fbe01e 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosBatchExecute.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosBatchExecute.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.io.IOException; import java.net.MalformedURLException; @@ -7,18 +7,17 @@ import java.util.Properties; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; -import luckyclient.caserun.exappium.AppiumInitialization; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; +import luckyclient.execution.appium.AppiumInitialization; +import luckyclient.execution.appium.AppiumService; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -33,7 +32,7 @@ public class IosBatchExecute { public static void batchCaseExecuteForTast(String projectname, String taskid, String batchcase) throws IOException, InterruptedException { // 记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; IOSDriver iosd = null; AppiumService as=null; @@ -51,7 +50,7 @@ public class IosBatchExecute { // TODO Auto-generated catch block LogUtil.APP.error("根据配置自动启动Appiume服务中抛出异常!", e); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); TaskExecute task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid)); List pcplist = GetServerApi .cgetParamsByProjectid(task.getProjectId().toString()); @@ -62,7 +61,7 @@ public class IosBatchExecute { ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i)); List steps = GetServerApi.getStepsbycaseid(testcase.getCaseId()); // 删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist); } catch (InterruptedException e) { @@ -76,7 +75,7 @@ public class IosBatchExecute { ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i])); List steps = GetServerApi.getStepsbycaseid(testcase.getCaseId()); // 删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { IosCaseExecution.caseExcution(testcase, steps, taskid, iosd, caselog, pcplist); } catch (InterruptedException e) { @@ -85,7 +84,7 @@ public class IosBatchExecute { } } } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); iosd.closeApp(); //关闭Appium服务的线程 if(as!=null){ diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java b/src/main/java/luckyclient/execution/appium/iosex/IosCaseExecution.java similarity index 93% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java rename to src/main/java/luckyclient/execution/appium/iosex/IosCaseExecution.java index 7b60950..74ccdbf 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseExecution.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosCaseExecution.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.io.IOException; import java.util.Date; @@ -10,18 +10,18 @@ import java.util.regex.Pattern; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; -import luckyclient.caserun.exappium.AppDriverAnalyticCase; -import luckyclient.caserun.exinterface.TestCaseExecution; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.publicdispose.ActionManageForSteps; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.appium.AppDriverAnalyticCase; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.dispose.ChangString; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.execution.httpinterface.TestCaseExecution; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.Constants; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -38,7 +38,7 @@ public class IosCaseExecution{ private static String casenote = "备注初始化"; private static String imagname = ""; - public static void caseExcution(ProjectCase testcase, List steps,String taskid, IOSDriver appium,LogOperation caselog,List pcplist) + public static void caseExcution(ProjectCase testcase, List steps,String taskid, IOSDriver appium,serverOperation caselog,List pcplist) throws InterruptedException, IOException { caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3); // 把公共参数加入到MAP中 @@ -104,7 +104,7 @@ public class IosCaseExecution{ //LogOperation.UpdateTastdetail(taskid, 0); } - public static String iosRunStep(Map params, Map variable, IOSDriver appium,String taskid,Integer caseId,int stepno,LogOperation caselog) { + public static String iosRunStep(Map params, Map variable, IOSDriver appium,String taskid,Integer caseId,int stepno,serverOperation caselog) { String result = ""; String property; String propertyValue; @@ -237,7 +237,7 @@ public class IosCaseExecution{ } - public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, IOSDriver appium, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException { + public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, IOSDriver appium, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException { int setresult = 0; java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss"); imagname = timeformat.format(new Date()); diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java b/src/main/java/luckyclient/execution/appium/iosex/IosCaseLocalDebug.java similarity index 81% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java rename to src/main/java/luckyclient/execution/appium/iosex/IosCaseLocalDebug.java index 5a67aec..829a596 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosCaseLocalDebug.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosCaseLocalDebug.java @@ -1,17 +1,16 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.io.IOException; import java.util.List; 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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -27,8 +26,8 @@ public class IosCaseLocalDebug { public static void oneCasedebug(IOSDriver iosdriver, String testCaseExternalId) { // 不记录日志到数据库 - DbLink.exetype = 1; - LogOperation caselog = new LogOperation(); + serverOperation.exetype = 1; + serverOperation caselog = new serverOperation(); try { ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId); diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java b/src/main/java/luckyclient/execution/appium/iosex/IosEncapsulateOperation.java similarity index 97% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java rename to src/main/java/luckyclient/execution/appium/iosex/IosEncapsulateOperation.java index 174bce7..9e8a6d4 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosEncapsulateOperation.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosEncapsulateOperation.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.time.Duration; import java.util.Date; @@ -16,8 +16,8 @@ import io.appium.java_client.touch.LongPressOptions; 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; +import luckyclient.execution.dispose.ChangString; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java b/src/main/java/luckyclient/execution/appium/iosex/IosOneCaseExecute.java similarity index 71% rename from src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java rename to src/main/java/luckyclient/execution/appium/iosex/IosOneCaseExecute.java index dcfe21d..9416e4d 100644 --- a/src/main/java/luckyclient/caserun/exappium/iosex/IosOneCaseExecute.java +++ b/src/main/java/luckyclient/execution/appium/iosex/IosOneCaseExecute.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exappium.iosex; +package luckyclient.execution.appium.iosex; import java.io.IOException; import java.util.List; @@ -6,17 +6,16 @@ import java.util.Properties; import io.appium.java_client.ios.IOSDriver; import io.appium.java_client.ios.IOSElement; -import luckyclient.caserun.exappium.AppiumInitialization; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.appium.AppiumInitialization; +import luckyclient.execution.appium.AppiumService; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.AppiumConfig; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -32,7 +31,7 @@ public class IosOneCaseExecute { public static void oneCaseExecuteForTast(String projectname, Integer caseId, int version, String taskid) throws IOException, InterruptedException { // 记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; IOSDriver iosd = null; AppiumService as=null; @@ -49,10 +48,10 @@ public class IosOneCaseExecute { } catch (IOException e1) { LogUtil.APP.error("初始化IOSDriver出错!", e1); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId); // 删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); List pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId())); LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign()); @@ -63,7 +62,7 @@ public class IosOneCaseExecute { } catch (InterruptedException e) { LogUtil.APP.error("用户执行过程中抛出异常!", e); } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); iosd.closeApp(); //关闭Appium服务的线程 if(as!=null){ diff --git a/src/main/java/luckyclient/caserun/publicdispose/ActionContext.java b/src/main/java/luckyclient/execution/dispose/ActionContext.java similarity index 88% rename from src/main/java/luckyclient/caserun/publicdispose/ActionContext.java rename to src/main/java/luckyclient/execution/dispose/ActionContext.java index 4f1ca23..36b03a3 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/ActionContext.java +++ b/src/main/java/luckyclient/execution/dispose/ActionContext.java @@ -1,63 +1,63 @@ -package luckyclient.caserun.publicdispose; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.reflections.Reflections; - -import luckyclient.caserun.publicdispose.actionkeyword.Action; -import luckyclient.caserun.publicdispose.actionkeyword.ActionKeyWordParser; -import luckyclient.publicclass.LogUtil; - -/** - * 步骤动作容器,根据参数生成不同的动作关键字类型,执行相应的解析 - * @author: sunshaoyan@ - * @date: Created on 2019/4/13 - */ -@SuppressWarnings("rawtypes") -public class ActionContext { - - private static Map allActions; - - static { - Reflections reflections = new Reflections("luckyclient.caserun.publicdispose.actionkeyword"); - Set> annotatedClasses = - reflections.getTypesAnnotatedWith(Action.class); - allActions = new ConcurrentHashMap(); - for (Class classObject : annotatedClasses) { - Action action = (Action) classObject - .getAnnotation(Action.class); - allActions.put(action.name(), classObject); - } - allActions = Collections.unmodifiableMap(allActions); - } - - private ActionKeyWordParser action; - - public ActionContext(String name){ - - if (allActions.containsKey(name)) { - LogUtil.APP.info("Created Action name is {}", name); - try { - action = (ActionKeyWordParser) allActions.get(name).newInstance(); - } catch (InstantiationException | IllegalAccessException ex) { - LogUtil.APP.error("Instantiate Action failed", ex); - } - } else { - LogUtil.APP.warn("Specified Action name {} does not exist", name); - } - } - - public String parse(String actionParams,String testResult,String actionKeyWord) { - if(null != action){ - testResult = action.parse(actionParams, testResult); - }else { - testResult="未检索到对应动作关键字,直接跳过此动作,请检查关键字:"+actionKeyWord; - LogUtil.APP.warn("未检索到对应动作关键字,直接跳过此动作,请检查关键字:{}",actionKeyWord); - } - return testResult; - } - -} +package luckyclient.execution.dispose; + +import java.util.Collections; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import org.reflections.Reflections; + +import luckyclient.execution.dispose.actionkeyword.Action; +import luckyclient.execution.dispose.actionkeyword.ActionKeyWordParser; +import luckyclient.utils.LogUtil; + +/** + * 步骤动作容器,根据参数生成不同的动作关键字类型,执行相应的解析 + * @author: sunshaoyan@ + * @date: Created on 2019/4/13 + */ +@SuppressWarnings("rawtypes") +public class ActionContext { + + private static Map allActions; + + static { + Reflections reflections = new Reflections("luckyclient.caserun.publicdispose.actionkeyword"); + Set> annotatedClasses = + reflections.getTypesAnnotatedWith(Action.class); + allActions = new ConcurrentHashMap(); + for (Class classObject : annotatedClasses) { + Action action = (Action) classObject + .getAnnotation(Action.class); + allActions.put(action.name(), classObject); + } + allActions = Collections.unmodifiableMap(allActions); + } + + private ActionKeyWordParser action; + + public ActionContext(String name){ + + if (allActions.containsKey(name)) { + LogUtil.APP.info("Created Action name is {}", name); + try { + action = (ActionKeyWordParser) allActions.get(name).newInstance(); + } catch (InstantiationException | IllegalAccessException ex) { + LogUtil.APP.error("Instantiate Action failed", ex); + } + } else { + LogUtil.APP.warn("Specified Action name {} does not exist", name); + } + } + + public String parse(String actionParams,String testResult,String actionKeyWord) { + if(null != action){ + testResult = action.parse(actionParams, testResult); + }else { + testResult="未检索到对应动作关键字,直接跳过此动作,请检查关键字:"+actionKeyWord; + LogUtil.APP.warn("未检索到对应动作关键字,直接跳过此动作,请检查关键字:{}",actionKeyWord); + } + return testResult; + } + +} diff --git a/src/main/java/luckyclient/caserun/publicdispose/ChangString.java b/src/main/java/luckyclient/execution/dispose/ChangString.java similarity index 95% rename from src/main/java/luckyclient/caserun/publicdispose/ChangString.java rename to src/main/java/luckyclient/execution/dispose/ChangString.java index 64d235d..c3114d6 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/ChangString.java +++ b/src/main/java/luckyclient/execution/dispose/ChangString.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.publicdispose; +package luckyclient.execution.dispose; import java.math.BigDecimal; import java.sql.Timestamp; @@ -18,7 +18,7 @@ import com.alibaba.fastjson.JSONException; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 对参数替换进行处理 diff --git a/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java b/src/main/java/luckyclient/execution/dispose/ParamsManageForSteps.java similarity index 92% rename from src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java rename to src/main/java/luckyclient/execution/dispose/ParamsManageForSteps.java index aebd14c..7659665 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/ParamsManageForSteps.java +++ b/src/main/java/luckyclient/execution/dispose/ParamsManageForSteps.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.publicdispose; +package luckyclient.execution.dispose; import java.text.SimpleDateFormat; import java.util.Date; @@ -8,7 +8,7 @@ import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 对内置参数进行处理 @@ -110,9 +110,4 @@ public class ParamsManageForSteps { } } - public static void main(String[] args) { - // TODO Auto-generated method stub - - } - } diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/Action.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/Action.java similarity index 78% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/Action.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/Action.java index f8bce99..015c61b 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/Action.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/Action.java @@ -1,17 +1,17 @@ -package luckyclient.caserun.publicdispose.actionkeyword; - -/** - * 动作关键字注解定义 - * @author: sunshaoyan - * @date: Created on 2019/4/13 - */ - -import java.lang.annotation.*; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Inherited -public @interface Action { - String name() default ""; -} +package luckyclient.execution.dispose.actionkeyword; + +/** + * 动作关键字注解定义 + * @author: sunshaoyan + * @date: Created on 2019/4/13 + */ + +import java.lang.annotation.*; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface Action { + String name() default ""; +} diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ActionKeyWordParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/ActionKeyWordParser.java similarity index 80% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ActionKeyWordParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/ActionKeyWordParser.java index 5ce3b30..e891365 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ActionKeyWordParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/ActionKeyWordParser.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.publicdispose.actionkeyword; +package luckyclient.execution.dispose.actionkeyword; /** * 动作关键字的处理接口 diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/GetJsonActionParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/GetJsonActionParser.java similarity index 88% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/GetJsonActionParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/GetJsonActionParser.java index a9bcd79..80e9c46 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/GetJsonActionParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/GetJsonActionParser.java @@ -1,7 +1,7 @@ -package luckyclient.caserun.publicdispose.actionkeyword; +package luckyclient.execution.dispose.actionkeyword; import luckyclient.driven.SubString; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 动作关键字的处理接口的实现类:获取JSON字符串指定Key的值的 diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/HeaderParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/HeaderParser.java similarity index 87% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/HeaderParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/HeaderParser.java index 57dcec2..0427eb4 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/HeaderParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/HeaderParser.java @@ -1,29 +1,29 @@ -package luckyclient.caserun.publicdispose.actionkeyword; - - -import com.alibaba.fastjson.JSONObject; - -import luckyclient.publicclass.LogUtil; - -/** - * 动作关键字的处理接口的实现类:从响应header中取出某个header值 - * @author: sunshaoyan - * @date: Created on 2019/4/13 - */ -@Action(name="header") -public class HeaderParser implements ActionKeyWordParser { - - - /** - * @param actionorder 动作关键字 - */ - @Override - public String parse(String actionParams, String testResult) { - String pre = "RESPONSE_HEAD:【"; - String headerStr = testResult.substring(testResult.indexOf(pre) + pre.length(), testResult.indexOf("】 RESPONSE_CODE")); - String getHeader = JSONObject.parseObject(headerStr).getJSONArray(actionParams).getString(0); - LogUtil.APP.info("Action(header):从响应header中取出指定header值是:{}",getHeader); - return getHeader; - - } -} +package luckyclient.execution.dispose.actionkeyword; + + +import com.alibaba.fastjson.JSONObject; + +import luckyclient.utils.LogUtil; + +/** + * 动作关键字的处理接口的实现类:从响应header中取出某个header值 + * @author: sunshaoyan + * @date: Created on 2019/4/13 + */ +@Action(name="header") +public class HeaderParser implements ActionKeyWordParser { + + + /** + * @param actionorder 动作关键字 + */ + @Override + public String parse(String actionParams, String testResult) { + String pre = "RESPONSE_HEAD:【"; + String headerStr = testResult.substring(testResult.indexOf(pre) + pre.length(), testResult.indexOf("】 RESPONSE_CODE")); + String getHeader = JSONObject.parseObject(headerStr).getJSONArray(actionParams).getString(0); + LogUtil.APP.info("Action(header):从响应header中取出指定header值是:{}",getHeader); + return getHeader; + + } +} diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/JsonPathActionParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/JsonPathActionParser.java similarity index 90% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/JsonPathActionParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/JsonPathActionParser.java index eb3d8a7..c927efd 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/JsonPathActionParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/JsonPathActionParser.java @@ -1,7 +1,7 @@ -package luckyclient.caserun.publicdispose.actionkeyword; +package luckyclient.execution.dispose.actionkeyword; import luckyclient.driven.SubString; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 动作关键字的处理接口的实现类:使用jsonpath处理json字符串 diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentreNumActionParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentreNumActionParser.java similarity index 91% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentreNumActionParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentreNumActionParser.java index 6494597..a47484a 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentreNumActionParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentreNumActionParser.java @@ -1,34 +1,34 @@ -package luckyclient.caserun.publicdispose.actionkeyword; - - -import luckyclient.driven.SubString; -import luckyclient.publicclass.LogUtil; - -/** - * 动作关键字的处理接口的实现类:截取测试结果指定开始及结束位置字符串 - * @author: sunshaoyan - * @date: Created on 2019/4/13 - */ -@Action(name="subcentrenum") -public class SubCentreNumActionParser implements ActionKeyWordParser { - - - /** - * 截取测试结果指定开始及结束位置字符串 - * @param actionKeyWord 动作关键字 - * @param testResult 测试结果 - */ - @Override - public String parse(String actionParams, String testResult) { - if(actionParams.startsWith("[")&&actionParams.endsWith("]")){ - String startnum=actionParams.substring(actionParams.indexOf("[")+1, actionParams.indexOf("]")); - String endnum=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]")); - testResult= SubString.subCentreNum(testResult, startnum, endnum); - LogUtil.APP.info("Action(subCentreNum):截取测试结果指定开始及结束位置字符串:{}",testResult); - }else{ - testResult="步骤动作:subCentreNum 必须是[\"开始字符\"][\"结束字符\"]#subCentreNum 格式,请检查您的步骤动作参数:"+actionParams; - LogUtil.APP.warn("步骤动作:subCentreNum 必须是[\"开始位置(整数)\"][\"结束位置(整数)\"]#subCentreNum 格式,请检查您的步骤动作参数:{}",actionParams); - } - return testResult; - } -} +package luckyclient.execution.dispose.actionkeyword; + + +import luckyclient.driven.SubString; +import luckyclient.utils.LogUtil; + +/** + * 动作关键字的处理接口的实现类:截取测试结果指定开始及结束位置字符串 + * @author: sunshaoyan + * @date: Created on 2019/4/13 + */ +@Action(name="subcentrenum") +public class SubCentreNumActionParser implements ActionKeyWordParser { + + + /** + * 截取测试结果指定开始及结束位置字符串 + * @param actionKeyWord 动作关键字 + * @param testResult 测试结果 + */ + @Override + public String parse(String actionParams, String testResult) { + if(actionParams.startsWith("[")&&actionParams.endsWith("]")){ + String startnum=actionParams.substring(actionParams.indexOf("[")+1, actionParams.indexOf("]")); + String endnum=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]")); + testResult= SubString.subCentreNum(testResult, startnum, endnum); + LogUtil.APP.info("Action(subCentreNum):截取测试结果指定开始及结束位置字符串:{}",testResult); + }else{ + testResult="步骤动作:subCentreNum 必须是[\"开始字符\"][\"结束字符\"]#subCentreNum 格式,请检查您的步骤动作参数:"+actionParams; + LogUtil.APP.warn("步骤动作:subCentreNum 必须是[\"开始位置(整数)\"][\"结束位置(整数)\"]#subCentreNum 格式,请检查您的步骤动作参数:{}",actionParams); + } + return testResult; + } +} diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentresStrActionParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentresStrActionParser.java similarity index 91% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentresStrActionParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentresStrActionParser.java index 890c383..56a1672 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubCentresStrActionParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubCentresStrActionParser.java @@ -1,7 +1,7 @@ -package luckyclient.caserun.publicdispose.actionkeyword; +package luckyclient.execution.dispose.actionkeyword; import luckyclient.driven.SubString; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 动作关键字的处理接口的实现类:截取测试结果指定开始及结束位置字符串 diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubStrRegxActionParser.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubStrRegxActionParser.java similarity index 90% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubStrRegxActionParser.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/SubStrRegxActionParser.java index 7e2acdb..253f847 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/SubStrRegxActionParser.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/SubStrRegxActionParser.java @@ -1,35 +1,35 @@ -package luckyclient.caserun.publicdispose.actionkeyword; - -import luckyclient.driven.SubString; -import luckyclient.publicclass.LogUtil; - -/** - * 动作关键字的处理接口的实现类:获取JSON字符串指定Key的值,采用正则匹配 - * @author: sunshaoyan - * @date: Created on 2019/4/13 - */ -@Action(name="substrrgex") -public class SubStrRegxActionParser implements ActionKeyWordParser { - - - /** - * 获取JSON字符串指定Key的值,采用正则匹配 - * @param actionKeyWord 动作关键字 - * @param testResult 测试结果 - */ - @Override - public String parse(String actionParams, String testResult) { - String key=""; - String index="1"; - if(actionParams.endsWith("]")&&actionParams.contains("[")){ - key=actionParams.substring(0,actionParams.lastIndexOf("[")); - index=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]")); - testResult= SubString.subStrRgex(testResult, key, index); - }else{ - key=actionParams; - testResult= SubString.subStrRgex(testResult, key, index); - } - LogUtil.APP.info("Action(subStrRgex):获取JSON字符串指定Key的值是:{}",testResult); - return testResult; - } -} +package luckyclient.execution.dispose.actionkeyword; + +import luckyclient.driven.SubString; +import luckyclient.utils.LogUtil; + +/** + * 动作关键字的处理接口的实现类:获取JSON字符串指定Key的值,采用正则匹配 + * @author: sunshaoyan + * @date: Created on 2019/4/13 + */ +@Action(name="substrrgex") +public class SubStrRegxActionParser implements ActionKeyWordParser { + + + /** + * 获取JSON字符串指定Key的值,采用正则匹配 + * @param actionKeyWord 动作关键字 + * @param testResult 测试结果 + */ + @Override + public String parse(String actionParams, String testResult) { + String key=""; + String index="1"; + if(actionParams.endsWith("]")&&actionParams.contains("[")){ + key=actionParams.substring(0,actionParams.lastIndexOf("[")); + index=actionParams.substring(actionParams.lastIndexOf("[")+1, actionParams.lastIndexOf("]")); + testResult= SubString.subStrRgex(testResult, key, index); + }else{ + key=actionParams; + testResult= SubString.subStrRgex(testResult, key, index); + } + LogUtil.APP.info("Action(subStrRgex):获取JSON字符串指定Key的值是:{}",testResult); + return testResult; + } +} diff --git a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ThreadWaitAction.java b/src/main/java/luckyclient/execution/dispose/actionkeyword/ThreadWaitAction.java similarity index 84% rename from src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ThreadWaitAction.java rename to src/main/java/luckyclient/execution/dispose/actionkeyword/ThreadWaitAction.java index c6c70bc..0652615 100644 --- a/src/main/java/luckyclient/caserun/publicdispose/actionkeyword/ThreadWaitAction.java +++ b/src/main/java/luckyclient/execution/dispose/actionkeyword/ThreadWaitAction.java @@ -1,38 +1,38 @@ -package luckyclient.caserun.publicdispose.actionkeyword; - - -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.publicclass.LogUtil; - -/** - * 动作关键字的处理接口的实现类:线程等待时间 - * @author: sunshaoyan - * @date: Created on 2019/4/13 - */ -@Action(name="wait") -public class ThreadWaitAction implements ActionKeyWordParser { - - - /** - * @param actionorder 动作关键字 - */ - @Override - public String parse(String actionParams, String testResult) { - if(ChangString.isInteger(actionParams)){ - try { - // 获取步骤间等待时间 - int time=Integer.parseInt(actionParams); - if (time > 0) { - LogUtil.APP.info("Action(Wait):线程等待【{}】秒...",time); - Thread.sleep(time * 1000); - } - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - }else{ - LogUtil.APP.error("使用等待关键字的参数不是整数,直接跳过此动作,请检查!"); - } - return testResult; - } -} +package luckyclient.execution.dispose.actionkeyword; + + +import luckyclient.execution.dispose.ChangString; +import luckyclient.utils.LogUtil; + +/** + * 动作关键字的处理接口的实现类:线程等待时间 + * @author: sunshaoyan + * @date: Created on 2019/4/13 + */ +@Action(name="wait") +public class ThreadWaitAction implements ActionKeyWordParser { + + + /** + * @param actionorder 动作关键字 + */ + @Override + public String parse(String actionParams, String testResult) { + if(ChangString.isInteger(actionParams)){ + try { + // 获取步骤间等待时间 + int time=Integer.parseInt(actionParams); + if (time > 0) { + LogUtil.APP.info("Action(Wait):线程等待【{}】秒...",time); + Thread.sleep(time * 1000); + } + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + }else{ + LogUtil.APP.error("使用等待关键字的参数不是整数,直接跳过此动作,请检查!"); + } + return testResult; + } +} diff --git a/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java b/src/main/java/luckyclient/execution/httpinterface/ApiTestCaseDebug.java similarity index 92% rename from src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java rename to src/main/java/luckyclient/execution/httpinterface/ApiTestCaseDebug.java index 98008dc..9766190 100644 --- a/src/main/java/luckyclient/caserun/exinterface/ApiTestCaseDebug.java +++ b/src/main/java/luckyclient/execution/httpinterface/ApiTestCaseDebug.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; import java.util.HashMap; import java.util.List; @@ -6,15 +6,15 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.publicdispose.ActionManageForSteps; -import luckyclient.publicclass.InvokeMethod; -import luckyclient.publicclass.LogUtil; -import luckyclient.publicclass.remoterinterface.HttpRequest; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.InvokeMethod; +import luckyclient.utils.LogUtil; +import luckyclient.utils.httputils.HttpRequest; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exinterface/BatchTestCaseExecution.java b/src/main/java/luckyclient/execution/httpinterface/BatchTestCaseExecution.java similarity index 86% rename from src/main/java/luckyclient/caserun/exinterface/BatchTestCaseExecution.java rename to src/main/java/luckyclient/execution/httpinterface/BatchTestCaseExecution.java index ca22cdf..f89d84b 100644 --- a/src/main/java/luckyclient/caserun/exinterface/BatchTestCaseExecution.java +++ b/src/main/java/luckyclient/execution/httpinterface/BatchTestCaseExecution.java @@ -1,14 +1,14 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; import java.util.List; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.ProjectCase; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -37,7 +37,7 @@ public class BatchTestCaseExecution { //执行全部非成功状态用例 if(batchcase.indexOf("ALLFAIL")>-1){ //初始化写用例结果以及日志模块 - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); List caseIdList = caselog.getCaseListForUnSucByTaskId(taskid); for(int i=0;i pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId())); // 把公共参数加入到MAP中 @@ -172,7 +171,7 @@ public class TestCaseExecution { LogUtil.APP.warn("用例{}在执行过程中失败,请检查日志!",testcase.getCaseSign()); caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "在执行过程中失败,请检查日志!", "error", "EXECUTECASESUC...", ""); } - LogOperation.updateTaskExecuteData(taskid, 0, 2); + serverOperation.updateTaskExecuteData(taskid, 0, 2); } /** @@ -186,7 +185,7 @@ public class TestCaseExecution { * 提供给Web用例中,runcase的时候使用 */ @SuppressWarnings("unchecked") - public String oneCaseExecuteForUICase(String testCaseExternalId, String taskid, LogOperation caselog, Object driver) throws InterruptedException { + public String oneCaseExecuteForUICase(String testCaseExternalId, String taskid, serverOperation caselog, Object driver) throws InterruptedException { String expectedresults = null; Integer setresult = 1; String testnote = "初始化测试结果"; @@ -277,7 +276,7 @@ public class TestCaseExecution { * @param caselog * @return */ - public String runStep(Map params, String taskid, String casenum, ProjectCaseSteps step, LogOperation caselog) { + public String runStep(Map params, String taskid, String casenum, ProjectCaseSteps step, serverOperation caselog) { String result = ""; String packagename = ""; String functionname = ""; @@ -327,7 +326,7 @@ public class TestCaseExecution { return result; } - private int interfaceJudgeResult(ProjectCase testcase, ProjectCaseSteps step, String taskid, String expectedresults, String testnote, LogOperation caselog){ + private int interfaceJudgeResult(ProjectCase testcase, ProjectCaseSteps step, String taskid, String expectedresults, String testnote, serverOperation caselog){ int setresult = 0; try{ if (null != expectedresults && !expectedresults.isEmpty()) { diff --git a/src/main/java/luckyclient/caserun/exinterface/TestControl.java b/src/main/java/luckyclient/execution/httpinterface/TestControl.java similarity index 85% rename from src/main/java/luckyclient/caserun/exinterface/TestControl.java rename to src/main/java/luckyclient/execution/httpinterface/TestControl.java index 26c3168..3031742 100644 --- a/src/main/java/luckyclient/caserun/exinterface/TestControl.java +++ b/src/main/java/luckyclient/execution/httpinterface/TestControl.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; import java.util.ArrayList; import java.util.List; @@ -6,19 +6,18 @@ import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import luckyclient.dblog.DbLink; -import luckyclient.dblog.LogOperation; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.tool.jenkins.BuildingInitialization; +import luckyclient.tool.mail.HtmlMail; +import luckyclient.tool.mail.MailSendInitialization; +import luckyclient.tool.shell.RestartServerInitialization; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -42,7 +41,7 @@ public class TestControl { */ public static void manualExecutionPlan(String planname) throws Exception { - DbLink.exetype = 1; + serverOperation.exetype = 1; int threadcount = 10; // 创建线程池,多线程执行用例 ThreadPoolExecutor threadExecute = new ThreadPoolExecutor(threadcount, 20, 3, TimeUnit.SECONDS, @@ -56,7 +55,7 @@ public class TestControl { String taskid = "888888"; // 初始化写用例结果以及日志模块 - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); for (ProjectCase testcase : testCases) { List steps = GetServerApi.getStepsbycaseid(testcase.getCaseId()); if (steps.size() == 0) { @@ -87,7 +86,7 @@ public class TestControl { */ public static void taskExecutionPlan(TaskExecute task) throws Exception { - DbLink.exetype = 0; + serverOperation.exetype = 0; String taskid = task.getTaskId().toString(); TestControl.TASKID = taskid; String restartstatus = RestartServerInitialization.restartServerRun(taskid); @@ -98,7 +97,7 @@ public class TestControl { int[] tastcount = null; List pcplist = GetServerApi.cgetParamsByProjectid(taskScheduling.getProjectId().toString()); // 初始化写用例结果以及日志模块 - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); // 判断是否要自动重启TOMCAT if (restartstatus.indexOf("Status:true") > -1) { // 判断是否构建是否成功 @@ -110,7 +109,7 @@ public class TestControl { List cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId()); LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size()); - LogOperation.updateTaskExecuteStatusIng(taskid, cases.size()); + serverOperation.updateTaskExecuteStatusIng(taskid, cases.size()); int casepriority = 0; for (int j = 0; j < cases.size(); j++) { ProjectCase projectcase = cases.get(j); @@ -151,9 +150,9 @@ public class TestControl { } Thread.sleep(6000); } - tastcount = LogOperation.updateTaskExecuteData(taskid, cases.size(),taskStatus); + tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),taskStatus); - String testtime = LogOperation.getTestTime(taskid); + String testtime = serverOperation.getTestTime(taskid); MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname), HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname), taskid, taskScheduling, tastcount); diff --git a/src/main/java/luckyclient/caserun/exinterface/ThreadForBatchCase.java b/src/main/java/luckyclient/execution/httpinterface/ThreadForBatchCase.java similarity index 92% rename from src/main/java/luckyclient/caserun/exinterface/ThreadForBatchCase.java rename to src/main/java/luckyclient/execution/httpinterface/ThreadForBatchCase.java index 5ccf292..34a7543 100644 --- a/src/main/java/luckyclient/caserun/exinterface/ThreadForBatchCase.java +++ b/src/main/java/luckyclient/execution/httpinterface/ThreadForBatchCase.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java b/src/main/java/luckyclient/execution/httpinterface/ThreadForExecuteCase.java similarity index 95% rename from src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java rename to src/main/java/luckyclient/execution/httpinterface/ThreadForExecuteCase.java index d45adfb..cff7d4c 100644 --- a/src/main/java/luckyclient/caserun/exinterface/ThreadForExecuteCase.java +++ b/src/main/java/luckyclient/execution/httpinterface/ThreadForExecuteCase.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; import java.util.HashMap; import java.util.List; @@ -6,17 +6,17 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.publicdispose.ActionManageForSteps; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.dblog.LogOperation; import luckyclient.driven.SubString; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.InvokeMethod; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.Constants; +import luckyclient.utils.InvokeMethod; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -38,9 +38,9 @@ public class ThreadForExecuteCase extends Thread { private Integer projectId; private List steps; private List pcplist; - private LogOperation caselog; + private serverOperation caselog; - public ThreadForExecuteCase(ProjectCase projectcase, List steps, String taskid, List pcplist, LogOperation caselog) { + public ThreadForExecuteCase(ProjectCase projectcase, List steps, String taskid, List pcplist, serverOperation caselog) { this.caseId = projectcase.getCaseId(); this.testcase = projectcase; this.projectId = projectcase.getProjectId(); diff --git a/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java b/src/main/java/luckyclient/execution/httpinterface/WebTestCaseDebug.java similarity index 94% rename from src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java rename to src/main/java/luckyclient/execution/httpinterface/WebTestCaseDebug.java index acce3ca..0566247 100644 --- a/src/main/java/luckyclient/caserun/exinterface/WebTestCaseDebug.java +++ b/src/main/java/luckyclient/execution/httpinterface/WebTestCaseDebug.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exinterface; +package luckyclient.execution.httpinterface; import java.util.HashMap; import java.util.List; @@ -6,16 +6,16 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.publicdispose.ActionManageForSteps; import luckyclient.driven.SubString; -import luckyclient.publicclass.InvokeMethod; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.api.PostServerApi; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.PostServerApi; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.InvokeMethod; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java b/src/main/java/luckyclient/execution/httpinterface/analyticsteps/InterfaceAnalyticCase.java similarity index 91% rename from src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java rename to src/main/java/luckyclient/execution/httpinterface/analyticsteps/InterfaceAnalyticCase.java index fe3d82e..a526b62 100644 --- a/src/main/java/luckyclient/caserun/exinterface/analyticsteps/InterfaceAnalyticCase.java +++ b/src/main/java/luckyclient/execution/httpinterface/analyticsteps/InterfaceAnalyticCase.java @@ -1,15 +1,15 @@ -package luckyclient.caserun.exinterface.analyticsteps; +package luckyclient.execution.httpinterface.analyticsteps; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ChangString; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 @@ -31,7 +31,7 @@ public class InterfaceAnalyticCase{ * @param caselog * @return */ - public static Map analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,LogOperation caselog, Map variable){ + public static Map analyticCaseStep(ProjectCase projectcase,ProjectCaseSteps step,String taskid,serverOperation caselog, Map variable){ Map params = new HashMap(0); try { diff --git a/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java b/src/main/java/luckyclient/execution/webdriver/BaseWebDrive.java similarity index 93% rename from src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java rename to src/main/java/luckyclient/execution/webdriver/BaseWebDrive.java index 448046a..984ef27 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/BaseWebDrive.java +++ b/src/main/java/luckyclient/execution/webdriver/BaseWebDrive.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import java.io.File; import java.io.IOException; @@ -11,7 +11,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.Augmenter; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java b/src/main/java/luckyclient/execution/webdriver/CaseLocalDebug.java similarity index 77% rename from src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java rename to src/main/java/luckyclient/execution/webdriver/CaseLocalDebug.java index b88b635..35f0a21 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/CaseLocalDebug.java +++ b/src/main/java/luckyclient/execution/webdriver/CaseLocalDebug.java @@ -1,17 +1,16 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import java.util.List; 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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.webdriver.ex.WebCaseExecution; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -29,8 +28,8 @@ public class CaseLocalDebug{ public static void oneCasedebug(WebDriver wd,String testCaseExternalId){ //不记录日志到数据库 - DbLink.exetype = 1; - LogOperation caselog = new LogOperation(); + serverOperation.exetype = 1; + serverOperation caselog = new serverOperation(); try { ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId); List pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId())); diff --git a/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java b/src/main/java/luckyclient/execution/webdriver/EncapsulateOperation.java similarity index 97% rename from src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java rename to src/main/java/luckyclient/execution/webdriver/EncapsulateOperation.java index 0c1a32d..82bef79 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/EncapsulateOperation.java +++ b/src/main/java/luckyclient/execution/webdriver/EncapsulateOperation.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import static java.util.concurrent.TimeUnit.MILLISECONDS; @@ -26,9 +26,9 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import luckyclient.caserun.exwebdriver.ocr.Ocr; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.publicclass.LogUtil; +import luckyclient.execution.dispose.ChangString; +import luckyclient.execution.webdriver.ocr.Ocr; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exwebdriver/TestGoogle.java b/src/main/java/luckyclient/execution/webdriver/TestGoogle.java similarity index 91% rename from src/main/java/luckyclient/caserun/exwebdriver/TestGoogle.java rename to src/main/java/luckyclient/execution/webdriver/TestGoogle.java index af99641..9d0bc5f 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/TestGoogle.java +++ b/src/main/java/luckyclient/execution/webdriver/TestGoogle.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import java.io.IOException; diff --git a/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java b/src/main/java/luckyclient/execution/webdriver/WebDriverInitialization.java similarity index 95% rename from src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java rename to src/main/java/luckyclient/execution/webdriver/WebDriverInitialization.java index f882d05..6cf3da9 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/WebDriverInitialization.java +++ b/src/main/java/luckyclient/execution/webdriver/WebDriverInitialization.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import java.io.File; import java.io.IOException; @@ -13,7 +13,7 @@ import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxOptions; import org.openqa.selenium.ie.InternetExplorerDriver; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java b/src/main/java/luckyclient/execution/webdriver/WebTestControl.java similarity index 80% rename from src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java rename to src/main/java/luckyclient/execution/webdriver/WebTestControl.java index 0c3987d..6ed2442 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/WebTestControl.java +++ b/src/main/java/luckyclient/execution/webdriver/WebTestControl.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver; +package luckyclient.execution.webdriver; import java.io.IOException; import java.util.ArrayList; @@ -7,21 +7,20 @@ import java.util.List; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverException; -import luckyclient.caserun.exinterface.TestControl; -import luckyclient.caserun.exwebdriver.ex.WebCaseExecution; -import luckyclient.dblog.DbLink; -import luckyclient.dblog.LogOperation; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.ex.WebCaseExecution; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.tool.jenkins.BuildingInitialization; +import luckyclient.tool.mail.HtmlMail; +import luckyclient.tool.mail.MailSendInitialization; +import luckyclient.tool.shell.RestartServerInitialization; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -44,7 +43,7 @@ public class WebTestControl { public static void manualExecutionPlan(String planname) { // 不记日志到数据库 - DbLink.exetype = 1; + serverOperation.exetype = 1; String taskid = "888888"; WebDriver wd = null; try { @@ -53,7 +52,7 @@ public class WebTestControl { // TODO Auto-generated catch block LogUtil.APP.error("初始化WebDriver出现异常!",e); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); List testCases = GetServerApi.getCasesbyplanname(planname); List pcplist = new ArrayList(); if (testCases.size() != 0) { @@ -83,7 +82,7 @@ public class WebTestControl { public static void taskExecutionPlan(TaskExecute task) throws InterruptedException { // 记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; String taskid = task.getTaskId().toString(); TestControl.TASKID = taskid; String restartstatus = RestartServerInitialization.restartServerRun(taskid); @@ -93,7 +92,7 @@ public class WebTestControl { String projectname = taskScheduling.getProject().getProjectName(); task = GetServerApi.cgetTaskbyid(Integer.valueOf(taskid)); String jobname = taskScheduling.getSchedulingName(); - int drivertype = LogOperation.querydrivertype(taskid); + int drivertype = serverOperation.querydrivertype(taskid); int[] tastcount = null; // 判断是否要自动重启TOMCAT if (restartstatus.indexOf("Status:true") > -1) { @@ -107,11 +106,11 @@ public class WebTestControl { } catch (IOException e2) { LogUtil.APP.error("初始化WebDriver出错 IOException!", e2); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); List cases = GetServerApi.getCasesbyplanId(taskScheduling.getPlanId()); LogUtil.APP.info("当前测试任务 {} 中共有【{}】条待测试用例...",task.getTaskName(),cases.size()); - LogOperation.updateTaskExecuteStatusIng(taskid, cases.size()); + serverOperation.updateTaskExecuteStatusIng(taskid, cases.size()); int i = 0; for (ProjectCase testcase : cases) { i++; @@ -130,9 +129,9 @@ public class WebTestControl { } LogUtil.APP.info("当前用例:【{}】执行完成......进入下一条",testcase.getCaseSign()); } - tastcount = LogOperation.updateTaskExecuteData(taskid, cases.size(),2); + tastcount = serverOperation.updateTaskExecuteData(taskid, cases.size(),2); - String testtime = LogOperation.getTestTime(taskid); + String testtime = serverOperation.getTestTime(taskid); LogUtil.APP.info("当前项目【{}】测试计划中的用例已经全部执行完成...",projectname); MailSendInitialization.sendMailInitialization(HtmlMail.htmlSubjectFormat(jobname), HtmlMail.htmlContentFormat(tastcount, taskid, buildstatus, restartstatus, testtime, jobname), diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java b/src/main/java/luckyclient/execution/webdriver/ex/WebBatchExecute.java similarity index 72% rename from src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java rename to src/main/java/luckyclient/execution/webdriver/ex/WebBatchExecute.java index e4edd1a..55163fc 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebBatchExecute.java +++ b/src/main/java/luckyclient/execution/webdriver/ex/WebBatchExecute.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver.ex; +package luckyclient.execution.webdriver.ex; import java.io.IOException; import java.net.MalformedURLException; @@ -6,16 +6,15 @@ import java.util.List; import org.openqa.selenium.WebDriver; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.TaskExecute; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.WebDriverInitialization; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -32,9 +31,9 @@ public class WebBatchExecute{ public static void batchCaseExecuteForTast(String projectname,String taskid,String batchcase) throws IOException{ //记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; - int drivertype = LogOperation.querydrivertype(taskid); + int drivertype = serverOperation.querydrivertype(taskid); WebDriver wd = null; try { wd = WebDriverInitialization.setWebDriverForTask(drivertype); @@ -42,7 +41,7 @@ public class WebBatchExecute{ // TODO Auto-generated catch block LogUtil.APP.error("初始化WebDriver出现异常!", e1); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); TaskExecute task=GetServerApi.cgetTaskbyid(Integer.valueOf(taskid)); List pcplist=GetServerApi.cgetParamsByProjectid(task.getProjectId().toString()); //执行全部非成功状态用例 @@ -52,7 +51,7 @@ public class WebBatchExecute{ ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseIdList.get(i)); List steps=GetServerApi.getStepsbycaseid(testcase.getCaseId()); //删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { WebCaseExecution.caseExcution(testcase, steps, taskid,wd,caselog,pcplist); } catch (InterruptedException e) { @@ -66,7 +65,7 @@ public class WebBatchExecute{ ProjectCase testcase = GetServerApi.cGetCaseByCaseId(Integer.valueOf(temp[i])); List steps=GetServerApi.getStepsbycaseid(testcase.getCaseId()); //删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); try { WebCaseExecution.caseExcution(testcase, steps,taskid,wd,caselog,pcplist); } catch (InterruptedException e) { @@ -75,7 +74,7 @@ public class WebBatchExecute{ } } } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); //关闭浏览器 wd.quit(); } diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java b/src/main/java/luckyclient/execution/webdriver/ex/WebCaseExecution.java similarity index 93% rename from src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java rename to src/main/java/luckyclient/execution/webdriver/ex/WebCaseExecution.java index 9465279..0587611 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebCaseExecution.java +++ b/src/main/java/luckyclient/execution/webdriver/ex/WebCaseExecution.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver.ex; +package luckyclient.execution.webdriver.ex; import java.util.Date; import java.util.HashMap; @@ -11,18 +11,18 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import luckyclient.caserun.exinterface.TestCaseExecution; -import luckyclient.caserun.exinterface.analyticsteps.InterfaceAnalyticCase; -import luckyclient.caserun.exwebdriver.BaseWebDrive; -import luckyclient.caserun.exwebdriver.EncapsulateOperation; -import luckyclient.caserun.publicdispose.ActionManageForSteps; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ActionManageForSteps; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.execution.httpinterface.TestCaseExecution; +import luckyclient.execution.httpinterface.analyticsteps.InterfaceAnalyticCase; +import luckyclient.execution.webdriver.BaseWebDrive; +import luckyclient.execution.webdriver.EncapsulateOperation; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.Constants; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -39,7 +39,7 @@ public class WebCaseExecution{ private static String casenote = "备注初始化"; private static String imagname = ""; - public static void caseExcution(ProjectCase testcase, List steps, String taskid, WebDriver wd, LogOperation caselog, List pcplist) throws InterruptedException { + public static void caseExcution(ProjectCase testcase, List steps, String taskid, WebDriver wd, serverOperation caselog, List pcplist) throws InterruptedException { caselog.updateTaskCaseExecuteStatus(taskid, testcase.getCaseId(), 3); // 把公共参数加入到MAP中 for (ProjectCaseParams pcp : pcplist) { @@ -101,7 +101,7 @@ public class WebCaseExecution{ } } - public static String runWebStep(Map params, WebDriver wd, String taskid, Integer caseId, int stepno, LogOperation caselog) { + public static String runWebStep(Map params, WebDriver wd, String taskid, Integer caseId, int stepno, serverOperation caselog) { String result = ""; String property; String propertyValue; @@ -237,7 +237,7 @@ public class WebCaseExecution{ } - public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, WebDriver driver, String taskid, String expect, String result, LogOperation caselog) throws InterruptedException { + public static int judgeResult(ProjectCase testcase, ProjectCaseSteps step, Map params, WebDriver driver, String taskid, String expect, String result, serverOperation caselog) throws InterruptedException { int setresult = 0; java.text.DateFormat timeformat = new java.text.SimpleDateFormat("MMdd-hhmmss"); imagname = timeformat.format(new Date()); diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java b/src/main/java/luckyclient/execution/webdriver/ex/WebDriverAnalyticCase.java similarity index 92% rename from src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java rename to src/main/java/luckyclient/execution/webdriver/ex/WebDriverAnalyticCase.java index dc46268..9cf5ca2 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebDriverAnalyticCase.java +++ b/src/main/java/luckyclient/execution/webdriver/ex/WebDriverAnalyticCase.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver.ex; +package luckyclient.execution.webdriver.ex; import java.util.HashMap; import java.util.Map; @@ -7,11 +7,11 @@ import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.dispose.ChangString; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -39,7 +39,7 @@ public class WebDriverAnalyticCase { * @date 2019年1月17日 */ public static Map analyticCaseStep(ProjectCase projectcase, ProjectCaseSteps step, String taskid, - LogOperation caselog, Map variable) { + serverOperation caselog, Map variable) { Map params = new HashMap(0); String resultstr = null; diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java b/src/main/java/luckyclient/execution/webdriver/ex/WebOneCaseExecute.java similarity index 67% rename from src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java rename to src/main/java/luckyclient/execution/webdriver/ex/WebOneCaseExecute.java index 8af8f0e..9e8ac41 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/ex/WebOneCaseExecute.java +++ b/src/main/java/luckyclient/execution/webdriver/ex/WebOneCaseExecute.java @@ -1,19 +1,18 @@ -package luckyclient.caserun.exwebdriver.ex; +package luckyclient.execution.webdriver.ex; import java.io.IOException; import java.util.List; import org.openqa.selenium.WebDriver; -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; -import luckyclient.serverapi.entity.ProjectCaseSteps; +import luckyclient.execution.httpinterface.TestControl; +import luckyclient.execution.webdriver.WebDriverInitialization; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -30,19 +29,19 @@ public class WebOneCaseExecute{ public static void oneCaseExecuteForTast(String projectname,Integer caseId,int version,String taskid){ //记录日志到数据库 - DbLink.exetype = 0; + serverOperation.exetype = 0; TestControl.TASKID = taskid; - int drivertype = LogOperation.querydrivertype(taskid); + int drivertype = serverOperation.querydrivertype(taskid); WebDriver wd = null; try { wd = WebDriverInitialization.setWebDriverForTask(drivertype); } catch (IOException e1) { LogUtil.APP.error("初始化WebDriver出错!", e1); } - LogOperation caselog = new LogOperation(); + serverOperation caselog = new serverOperation(); ProjectCase testcase = GetServerApi.cGetCaseByCaseId(caseId); //删除旧的日志 - LogOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); + serverOperation.deleteTaskCaseLog(testcase.getCaseId(), taskid); List pcplist=GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId())); LogUtil.APP.info("开始执行用例:【{}】......",testcase.getCaseSign()); @@ -53,7 +52,7 @@ public class WebOneCaseExecute{ } catch (InterruptedException e) { LogUtil.APP.error("用户执行过程中抛出异常!", e); } - LogOperation.updateTaskExecuteData(taskid, 0,2); + serverOperation.updateTaskExecuteData(taskid, 0,2); //关闭浏览器 wd.quit(); } diff --git a/src/main/java/luckyclient/caserun/exwebdriver/ocr/Ocr.java b/src/main/java/luckyclient/execution/webdriver/ocr/Ocr.java similarity index 95% rename from src/main/java/luckyclient/caserun/exwebdriver/ocr/Ocr.java rename to src/main/java/luckyclient/execution/webdriver/ocr/Ocr.java index 91980e3..a4bafb4 100644 --- a/src/main/java/luckyclient/caserun/exwebdriver/ocr/Ocr.java +++ b/src/main/java/luckyclient/execution/webdriver/ocr/Ocr.java @@ -1,4 +1,4 @@ -package luckyclient.caserun.exwebdriver.ocr; +package luckyclient.execution.webdriver.ocr; import java.awt.Rectangle; import java.awt.image.BufferedImage; diff --git a/src/main/java/luckyclient/serverapi/api/GetServerApi.java b/src/main/java/luckyclient/remote/api/GetServerApi.java similarity index 87% rename from src/main/java/luckyclient/serverapi/api/GetServerApi.java rename to src/main/java/luckyclient/remote/api/GetServerApi.java index cf8cc1d..39c1844 100644 --- a/src/main/java/luckyclient/serverapi/api/GetServerApi.java +++ b/src/main/java/luckyclient/remote/api/GetServerApi.java @@ -1,19 +1,19 @@ -package luckyclient.serverapi.api; +package luckyclient.remote.api; import java.io.UnsupportedEncodingException; import java.util.List; import com.alibaba.fastjson.JSONObject; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.publicclass.remoterinterface.HttpRequest; -import luckyclient.serverapi.entity.ProjectCase; -import luckyclient.serverapi.entity.ProjectCaseParams; -import luckyclient.serverapi.entity.ProjectCaseSteps; -import luckyclient.serverapi.entity.ProjectProtocolTemplate; -import luckyclient.serverapi.entity.ProjectTemplateParams; -import luckyclient.serverapi.entity.TaskExecute; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.remote.entity.ProjectCase; +import luckyclient.remote.entity.ProjectCaseParams; +import luckyclient.remote.entity.ProjectCaseSteps; +import luckyclient.remote.entity.ProjectProtocolTemplate; +import luckyclient.remote.entity.ProjectTemplateParams; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.httputils.HttpRequest; /** diff --git a/src/main/java/luckyclient/serverapi/api/PostServerApi.java b/src/main/java/luckyclient/remote/api/PostServerApi.java similarity index 92% rename from src/main/java/luckyclient/serverapi/api/PostServerApi.java rename to src/main/java/luckyclient/remote/api/PostServerApi.java index e669749..a8ad13c 100644 --- a/src/main/java/luckyclient/serverapi/api/PostServerApi.java +++ b/src/main/java/luckyclient/remote/api/PostServerApi.java @@ -1,12 +1,12 @@ -package luckyclient.serverapi.api; +package luckyclient.remote.api; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import luckyclient.publicclass.remoterinterface.HttpRequest; -import luckyclient.serverapi.entity.ProjectCaseDebug; -import luckyclient.serverapi.entity.TaskCaseExecute; -import luckyclient.serverapi.entity.TaskCaseLog; +import luckyclient.remote.entity.ProjectCaseDebug; +import luckyclient.remote.entity.TaskCaseExecute; +import luckyclient.remote.entity.TaskCaseLog; +import luckyclient.utils.httputils.HttpRequest; /** diff --git a/src/main/java/luckyclient/dblog/LogOperation.java b/src/main/java/luckyclient/remote/api/serverOperation.java similarity index 93% rename from src/main/java/luckyclient/dblog/LogOperation.java rename to src/main/java/luckyclient/remote/api/serverOperation.java index 1fc6fe2..68ead3e 100644 --- a/src/main/java/luckyclient/dblog/LogOperation.java +++ b/src/main/java/luckyclient/remote/api/serverOperation.java @@ -1,15 +1,13 @@ -package luckyclient.dblog; +package luckyclient.remote.api; import java.util.Date; 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; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.remote.entity.TaskExecute; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.LogUtil; /** * @@ -20,8 +18,11 @@ import luckyclient.serverapi.entity.TaskScheduling; * @author Seagull * @date 2019年4月23日 */ -public class LogOperation { - static int exetype = DbLink.exetype; +public class serverOperation { + /** + * 任务执行类型: 0 任务调度模式 1 控制台模式 + */ + public static int exetype; /** * 插入用例执行状态 0通过 1失败 2锁定 3执行中 4未执行 diff --git a/src/main/java/luckyclient/serverapi/entity/BaseEntity.java b/src/main/java/luckyclient/remote/entity/BaseEntity.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/BaseEntity.java rename to src/main/java/luckyclient/remote/entity/BaseEntity.java index 9c1db9f..78cb30c 100644 --- a/src/main/java/luckyclient/serverapi/entity/BaseEntity.java +++ b/src/main/java/luckyclient/remote/entity/BaseEntity.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import java.io.Serializable; import java.util.Date; diff --git a/src/main/java/luckyclient/serverapi/entity/Project.java b/src/main/java/luckyclient/remote/entity/Project.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/Project.java rename to src/main/java/luckyclient/remote/entity/Project.java index 8c94088..c321fe6 100644 --- a/src/main/java/luckyclient/serverapi/entity/Project.java +++ b/src/main/java/luckyclient/remote/entity/Project.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectCase.java b/src/main/java/luckyclient/remote/entity/ProjectCase.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/ProjectCase.java rename to src/main/java/luckyclient/remote/entity/ProjectCase.java index d8189b4..da0b252 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectCase.java +++ b/src/main/java/luckyclient/remote/entity/ProjectCase.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectCaseDebug.java b/src/main/java/luckyclient/remote/entity/ProjectCaseDebug.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/ProjectCaseDebug.java rename to src/main/java/luckyclient/remote/entity/ProjectCaseDebug.java index 700df8b..69613f0 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectCaseDebug.java +++ b/src/main/java/luckyclient/remote/entity/ProjectCaseDebug.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectCaseModule.java b/src/main/java/luckyclient/remote/entity/ProjectCaseModule.java similarity index 94% rename from src/main/java/luckyclient/serverapi/entity/ProjectCaseModule.java rename to src/main/java/luckyclient/remote/entity/ProjectCaseModule.java index 8f76f28..1119b9f 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectCaseModule.java +++ b/src/main/java/luckyclient/remote/entity/ProjectCaseModule.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectCaseParams.java b/src/main/java/luckyclient/remote/entity/ProjectCaseParams.java similarity index 94% rename from src/main/java/luckyclient/serverapi/entity/ProjectCaseParams.java rename to src/main/java/luckyclient/remote/entity/ProjectCaseParams.java index b371f6c..0dd9d02 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectCaseParams.java +++ b/src/main/java/luckyclient/remote/entity/ProjectCaseParams.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectCaseSteps.java b/src/main/java/luckyclient/remote/entity/ProjectCaseSteps.java similarity index 94% rename from src/main/java/luckyclient/serverapi/entity/ProjectCaseSteps.java rename to src/main/java/luckyclient/remote/entity/ProjectCaseSteps.java index 160900a..f8938f6 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectCaseSteps.java +++ b/src/main/java/luckyclient/remote/entity/ProjectCaseSteps.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectPlan.java b/src/main/java/luckyclient/remote/entity/ProjectPlan.java similarity index 94% rename from src/main/java/luckyclient/serverapi/entity/ProjectPlan.java rename to src/main/java/luckyclient/remote/entity/ProjectPlan.java index c1a82b1..2ca9020 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectPlan.java +++ b/src/main/java/luckyclient/remote/entity/ProjectPlan.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectPlanCase.java b/src/main/java/luckyclient/remote/entity/ProjectPlanCase.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/ProjectPlanCase.java rename to src/main/java/luckyclient/remote/entity/ProjectPlanCase.java index 1a13fd7..b79f281 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectPlanCase.java +++ b/src/main/java/luckyclient/remote/entity/ProjectPlanCase.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectProtocolTemplate.java b/src/main/java/luckyclient/remote/entity/ProjectProtocolTemplate.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/ProjectProtocolTemplate.java rename to src/main/java/luckyclient/remote/entity/ProjectProtocolTemplate.java index 09f1f0f..543349f 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectProtocolTemplate.java +++ b/src/main/java/luckyclient/remote/entity/ProjectProtocolTemplate.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/ProjectTemplateParams.java b/src/main/java/luckyclient/remote/entity/ProjectTemplateParams.java similarity index 94% rename from src/main/java/luckyclient/serverapi/entity/ProjectTemplateParams.java rename to src/main/java/luckyclient/remote/entity/ProjectTemplateParams.java index 2476e1d..42aeef1 100644 --- a/src/main/java/luckyclient/serverapi/entity/ProjectTemplateParams.java +++ b/src/main/java/luckyclient/remote/entity/ProjectTemplateParams.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/TaskCaseExecute.java b/src/main/java/luckyclient/remote/entity/TaskCaseExecute.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/TaskCaseExecute.java rename to src/main/java/luckyclient/remote/entity/TaskCaseExecute.java index e502901..4e33192 100644 --- a/src/main/java/luckyclient/serverapi/entity/TaskCaseExecute.java +++ b/src/main/java/luckyclient/remote/entity/TaskCaseExecute.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import java.util.Date; diff --git a/src/main/java/luckyclient/serverapi/entity/TaskCaseLog.java b/src/main/java/luckyclient/remote/entity/TaskCaseLog.java similarity index 93% rename from src/main/java/luckyclient/serverapi/entity/TaskCaseLog.java rename to src/main/java/luckyclient/remote/entity/TaskCaseLog.java index e7acba1..f68bdad 100644 --- a/src/main/java/luckyclient/serverapi/entity/TaskCaseLog.java +++ b/src/main/java/luckyclient/remote/entity/TaskCaseLog.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/TaskExecute.java b/src/main/java/luckyclient/remote/entity/TaskExecute.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/TaskExecute.java rename to src/main/java/luckyclient/remote/entity/TaskExecute.java index 75871d5..08155b3 100644 --- a/src/main/java/luckyclient/serverapi/entity/TaskExecute.java +++ b/src/main/java/luckyclient/remote/entity/TaskExecute.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import java.util.Date; diff --git a/src/main/java/luckyclient/serverapi/entity/TaskScheduling.java b/src/main/java/luckyclient/remote/entity/TaskScheduling.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/TaskScheduling.java rename to src/main/java/luckyclient/remote/entity/TaskScheduling.java index db1a17e..3322104 100644 --- a/src/main/java/luckyclient/serverapi/entity/TaskScheduling.java +++ b/src/main/java/luckyclient/remote/entity/TaskScheduling.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity; +package luckyclient.remote.entity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Arith.java b/src/main/java/luckyclient/remote/entity/monitor/Arith.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/monitor/Arith.java rename to src/main/java/luckyclient/remote/entity/monitor/Arith.java index 2453965..df6523f 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Arith.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Arith.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; import java.math.BigDecimal; diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Cpu.java b/src/main/java/luckyclient/remote/entity/monitor/Cpu.java similarity index 92% rename from src/main/java/luckyclient/serverapi/entity/monitor/Cpu.java rename to src/main/java/luckyclient/remote/entity/monitor/Cpu.java index 0a42513..f61de3c 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Cpu.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Cpu.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; /** * CPU相关信息 diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/IpUtils.java b/src/main/java/luckyclient/remote/entity/monitor/IpUtils.java similarity index 96% rename from src/main/java/luckyclient/serverapi/entity/monitor/IpUtils.java rename to src/main/java/luckyclient/remote/entity/monitor/IpUtils.java index 41894ef..e617979 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/IpUtils.java +++ b/src/main/java/luckyclient/remote/entity/monitor/IpUtils.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Jvm.java b/src/main/java/luckyclient/remote/entity/monitor/Jvm.java similarity index 91% rename from src/main/java/luckyclient/serverapi/entity/monitor/Jvm.java rename to src/main/java/luckyclient/remote/entity/monitor/Jvm.java index 857ee2d..3c2314a 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Jvm.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Jvm.java @@ -1,8 +1,8 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; import java.lang.management.ManagementFactory; -import luckyclient.publicclass.DateUtils; +import luckyclient.utils.DateUtils; /** * JVM相关信息 diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Mem.java b/src/main/java/luckyclient/remote/entity/monitor/Mem.java similarity index 92% rename from src/main/java/luckyclient/serverapi/entity/monitor/Mem.java rename to src/main/java/luckyclient/remote/entity/monitor/Mem.java index c4b421f..8161bfc 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Mem.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Mem.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; /** * 內存相关信息 diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Server.java b/src/main/java/luckyclient/remote/entity/monitor/Server.java similarity index 95% rename from src/main/java/luckyclient/serverapi/entity/monitor/Server.java rename to src/main/java/luckyclient/remote/entity/monitor/Server.java index 84d7fb1..2542a22 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Server.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Server.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; import java.net.UnknownHostException; import java.util.LinkedList; diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/Sys.java b/src/main/java/luckyclient/remote/entity/monitor/Sys.java similarity index 92% rename from src/main/java/luckyclient/serverapi/entity/monitor/Sys.java rename to src/main/java/luckyclient/remote/entity/monitor/Sys.java index 1455553..806a8f9 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/Sys.java +++ b/src/main/java/luckyclient/remote/entity/monitor/Sys.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; /** * 系统相关信息 diff --git a/src/main/java/luckyclient/serverapi/entity/monitor/SysFile.java b/src/main/java/luckyclient/remote/entity/monitor/SysFile.java similarity index 92% rename from src/main/java/luckyclient/serverapi/entity/monitor/SysFile.java rename to src/main/java/luckyclient/remote/entity/monitor/SysFile.java index 9973d04..ef77fe0 100644 --- a/src/main/java/luckyclient/serverapi/entity/monitor/SysFile.java +++ b/src/main/java/luckyclient/remote/entity/monitor/SysFile.java @@ -1,4 +1,4 @@ -package luckyclient.serverapi.entity.monitor; +package luckyclient.remote.entity.monitor; /** * 系统文件相关信息 diff --git a/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java b/src/main/java/luckyclient/tool/jenkins/BuildingInitialization.java similarity index 89% rename from src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java rename to src/main/java/luckyclient/tool/jenkins/BuildingInitialization.java index 7649434..b972d93 100644 --- a/src/main/java/luckyclient/jenkinsapi/BuildingInitialization.java +++ b/src/main/java/luckyclient/tool/jenkins/BuildingInitialization.java @@ -1,7 +1,7 @@ -package luckyclient.jenkinsapi; +package luckyclient.tool.jenkins; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; +import luckyclient.remote.api.serverOperation; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -46,7 +46,7 @@ public class BuildingInitialization { public static String buildingRun(String tastid) throws InterruptedException{ String result = "Status:true"+" 当前任务没有找到需要构建的项目!"; try{ - String[] buildurl = LogOperation.getBuildName(tastid); + String[] buildurl = serverOperation.getBuildName(tastid); if(buildurl!=null){ LogUtil.APP.info("准备将配置的测试项目进行构建!请稍等。。。。"); diff --git a/src/main/java/luckyclient/tool/jenkins/JenkinsBaseApi.java b/src/main/java/luckyclient/tool/jenkins/JenkinsBaseApi.java new file mode 100644 index 0000000..5c73c17 --- /dev/null +++ b/src/main/java/luckyclient/tool/jenkins/JenkinsBaseApi.java @@ -0,0 +1,164 @@ +package luckyclient.tool.jenkins; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import com.offbytwo.jenkins.JenkinsServer; +import com.offbytwo.jenkins.model.Computer; +import com.offbytwo.jenkins.model.Plugin; +import com.offbytwo.jenkins.model.PluginManager; + +import luckyclient.utils.LogUtil; + +/** + * 获取 Jenkins 基础信息以及基本操作 + * ================================================================= + * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 + * 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 Seagull + * ================================================================= + * @author Seagull + * @date 2019年10月29日 + */ +public class JenkinsBaseApi { + + // Jenkins 对象 + private JenkinsServer jenkinsServer; + + /** + * 构造方法中调用连接 Jenkins 方法 + * @param jenkinsConnect + * 2019年10月29日 + */ + JenkinsBaseApi(JenkinsConnect jenkinsConnect){ + this.jenkinsServer = jenkinsConnect.connection(); + } + + /** + * 获取主机信息 + * @author Seagull + * @date 2019年10月29日 + */ + public void getComputerInfo() { + try { + Map map = jenkinsServer.getComputers(); + for (Computer computer : map.values()) { + // 获取当前节点-节点名称 + LogUtil.APP.info("当前节点-节点名称:{}",computer.details().getDisplayName()); + // 获取当前节点-执行者数量 + LogUtil.APP.info("当前节点-执行者数量:{}",computer.details().getNumExecutors().toString()); + // 获取当前节点-执行者详细信息 + //List executorList = computer.details().getExecutors(); + // 查看当前节点-是否脱机 + LogUtil.APP.info("当前节点-是否脱机:{}",computer.details().getOffline().toString()); + // 获得节点的全部统计信息 + //LoadStatistics loadStatistics = computer.details().getLoadStatistics(); + // 获取节点的-监控数据 + //Map monitorData = computer.details().getMonitorData(); + //...... + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 重启 Jenkins + * @author Seagull + * @date 2019年10月29日 + */ + public void restart() { + try { + LogUtil.APP.info("准备重启Jenkins..."); + jenkinsServer.restart(true); + LogUtil.APP.info("重启Jenkins成功!"); + } catch (IOException e) { + LogUtil.APP.error("重启Jenkins出现异常",e); + } + } + + /** + * 安全重启 Jenkins + * @author Seagull + * @date 2019年10月29日 + */ + public void safeRestart() { + try { + LogUtil.APP.info("准备安全重启 Jenkins..."); + jenkinsServer.safeRestart(true); + LogUtil.APP.info("安全重启Jenkins成功!"); + } catch (IOException e) { + LogUtil.APP.error("安全重启Jenkins出现异常",e); + } + } + + /** + * 安全结束 Jenkins + * + * @author Seagull + * @date 2019年10月29日 + */ + public void safeExit() { + try { + LogUtil.APP.info("准备安全结束 Jenkins..."); + jenkinsServer.safeExit(true); + LogUtil.APP.info("安全结束 Jenkins成功!"); + } catch (IOException e) { + LogUtil.APP.error("安全结束Jenkins出现异常",e); + } + } + + /** + * 关闭 Jenkins 连接 + * + * @author Seagull + * @date 2019年10月29日 + */ + public void close() { + LogUtil.APP.info("准备关闭Jenkins连接"); + jenkinsServer.close(); + LogUtil.APP.info("关闭Jenkins连接成功"); + } + + /** + * 判断 Jenkins 是否运行 + * + * @author Seagull + * @date 2019年10月29日 + */ + public void isRunning() { + boolean isRunning = jenkinsServer.isRunning(); + LogUtil.APP.info("Jenkins运行状态:{}",isRunning); + } + + /** + * 获取 Jenkins 插件信息 + * + * @author Seagull + * @date 2019年10月29日 + */ + public void getPluginInfo(){ + try { + PluginManager pluginManager =jenkinsServer.getPluginManager(); + // 获取插件列表 + List plugins = pluginManager.getPlugins(); + for (Plugin plugin:plugins){ + // 插件 wiki URL 地址 + LogUtil.APP.info(plugin.getUrl()); + // 版本号 + LogUtil.APP.info(plugin.getVersion()); + // 简称 + LogUtil.APP.info(plugin.getShortName()); + // 完整名称 + LogUtil.APP.info(plugin.getLongName()); + // 是否支持动态加载 + LogUtil.APP.info(plugin.getSupportsDynamicLoad()); + // 插件依赖的组件 + //LogUtil.APP.info(plugin.getDependencies()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/luckyclient/jenkinsapi/JenkinsBuilding.java b/src/main/java/luckyclient/tool/jenkins/JenkinsBuilding.java similarity index 95% rename from src/main/java/luckyclient/jenkinsapi/JenkinsBuilding.java rename to src/main/java/luckyclient/tool/jenkins/JenkinsBuilding.java index 9377d61..0575829 100644 --- a/src/main/java/luckyclient/jenkinsapi/JenkinsBuilding.java +++ b/src/main/java/luckyclient/tool/jenkins/JenkinsBuilding.java @@ -1,4 +1,4 @@ -package luckyclient.jenkinsapi; +package luckyclient.tool.jenkins; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -7,7 +7,7 @@ import java.net.URLConnection; import java.util.List; import java.util.Map; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/tool/jenkins/JenkinsConnect.java b/src/main/java/luckyclient/tool/jenkins/JenkinsConnect.java new file mode 100644 index 0000000..19143af --- /dev/null +++ b/src/main/java/luckyclient/tool/jenkins/JenkinsConnect.java @@ -0,0 +1,69 @@ +package luckyclient.tool.jenkins; + +import com.offbytwo.jenkins.JenkinsServer; +import com.offbytwo.jenkins.client.JenkinsHttpClient; + +import luckyclient.utils.LogUtil; +import luckyclient.utils.SysConfig; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; + +/** + * Jenkins链接 + * ================================================================= + * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 + * 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 Seagull + * ================================================================= + * @author Seagull + * @date 2019年10月29日 + */ +public class JenkinsConnect { + + private String JENKINS_URL; + private String JENKINS_USERNAME; + private String JENKINS_PASSWORD; + + JenkinsConnect() { + Properties properties = SysConfig.getConfiguration(); + this.JENKINS_URL=properties.getProperty("jenkins.url"); + this.JENKINS_USERNAME=properties.getProperty("jenkins.username"); + this.JENKINS_PASSWORD=properties.getProperty("jenkins.password"); + } + + /** + * 如果有些 API 该Jar工具包未提供,可以用此Http客户端操作远程接口,执行命令 + * @return + * @author Seagull + * @date 2019年10月29日 + */ + public JenkinsHttpClient getClient() { + JenkinsHttpClient jenkinsHttpClient = null; + try { + jenkinsHttpClient = new JenkinsHttpClient(new URI(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + return jenkinsHttpClient; + } + + /** + * Jenkins API链接 + * @return + * @author Seagull + * @date 2019年10月29日 + */ + public JenkinsServer connection() { + JenkinsServer jenkinsServer = null; + try { + LogUtil.APP.info("准备连接Jenkins...URL:{} 用户名:{} 密码:{}",JENKINS_URL,JENKINS_USERNAME,JENKINS_PASSWORD); + jenkinsServer = new JenkinsServer(new URI(JENKINS_URL), JENKINS_USERNAME, JENKINS_PASSWORD); + LogUtil.APP.info("连接Jenkins成功!"); + LogUtil.APP.info("Jenkins版本:{}",jenkinsServer.getVersion()); + } catch (URISyntaxException e) { + LogUtil.APP.error("连接Jenkins出现异常",e); + } + return jenkinsServer; + } +} \ No newline at end of file diff --git a/src/main/java/luckyclient/tool/jenkins/JobBuildApi.java b/src/main/java/luckyclient/tool/jenkins/JobBuildApi.java new file mode 100644 index 0000000..06e9d9f --- /dev/null +++ b/src/main/java/luckyclient/tool/jenkins/JobBuildApi.java @@ -0,0 +1,144 @@ +package luckyclient.tool.jenkins; + +import java.io.IOException; +import java.util.List; + +import com.offbytwo.jenkins.JenkinsServer; +import com.offbytwo.jenkins.helper.Range; +import com.offbytwo.jenkins.model.Build; +import com.offbytwo.jenkins.model.BuildCause; +import com.offbytwo.jenkins.model.BuildWithDetails; +import com.offbytwo.jenkins.model.ConsoleLog; +import com.offbytwo.jenkins.model.JobWithDetails; + +/** + * * Job Build(任务构建) 相关操作 + * 例如对任务 Build 相关的信息进行获取操作、例如获取构建日志 + * ================================================================= + * 这是一个受限制的自由软件!您不能在任何未经允许的前提下对程序代码进行修改和用于商业用途;也不允许对程序代码修改后以任何形式任何目的的再发布。 + * 为了尊重作者的劳动成果,LuckyFrame关键版权信息严禁篡改 有任何疑问欢迎联系作者讨论。 QQ:1573584944 Seagull + * ================================================================= + * @author Seagull + * @date 2019年10月30日 + */ +public class JobBuildApi { + + // Jenkins 对象 + private JenkinsServer jenkinsServer; + // http 客户端对象 + //private JenkinsHttpClient jenkinsHttpClient; + + /** + * 构造方法中调用连接 Jenkins 方法 + * + * 2019年10月30日 + */ + JobBuildApi() { + JenkinsConnect jenkinsConnect = new JenkinsConnect(); + // 连接 Jenkins + jenkinsServer = jenkinsConnect.connection(); + // 设置客户端连接 Jenkins + //jenkinsHttpClient = jenkinsConnect.getClient(); + } + + /** + * 获取 最后一次Build的详细信息 + * @param jobName + * @author Seagull + * @date 2019年10月30日 + */ + public void getJobLastBuildDetail(String jobName){ + try { + // 获取 Job 信息 + JobWithDetails job = jenkinsServer.getJob(jobName); + // 这里用最后一次编译来示例 + BuildWithDetails build = job.getLastBuild().details(); + // 获取构建的显示名称 + System.out.println(build.getDisplayName()); + // 获取构建的参数信息 + System.out.println(build.getParameters()); + // 获取构建编号 + System.out.println(build.getNumber()); + // 获取构建结果,如果构建未完成则会显示为null + System.out.println(build.getResult()); + // 获取执行构建的活动信息 + System.out.println(build.getActions()); + // 获取构建持续多少时间(ms) + System.out.println(build.getDuration()); + // 获取构建开始时间戳 + System.out.println(build.getTimestamp()); + // 获取构建头信息,里面包含构建的用户,上游信息,时间戳等 + List buildCauses = build.getCauses(); + for (BuildCause bc:buildCauses){ + System.out.println(bc.getUserId()); + System.out.println(bc.getShortDescription()); + System.out.println(bc.getUpstreamBuild()); + System.out.println(bc.getUpstreamProject()); + System.out.println(bc.getUpstreamUrl()); + System.out.println(bc.getUserName()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 获取 Build Log 日志信息 + */ + public void getJobBuildLog(){ + try { + // 获取 Job 信息 + JobWithDetails job = jenkinsServer.getJob("test-job"); + // 这里用最后一次编译来示例 + BuildWithDetails build = job.getLastBuild().details(); + // 获取构建的日志,如果正在执行构建,则会只获取已经执行的过程日志 + + // Text格式日志 + System.out.println(build.getConsoleOutputText()); + // Html格式日志 + System.out.println(build.getConsoleOutputHtml()); + + // 获取部分日志,一般用于正在执行构建的任务 + ConsoleLog consoleLog = build.getConsoleOutputText(0); + // 获取当前日志大小 + System.out.println(consoleLog.getCurrentBufferSize()); + // 是否已经构建完成,还有更多日志信息 + System.out.println(consoleLog.getHasMoreData()); + // 获取当前截取的日志信息 + System.out.println(consoleLog.getConsoleLog()); + }catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 获取正在执行构建任务的日志信息 + */ + public void getBuildActiveLog(){ + try { + // 这里用最后一次编译来示例 + BuildWithDetails build = jenkinsServer.getJob("test-job").getLastBuild().details(); + // 当前日志 + ConsoleLog currentLog = build.getConsoleOutputText(0); + // 输出当前获取日志信息 + System.out.println(currentLog.getConsoleLog()); + // 检测是否还有更多日志,如果是则继续循环获取 + while (currentLog.getHasMoreData()){ + // 获取最新日志信息 + ConsoleLog newLog = build.getConsoleOutputText(currentLog.getCurrentBufferSize()); + // 输出最新日志 + System.out.println(newLog.getConsoleLog()); + currentLog = newLog; + // 睡眠1s + Thread.sleep(1000); + } + }catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + JobBuildApi jobBuildApi = new JobBuildApi(); + jobBuildApi.getJobLastBuildDetail(""); + } +} diff --git a/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java b/src/main/java/luckyclient/tool/mail/FreemarkerEmailTemplate.java similarity index 92% rename from src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java rename to src/main/java/luckyclient/tool/mail/FreemarkerEmailTemplate.java index 7b5b8d1..a7a11d6 100644 --- a/src/main/java/luckyclient/mail/FreemarkerEmailTemplate.java +++ b/src/main/java/luckyclient/tool/mail/FreemarkerEmailTemplate.java @@ -1,4 +1,4 @@ -package luckyclient.mail; +package luckyclient.tool.mail; import java.io.StringWriter; import java.util.HashMap; @@ -8,8 +8,8 @@ import java.util.Properties; import freemarker.cache.ClassTemplateLoader; import freemarker.template.Configuration; import freemarker.template.Template; -import luckyclient.publicclass.LogUtil; -import luckyclient.publicclass.SysConfig; +import luckyclient.utils.LogUtil; +import luckyclient.utils.SysConfig; /** * 基于Freemarker模板技术的邮件模板服务 diff --git a/src/main/java/luckyclient/mail/HtmlMail.java b/src/main/java/luckyclient/tool/mail/HtmlMail.java similarity index 90% rename from src/main/java/luckyclient/mail/HtmlMail.java rename to src/main/java/luckyclient/tool/mail/HtmlMail.java index aaff524..304fca0 100644 --- a/src/main/java/luckyclient/mail/HtmlMail.java +++ b/src/main/java/luckyclient/tool/mail/HtmlMail.java @@ -1,13 +1,13 @@ -package luckyclient.mail; +package luckyclient.tool.mail; 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; +import luckyclient.remote.entity.ProjectProtocolTemplate; +import luckyclient.utils.LogUtil; +import luckyclient.utils.SysConfig; +import luckyclient.utils.httputils.HttpClientHelper; /** * ================================================================= diff --git a/src/main/java/luckyclient/mail/MailSendInitialization.java b/src/main/java/luckyclient/tool/mail/MailSendInitialization.java similarity index 90% rename from src/main/java/luckyclient/mail/MailSendInitialization.java rename to src/main/java/luckyclient/tool/mail/MailSendInitialization.java index e736d5c..3f45d12 100644 --- a/src/main/java/luckyclient/mail/MailSendInitialization.java +++ b/src/main/java/luckyclient/tool/mail/MailSendInitialization.java @@ -1,11 +1,11 @@ -package luckyclient.mail; +package luckyclient.tool.mail; import java.util.Properties; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; -import luckyclient.publicclass.SysConfig; -import luckyclient.serverapi.entity.TaskScheduling; +import luckyclient.remote.api.serverOperation; +import luckyclient.remote.entity.TaskScheduling; +import luckyclient.utils.LogUtil; +import luckyclient.utils.SysConfig; /** * ================================================================= @@ -48,7 +48,7 @@ public class MailSendInitialization { LogUtil.APP.info("当前任务不需要发送邮件通知!"); return; } - String[] addresses = LogOperation.getEmailAddress(taskid); + String[] addresses = serverOperation.getEmailAddress(taskid); Properties properties = SysConfig.getConfiguration(); if (addresses != null) { LogUtil.APP.info("准备将测试结果发送邮件通知!请稍等..."); diff --git a/src/main/java/luckyclient/mail/MailSenderInfo.java b/src/main/java/luckyclient/tool/mail/MailSenderInfo.java similarity index 94% rename from src/main/java/luckyclient/mail/MailSenderInfo.java rename to src/main/java/luckyclient/tool/mail/MailSenderInfo.java index 91ddf43..7e564d9 100644 --- a/src/main/java/luckyclient/mail/MailSenderInfo.java +++ b/src/main/java/luckyclient/tool/mail/MailSenderInfo.java @@ -1,11 +1,11 @@ -package luckyclient.mail; +package luckyclient.tool.mail; import java.security.GeneralSecurityException; import java.util.Properties; import com.sun.mail.util.MailSSLSocketFactory; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/mail/MyAuthenticator.java b/src/main/java/luckyclient/tool/mail/MyAuthenticator.java similarity index 93% rename from src/main/java/luckyclient/mail/MyAuthenticator.java rename to src/main/java/luckyclient/tool/mail/MyAuthenticator.java index c0b22a8..45733b9 100644 --- a/src/main/java/luckyclient/mail/MyAuthenticator.java +++ b/src/main/java/luckyclient/tool/mail/MyAuthenticator.java @@ -1,4 +1,4 @@ -package luckyclient.mail; +package luckyclient.tool.mail; import javax.mail.*; diff --git a/src/main/java/luckyclient/mail/SimpleMailSender.java b/src/main/java/luckyclient/tool/mail/SimpleMailSender.java similarity index 96% rename from src/main/java/luckyclient/mail/SimpleMailSender.java rename to src/main/java/luckyclient/tool/mail/SimpleMailSender.java index e8b3462..0532ffa 100644 --- a/src/main/java/luckyclient/mail/SimpleMailSender.java +++ b/src/main/java/luckyclient/tool/mail/SimpleMailSender.java @@ -1,4 +1,4 @@ -package luckyclient.mail; +package luckyclient.tool.mail; import java.util.Date; import java.util.Properties; @@ -15,7 +15,7 @@ import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java b/src/main/java/luckyclient/tool/shell/RestartServerInitialization.java similarity index 87% rename from src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java rename to src/main/java/luckyclient/tool/shell/RestartServerInitialization.java index 8160137..17ddfa8 100644 --- a/src/main/java/luckyclient/jenkinsapi/RestartServerInitialization.java +++ b/src/main/java/luckyclient/tool/shell/RestartServerInitialization.java @@ -1,7 +1,7 @@ -package luckyclient.jenkinsapi; +package luckyclient.tool.shell; -import luckyclient.dblog.LogOperation; -import luckyclient.publicclass.LogUtil; +import luckyclient.remote.api.serverOperation; +import luckyclient.utils.LogUtil; /** * ================================================================= @@ -19,7 +19,7 @@ public class RestartServerInitialization { public static String restartServerRun(String tastid){ String result = "Status:true"+" 重启命令执行成功!"; try{ - String[] command = LogOperation.getRestartComm(tastid); + String[] command = serverOperation.getRestartComm(tastid); if(command!=null){ LogUtil.APP.info("准备重启指定的TOMCAT!请稍等。。。参数个数:{}",command.length); if(command.length==5){ diff --git a/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java b/src/main/java/luckyclient/tool/shell/RmtShellExecutor.java similarity index 95% rename from src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java rename to src/main/java/luckyclient/tool/shell/RmtShellExecutor.java index ca7efe6..bbed567 100644 --- a/src/main/java/luckyclient/jenkinsapi/RmtShellExecutor.java +++ b/src/main/java/luckyclient/tool/shell/RmtShellExecutor.java @@ -1,4 +1,4 @@ -package luckyclient.jenkinsapi; +package luckyclient.tool.shell; import java.io.InputStream; import java.io.OutputStream; @@ -6,7 +6,7 @@ import com.jcraft.jsch.Channel; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; -import luckyclient.publicclass.LogUtil; +import luckyclient.utils.LogUtil; /** * 远程执行shell脚本类 diff --git a/src/main/java/luckyclient/publicclass/AppiumConfig.java b/src/main/java/luckyclient/utils/AppiumConfig.java similarity index 92% rename from src/main/java/luckyclient/publicclass/AppiumConfig.java rename to src/main/java/luckyclient/utils/AppiumConfig.java index 5590b2d..cd88c84 100644 --- a/src/main/java/luckyclient/publicclass/AppiumConfig.java +++ b/src/main/java/luckyclient/utils/AppiumConfig.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.io.BufferedInputStream; import java.io.IOException; diff --git a/src/main/java/luckyclient/publicclass/Constants.java b/src/main/java/luckyclient/utils/Constants.java similarity index 93% rename from src/main/java/luckyclient/publicclass/Constants.java rename to src/main/java/luckyclient/utils/Constants.java index 27185df..b3cd1ed 100644 --- a/src/main/java/luckyclient/publicclass/Constants.java +++ b/src/main/java/luckyclient/utils/Constants.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; /** * 通用常量定义 @@ -9,7 +9,7 @@ package luckyclient.publicclass; * @author Seagull * @date 2019年10月22日 */ -public class Constants { +public class Constants { /******************预期结果常量定义************************* * 预期结果赋值符---赋值单条用例作用域变量 */ diff --git a/src/main/java/luckyclient/publicclass/DateUtils.java b/src/main/java/luckyclient/utils/DateUtils.java similarity index 95% rename from src/main/java/luckyclient/publicclass/DateUtils.java rename to src/main/java/luckyclient/utils/DateUtils.java index 1403025..107c50c 100644 --- a/src/main/java/luckyclient/publicclass/DateUtils.java +++ b/src/main/java/luckyclient/utils/DateUtils.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.lang.management.ManagementFactory; import java.text.ParseException; diff --git a/src/main/java/luckyclient/publicclass/DbOperation.java b/src/main/java/luckyclient/utils/DbOperation.java similarity index 95% rename from src/main/java/luckyclient/publicclass/DbOperation.java rename to src/main/java/luckyclient/utils/DbOperation.java index 5d353d7..5fd569b 100644 --- a/src/main/java/luckyclient/publicclass/DbOperation.java +++ b/src/main/java/luckyclient/utils/DbOperation.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.sql.Connection; import java.sql.ResultSet; diff --git a/src/main/java/luckyclient/publicclass/DbToolkit.java b/src/main/java/luckyclient/utils/DbToolkit.java similarity index 96% rename from src/main/java/luckyclient/publicclass/DbToolkit.java rename to src/main/java/luckyclient/utils/DbToolkit.java index 5b303f4..d4964c0 100644 --- a/src/main/java/luckyclient/publicclass/DbToolkit.java +++ b/src/main/java/luckyclient/utils/DbToolkit.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.beans.PropertyVetoException; import java.sql.Connection; diff --git a/src/main/java/luckyclient/publicclass/InvokeMethod.java b/src/main/java/luckyclient/utils/InvokeMethod.java similarity index 96% rename from src/main/java/luckyclient/publicclass/InvokeMethod.java rename to src/main/java/luckyclient/utils/InvokeMethod.java index fb22ac8..8195894 100644 --- a/src/main/java/luckyclient/publicclass/InvokeMethod.java +++ b/src/main/java/luckyclient/utils/InvokeMethod.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.io.ByteArrayOutputStream; import java.io.File; @@ -11,12 +11,12 @@ import java.util.Map; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import luckyclient.caserun.publicdispose.ChangString; -import luckyclient.caserun.publicdispose.ParamsManageForSteps; -import luckyclient.publicclass.remoterinterface.HttpClientHelper; -import luckyclient.serverapi.api.GetServerApi; -import luckyclient.serverapi.entity.ProjectProtocolTemplate; -import luckyclient.serverapi.entity.ProjectTemplateParams; +import luckyclient.execution.dispose.ChangString; +import luckyclient.execution.dispose.ParamsManageForSteps; +import luckyclient.remote.api.GetServerApi; +import luckyclient.remote.entity.ProjectProtocolTemplate; +import luckyclient.remote.entity.ProjectTemplateParams; +import luckyclient.utils.httputils.HttpClientHelper; /** * ================================================================= diff --git a/src/main/java/luckyclient/publicclass/JarClassFind.java b/src/main/java/luckyclient/utils/JarClassFind.java similarity index 96% rename from src/main/java/luckyclient/publicclass/JarClassFind.java rename to src/main/java/luckyclient/utils/JarClassFind.java index 204a61f..6f11868 100644 --- a/src/main/java/luckyclient/publicclass/JarClassFind.java +++ b/src/main/java/luckyclient/utils/JarClassFind.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.io.File; import java.util.Enumeration; diff --git a/src/main/java/luckyclient/publicclass/LogUtil.java b/src/main/java/luckyclient/utils/LogUtil.java similarity index 93% rename from src/main/java/luckyclient/publicclass/LogUtil.java rename to src/main/java/luckyclient/utils/LogUtil.java index ce08dd8..9b9d802 100644 --- a/src/main/java/luckyclient/publicclass/LogUtil.java +++ b/src/main/java/luckyclient/utils/LogUtil.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.lang.reflect.Field; import java.util.List; diff --git a/src/main/java/luckyclient/publicclass/SysConfig.java b/src/main/java/luckyclient/utils/SysConfig.java similarity index 91% rename from src/main/java/luckyclient/publicclass/SysConfig.java rename to src/main/java/luckyclient/utils/SysConfig.java index 5c1023f..046c93d 100644 --- a/src/main/java/luckyclient/publicclass/SysConfig.java +++ b/src/main/java/luckyclient/utils/SysConfig.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass; +package luckyclient.utils; import java.io.BufferedInputStream; import java.io.IOException; diff --git a/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java b/src/main/java/luckyclient/utils/httputils/HttpClientHelper.java similarity index 97% rename from src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java rename to src/main/java/luckyclient/utils/httputils/HttpClientHelper.java index 6d5bf37..df6e5b8 100644 --- a/src/main/java/luckyclient/publicclass/remoterinterface/HttpClientHelper.java +++ b/src/main/java/luckyclient/utils/httputils/HttpClientHelper.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass.remoterinterface; +package luckyclient.utils.httputils; import java.io.BufferedReader; import java.io.File; @@ -58,9 +58,9 @@ import org.apache.http.util.EntityUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import luckyclient.publicclass.Constants; -import luckyclient.publicclass.LogUtil; -import luckyclient.serverapi.entity.ProjectProtocolTemplate; +import luckyclient.remote.entity.ProjectProtocolTemplate; +import luckyclient.utils.Constants; +import luckyclient.utils.LogUtil; /** * ================================================================= diff --git a/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java b/src/main/java/luckyclient/utils/httputils/HttpRequest.java similarity index 95% rename from src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java rename to src/main/java/luckyclient/utils/httputils/HttpRequest.java index eeb99ec..fd43626 100644 --- a/src/main/java/luckyclient/publicclass/remoterinterface/HttpRequest.java +++ b/src/main/java/luckyclient/utils/httputils/HttpRequest.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass.remoterinterface; +package luckyclient.utils.httputils; import java.io.BufferedReader; import java.io.IOException; @@ -20,8 +20,8 @@ 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; +import luckyclient.utils.LogUtil; +import luckyclient.utils.SysConfig; /** * ================================================================= diff --git a/src/main/java/luckyclient/publicclass/remoterinterface/MyX509TrustManager.java b/src/main/java/luckyclient/utils/httputils/MyX509TrustManager.java similarity index 92% rename from src/main/java/luckyclient/publicclass/remoterinterface/MyX509TrustManager.java rename to src/main/java/luckyclient/utils/httputils/MyX509TrustManager.java index 3bcbfa5..6261bdd 100644 --- a/src/main/java/luckyclient/publicclass/remoterinterface/MyX509TrustManager.java +++ b/src/main/java/luckyclient/utils/httputils/MyX509TrustManager.java @@ -1,4 +1,4 @@ -package luckyclient.publicclass.remoterinterface; +package luckyclient.utils.httputils; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; diff --git a/src/main/java/springboot/HttpImpl.java b/src/main/java/springboot/HttpImpl.java index d700b4c..9012f41 100644 --- a/src/main/java/springboot/HttpImpl.java +++ b/src/main/java/springboot/HttpImpl.java @@ -30,9 +30,9 @@ 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 luckyclient.remote.entity.monitor.Server; +import luckyclient.utils.SysConfig; +import luckyclient.utils.httputils.HttpRequest; import springboot.model.RunBatchCaseEntity; import springboot.model.RunTaskEntity; import springboot.model.WebDebugCaseEntity;