!21 解决客户端不能使用idea调试问题,且不影响后期版本发布的路径问题
Merge pull request !21 from 吾枫/Develop_Branch
This commit is contained in:
commit
c6bd666578
|
@ -15,6 +15,7 @@ import luckyclient.remote.entity.TaskExecute;
|
|||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import luckyclient.utils.config.AppiumConfig;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -32,7 +33,7 @@ public class BatchCaseExecute extends TestControl {
|
|||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator + "log4j.conf");
|
||||
PropertyConfigurator.configure(RunService.APPLICATION_HOME + File.separator + "log4j.conf");
|
||||
String taskid = args[0];
|
||||
String batchcase = args[1];
|
||||
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
|
||||
|
|
|
@ -15,6 +15,7 @@ import luckyclient.remote.entity.TaskExecute;
|
|||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import luckyclient.utils.config.AppiumConfig;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -31,7 +32,7 @@ public class OneCaseExecute extends TestControl {
|
|||
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
PropertyConfigurator.configure(System.getProperty("user.dir")+ File.separator +"log4j.conf");
|
||||
PropertyConfigurator.configure(RunService.APPLICATION_HOME+ File.separator +"log4j.conf");
|
||||
String taskId = args[0];
|
||||
String caseId = args[1];
|
||||
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskId));
|
||||
|
|
|
@ -11,6 +11,7 @@ import luckyclient.remote.api.GetServerApi;
|
|||
import luckyclient.remote.entity.TaskExecute;
|
||||
import luckyclient.remote.entity.TaskScheduling;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -26,7 +27,7 @@ import luckyclient.utils.LogUtil;
|
|||
public class RunAutomationTest extends TestControl {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator + "log4j.conf");
|
||||
PropertyConfigurator.configure(RunService.APPLICATION_HOME + File.separator + "log4j.conf");
|
||||
String taskid = args[0];
|
||||
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
|
||||
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.log4j.PropertyConfigurator;
|
|||
import luckyclient.execution.httpinterface.TestControl;
|
||||
import luckyclient.execution.httpinterface.WebTestCaseDebug;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -23,7 +24,7 @@ public class WebDebugExecute extends TestControl{
|
|||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator + "log4j.conf");
|
||||
PropertyConfigurator.configure(RunService.APPLICATION_HOME + File.separator + "log4j.conf");
|
||||
String caseIdStr = args[0];
|
||||
String userIdStr = args[1];
|
||||
WebTestCaseDebug.oneCaseDebug(caseIdStr, userIdStr);
|
||||
|
|
|
@ -17,6 +17,7 @@ import io.appium.java_client.android.AndroidTouchAction;
|
|||
import io.appium.java_client.touch.WaitOptions;
|
||||
import io.appium.java_client.touch.offset.PointOption;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -35,7 +36,7 @@ public class AndroidBaseAppium {
|
|||
*/
|
||||
public static void screenShot(AndroidDriver<AndroidElement> appium, String imagname) {
|
||||
imagname = imagname + ".png";
|
||||
String relativelyPath = System.getProperty("user.dir");
|
||||
String relativelyPath = RunService.APPLICATION_HOME;
|
||||
String pngpath = relativelyPath + File.separator + "log" + File.separator + "ScreenShot" + File.separator
|
||||
+ imagname;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import io.appium.java_client.ios.IOSTouchAction;
|
|||
import io.appium.java_client.touch.WaitOptions;
|
||||
import io.appium.java_client.touch.offset.PointOption;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -36,7 +37,7 @@ public class IosBaseAppium {
|
|||
*/
|
||||
public static void screenShot(IOSDriver<IOSElement> appium, String imagname){
|
||||
imagname = imagname + ".png";
|
||||
String relativelyPath = System.getProperty("user.dir");
|
||||
String relativelyPath = RunService.APPLICATION_HOME;
|
||||
String pngpath=relativelyPath +File.separator+ "log"+File.separator+"ScreenShot" +File.separator+ imagname;
|
||||
|
||||
try {
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.openqa.selenium.remote.Augmenter;
|
|||
import cn.hutool.core.util.BooleanUtil;
|
||||
import luckyclient.utils.LogUtil;
|
||||
import luckyclient.utils.config.SysConfig;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -35,7 +36,7 @@ public class BaseWebDrive {
|
|||
* @param imgname 图片名称
|
||||
*/
|
||||
public static void webScreenShot(WebDriver driver, String imgname) {
|
||||
String relativelyPath = System.getProperty("user.dir");
|
||||
String relativelyPath = RunService.APPLICATION_HOME;
|
||||
String pngpath=relativelyPath +File.separator+ "log"+File.separator+"ScreenShot" +File.separator+ imgname + ".png";
|
||||
|
||||
// 对远程系统进行截图
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.openqa.selenium.TakesScreenshot;
|
|||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.remote.Augmenter;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -33,15 +34,15 @@ public class Ocr {
|
|||
/**
|
||||
* 默认读取工程根目录下的文件
|
||||
*/
|
||||
private static final String readtextpath = System.getProperty("user.dir")+"\\CAPTCHA.txt";
|
||||
private static final String readtextpath = RunService.APPLICATION_HOME+"\\CAPTCHA.txt";
|
||||
/**
|
||||
* 默认把截图放在工程根目录
|
||||
*/
|
||||
private static final String screenshotpath = System.getProperty("user.dir")+"\\CAPTCHA.png";
|
||||
private static final String screenshotpath = RunService.APPLICATION_HOME+"\\CAPTCHA.png";
|
||||
/**
|
||||
* 批处理文件路径
|
||||
*/
|
||||
private static final String cmdpath = System.getProperty("user.dir");
|
||||
private static final String cmdpath = RunService.APPLICATION_HOME;
|
||||
|
||||
/**
|
||||
* 读取生成的TXT文件中的验证码
|
||||
|
|
|
@ -114,7 +114,7 @@ public class ClientHandler extends ChannelHandlerAdapter {
|
|||
sendMessage(re.toString());
|
||||
} else if ("download".equals(json.get("method"))) {
|
||||
String loadpath = json.get("path").toString();
|
||||
String path = System.getProperty("user.dir") + loadpath;
|
||||
String path = RunService.APPLICATION_HOME + loadpath;
|
||||
String fileName = json.get("fileName").toString();
|
||||
//·¢³öhttpÇëÇóÏÂÔØÎļþ
|
||||
try {
|
||||
|
@ -142,7 +142,7 @@ public class ClientHandler extends ChannelHandlerAdapter {
|
|||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object> jsonparams = (Map<String, Object>) json.get("data");
|
||||
String fileName = jsonparams.get("imgName").toString();
|
||||
String ctxPath = System.getProperty("user.dir") + File.separator + "log" + File.separator + "ScreenShot" + File.separator + fileName;
|
||||
String ctxPath = RunService.APPLICATION_HOME + File.separator + "log" + File.separator + "ScreenShot" + File.separator + fileName;
|
||||
File file = new File(ctxPath);
|
||||
int start = Integer.parseInt(json.get("start").toString());
|
||||
FileUploadFile fileUploadFile = new FileUploadFile();
|
||||
|
|
|
@ -17,6 +17,7 @@ import luckyclient.remote.api.GetServerApi;
|
|||
import luckyclient.remote.entity.ProjectProtocolTemplate;
|
||||
import luckyclient.remote.entity.ProjectTemplateParams;
|
||||
import luckyclient.utils.httputils.HttpClientTools;
|
||||
import springboot.RunService;
|
||||
|
||||
/**
|
||||
* =================================================================
|
||||
|
@ -223,7 +224,7 @@ public class InvokeMethod {
|
|||
result = hct.sendURLPost(packagename, params, headmsg, ppt);
|
||||
break;
|
||||
case "getandsavefile":
|
||||
String fileSavePath = System.getProperty("user.dir") + "\\HTTPSaveFile\\";
|
||||
String fileSavePath = RunService.APPLICATION_HOME + "\\HTTPSaveFile\\";
|
||||
result = hct.sendGetAndSaveFile(packagename, params, fileSavePath, headmsg, ppt);
|
||||
break;
|
||||
case "httpurlget":
|
||||
|
|
|
@ -69,7 +69,7 @@ public class HttpImpl {
|
|||
log.info("TaskId:{},SchedulingName:{},LoadPath:{}",runTaskEntity.getTaskId(),runTaskEntity.getSchedulingName(),runTaskEntity.getLoadPath());
|
||||
try{
|
||||
log.info("开始获取客户端驱动路径...");
|
||||
File file =new File(System.getProperty("user.dir")+runTaskEntity.getLoadPath());
|
||||
File file =new File(RunService.APPLICATION_HOME+runTaskEntity.getLoadPath());
|
||||
log.info("客户端驱动路径:{}",file.getAbsolutePath());
|
||||
if (!file .isDirectory())
|
||||
{
|
||||
|
@ -84,11 +84,11 @@ public class HttpImpl {
|
|||
log.info("启动任务模式测试程序...调度名称:【{}】 任务ID:【{}】",runTaskEntity.getSchedulingName(),runTaskEntity.getTaskId());
|
||||
if(OS.startsWith("win")){
|
||||
log.info("开始调起windows命令行窗口...");
|
||||
run.exec("cmd.exe /k start " + "task.cmd" +" "+ sbf.toString(), null,new File(System.getProperty("user.dir")+File.separator));
|
||||
run.exec("cmd.exe /k start " + "task.cmd" +" "+ sbf.toString(), null,new File(RunService.APPLICATION_HOME+File.separator));
|
||||
log.info("调起windows命令行窗口完成...");
|
||||
}else{
|
||||
log.info("开始调起Linux命令脚本...");
|
||||
Process ps = Runtime.getRuntime().exec(System.getProperty("user.dir")+File.separator+"task.sh"+ " " +sbf.toString());
|
||||
Process ps = Runtime.getRuntime().exec(RunService.APPLICATION_HOME+File.separator+"task.sh"+ " " +sbf.toString());
|
||||
ps.waitFor();
|
||||
log.info("调起Linux命令脚本完成...");
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class HttpImpl {
|
|||
log.info("批量测试用例:{}",batchCase);
|
||||
try{
|
||||
log.info("开始获取客户端驱动路径...");
|
||||
File file =new File(System.getProperty("user.dir")+loadPath);
|
||||
File file =new File(RunService.APPLICATION_HOME+loadPath);
|
||||
log.info("客户端驱动路径:{}",file.getAbsolutePath());
|
||||
if (!file .isDirectory())
|
||||
{
|
||||
|
@ -143,11 +143,11 @@ public class HttpImpl {
|
|||
log.info("启动批量用例模式测试程序...测试项目:{} 任务ID:{}",projectName,taskId);
|
||||
if(OS.startsWith("win")){
|
||||
log.info("开始调起windows命令行窗口...");
|
||||
run.exec("cmd.exe /k start " + "task_batch.cmd" + " " +sb.toString(), null,new File(System.getProperty("user.dir")+File.separator));
|
||||
run.exec("cmd.exe /k start " + "task_batch.cmd" + " " +sb.toString(), null,new File(RunService.APPLICATION_HOME+File.separator));
|
||||
log.info("调起windows命令行窗口完成...");
|
||||
}else{
|
||||
log.info("开始调起Linux命令脚本...");
|
||||
Process ps = Runtime.getRuntime().exec(System.getProperty("user.dir")+File.separator+"task_batch.sh"+ " " +sb.toString());
|
||||
Process ps = Runtime.getRuntime().exec(RunService.APPLICATION_HOME+File.separator+"task_batch.sh"+ " " +sb.toString());
|
||||
ps.waitFor();
|
||||
log.info("调起Linux命令脚本完成...");
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ public class HttpImpl {
|
|||
WebDebugCaseEntity webDebugCaseEntity = JSONObject.parseObject(sbd.toString(), WebDebugCaseEntity.class);
|
||||
log.info("Web端调试用例ID:{} 发起人ID:{}",webDebugCaseEntity.getCaseId(),webDebugCaseEntity.getUserId());
|
||||
try{
|
||||
File file =new File(System.getProperty("user.dir")+webDebugCaseEntity.getLoadpath());
|
||||
File file =new File(RunService.APPLICATION_HOME+webDebugCaseEntity.getLoadpath());
|
||||
if (!file .isDirectory())
|
||||
{
|
||||
log.warn("客户端测试驱动桩路径不存在,请检查【{}】",file.getPath());
|
||||
|
@ -192,9 +192,9 @@ public class HttpImpl {
|
|||
sb.append(webDebugCaseEntity.getUserId()).append(" ");
|
||||
sb.append(webDebugCaseEntity.getLoadpath());
|
||||
if(OS.startsWith("win")){
|
||||
run.exec("cmd.exe /k start " + "web_debugcase.cmd" + " " +sb.toString(), null,new File(System.getProperty("user.dir")+File.separator));
|
||||
run.exec("cmd.exe /k start " + "web_debugcase.cmd" + " " +sb.toString(), null,new File(RunService.APPLICATION_HOME+File.separator));
|
||||
}else{
|
||||
Process ps = Runtime.getRuntime().exec(System.getProperty("user.dir")+File.separator+"web_debugcase.sh"+ " " +sb.toString());
|
||||
Process ps = Runtime.getRuntime().exec(RunService.APPLICATION_HOME+File.separator+"web_debugcase.sh"+ " " +sb.toString());
|
||||
ps.waitFor();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -213,7 +213,7 @@ public class HttpImpl {
|
|||
@GetMapping("/getLogdDetail")
|
||||
private String getLogdDetail(HttpServletRequest req) {
|
||||
String fileName=req.getParameter("filename");
|
||||
String ctxPath = System.getProperty("user.dir")+File.separator+"log";
|
||||
String ctxPath = RunService.APPLICATION_HOME+File.separator+"log";
|
||||
String downLoadPath = ctxPath +File.separator+ fileName;
|
||||
|
||||
String str;
|
||||
|
@ -252,7 +252,7 @@ public class HttpImpl {
|
|||
@GetMapping("/getLogImg")
|
||||
private byte[] getLogImg(HttpServletRequest req) {
|
||||
String imgName=req.getParameter("imgName");
|
||||
String ctxPath = System.getProperty("user.dir")+File.separator+"log"+File.separator+"ScreenShot";
|
||||
String ctxPath = RunService.APPLICATION_HOME+File.separator+"log"+File.separator+"ScreenShot";
|
||||
String downLoadPath = ctxPath+File.separator+imgName;
|
||||
byte[] b = null;
|
||||
try {
|
||||
|
@ -290,7 +290,7 @@ public class HttpImpl {
|
|||
|
||||
String name = jarfile.getOriginalFilename();
|
||||
String loadpath = req.getParameter("loadpath");
|
||||
String path = System.getProperty("user.dir")+loadpath;
|
||||
String path = RunService.APPLICATION_HOME+loadpath;
|
||||
if (!new File(path) .isDirectory())
|
||||
{
|
||||
log.warn("客户端测试驱动桩路径不存在,请检查【{}】",path);
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
import cn.hutool.core.util.BooleanUtil;
|
||||
import luckyclient.netty.NettyClient;
|
||||
import luckyclient.utils.config.SysConfig;
|
||||
import org.springframework.boot.system.ApplicationHome;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
|
||||
/**
|
||||
|
@ -30,12 +31,13 @@ public class RunService {
|
|||
* 如果IDEA工具上运行时出现乱码,请设置VM options,添加-Dfile.encoding=GBK即可
|
||||
* */
|
||||
|
||||
public static final String APPLICATION_HOME = new ApplicationHome(RunService.class).getSource().getAbsolutePath();
|
||||
private static final Logger log = LoggerFactory.getLogger(RunService.class);
|
||||
private static final Boolean NETTY_MODEL= BooleanUtil.toBoolean(SysConfig.getConfiguration().getProperty("netty.model"));
|
||||
public static String CLIENT_IP = "";
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
// TODO Auto-generated method stub
|
||||
PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator +"bootlog4j.conf");
|
||||
PropertyConfigurator.configure(APPLICATION_HOME + File.separator +"bootlog4j.conf");
|
||||
SpringApplication.run(RunService.class, args);
|
||||
try {
|
||||
CLIENT_IP = InetAddress.getLocalHost().getHostAddress();
|
||||
|
|
Loading…
Reference in New Issue