修复客户端同步服务端配置项时出现的Bug

This commit is contained in:
seagull 2021-01-26 20:15:19 +08:00
parent 3de43e87c2
commit d4918b4160
6 changed files with 21 additions and 14 deletions

View File

@ -1,11 +1,17 @@
#===============================系统配置=====================================
client.verison=3.4
client.name=测试客户端
#=====仅支持客户本地文件配置,不支持服务端同步配置项======
server.web.ip=localhost
server.web.port=80
#对应服务端项目的contextPath 默认路径 /
server.web.path=/
#==================客户端配置密钥========================
#=====仅支持客户本地文件配置,不支持服务端同步配置项======
client.verison=3.4
client.name=测试客户端
client.config.privateKey=MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJp2aRx6nTkGZndpYfvZpvyLDzEPhditeZ7JLAGApBjiaEejYytPx8qI1obQ8L8nLT2Kc9zME+p/8g8guUTv26OClzzhsedHbu70gfuQmXKguI9Eag36hBtYlqSZhPAaR0bjPVF73GgqLhbDVZKGS8mykzA5a2TB/C5vnOS9C1JZAgMBAAECgYBNTjYNKtDFWY6u9O81PRl2C6LuyvYSG8Bi2AxONDPswGOwdvWLF8LGevXjQ286PEFIK6MRPpI5Kw/awmX3OpSR10nAzLHo7KU03+1+71EpGcGt0OAudDG+Qzzz10rjyoBwV21d8utoJmy4m5MLbp7yxxZ0caGNfkJMj7QJyxsQAQJBAOtTwyqdGbhLle0rD/9WhK5huFBAaXCw21mJK/wkByVFk9ynHN1P0e3fgS4S2KOyWGEwMgfaxRxvn+Tmj8sQLkkCQQCoCBhihIZj0epYvdQdf63sgrzVlUr3d3IIlKio4JLfvo4gFGpQjV/mOlyS7AGNWf5iDFzJvpXoXET5GYkmpEORAkA784LtAEjlIpx3Z1kT+76hjlOeXkp+Yw/+p2uFOMh5PliFBi3cU9FvgFkwm6yFR5IscFLOnXVJ4UYi0nofiWfBAkBMZvnneci9hIog9ZeIHjEP9FY2a16d7RLNsgKKXyqJT9TB42Z/3/h1751+NI90HTJclLBwDxeMgr/d3+2Lw27xAkBdQqmrWTAmHPGS48CZ/VYu9repRhDmV+8nsWtX1fdU410kcfYgib7WX9Y22v4vGQrVt72waBvvEvbjWjXH+Ael
client.config.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCadmkcep05BmZ3aWH72ab8iw8xD4XYrXmeySwBgKQY4mhHo2MrT8fKiNaG0PC/Jy09inPczBPqf/IPILlE79ujgpc84bHnR27u9IH7kJlyoLiPRGoN+oQbWJakmYTwGkdG4z1Re9xoKi4Ww1WShkvJspMwOWtkwfwub5zkvQtSWQIDAQAB
#===============================netty配置=====================================
#=====仅支持客户本地文件配置,不支持服务端同步配置项======
#netty.model为netty模式开启 例true false 注意netty.host为空时默认使用IP
netty.model=true
netty.server.port=7070
@ -36,7 +42,4 @@ jenkins.username=test
jenkins.password=test1
#==================Web Driver配置========================
#是否高亮显示 true打开 false关闭
webdriver.highlight=false
#==================客户端配置密钥========================
client.config.privateKey=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKZzwv5UN94a4OdMlmRS20n7x5e267LAV9Ue8wFOxUL2BJH33+mrJBqfj8rpcSgp7K+etX2kFq35VeeK3cr+ndBq9z+fO1FHw1kfsE8SQnSw17jfM1pdekC40gle+1bRKlm28zoLYcUMkQ8UFyVEyn72JH5ByJf9zNxWPVAIuzh3AgMBAAECgYBUrXd5Yua4+vuHL5MinnQogwnayJfHa8pDBWeiNqxrkDRq/arPeNz5HktMcs26HPnnrdmufRd8ked9z0tdxYIKfxeZrWuY3+YQkthGkROcWPLc4H1BdlXMTSoDS1hoTokehJ22i+SH2Qr9IYs++xHdEg7s5lPkoi9eVboTpOC0wQJBAM+qft5kp7gH3XV/XtpBeUxwB5rmpPVRIBPHxjHURhFI19+VDwidIq8MbN4tP1ukqegGNj5tWotNpoP9S+dS49kCQQDNMZiSW9HsX51CP7tJ1PVGnmE7QN5pu5TnlEl2WJQup6JamzvMiNYbJ4XzI4tBoL9+n4iAqbDyNIKY9y7ci1zPAkAT/PEhLscF65vhR1U15L9sIAxbWH/gLOLNhJkLCseDumMs3ggIaDeCacvAxtImW/8Omip2b8gbSGoSojrAFTZhAkAsWmoWSM6pf0loxonfPa7+4sE1o6HvzOI05HK0qBTvuMB5QVC9t15AZFyp36b8Opjp7+X7mbJryDnqgpOYjG81AkEAlgZbPEKrFmvBAdhnsOdLywYO+iaKVHsUV/xB65gOJk9TtJNG5GQd9zJkTJ589itK4Avg0x247PELbQjd3Tge2w==
client.config.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmc8L+VDfeGuDnTJZkUttJ+8eXtuuywFfVHvMBTsVC9gSR99/pqyQan4/K6XEoKeyvnrV9pBat+VXnit3K/p3Qavc/nztRR8NZH7BPEkJ0sNe43zNaXXpAuNIJXvtW0SpZtvM6C2HFDJEPFBclRMp+9iR+QciX/czcVj1QCLs4dwIDAQAB
webdriver.highlight=false

View File

@ -3,6 +3,7 @@ package luckyclient.execution;
import java.io.File;
import java.util.Properties;
import luckyclient.netty.ClientHandler;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.execution.appium.androidex.AndroidBatchExecute;
@ -38,6 +39,7 @@ public class BatchCaseExecute extends TestControl {
String batchcase = args[1];
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
if (taskScheduling.getTaskType() == 0) {
BatchTestCaseExecution.batchCaseExecuteForTast(
String.valueOf(task.getTaskId()), batchcase);

View File

@ -3,6 +3,7 @@ package luckyclient.execution;
import java.io.File;
import java.util.Properties;
import luckyclient.netty.ClientHandler;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.execution.appium.androidex.AndroidOneCaseExecute;
@ -37,6 +38,7 @@ public class OneCaseExecute extends TestControl {
String caseId = args[1];
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskId));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskId));
ClientHandler.clientId = taskScheduling.getClientId();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestCaseExecution testCaseExecution=new TestCaseExecution();

View File

@ -2,6 +2,7 @@ package luckyclient.execution;
import java.io.File;
import luckyclient.netty.ClientHandler;
import org.apache.log4j.PropertyConfigurator;
import luckyclient.execution.appium.AppTestControl;
@ -31,6 +32,7 @@ public class RunAutomationTest extends TestControl {
String taskid = args[0];
TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
ClientHandler.clientId = taskScheduling.getClientId();
if (taskScheduling.getTaskType() == 0) {
// ½Ó¿Ú²âÊÔ
TestControl.taskExecutionPlan(task);

View File

@ -30,15 +30,13 @@ public class PropertiesProxy extends Properties {
//获取参数
//通过接口获取服务端配置
try{
if(key.startsWith("server.web")){
LogUtil.APP.info("key is "+key+"£¬skip config from service");
if(key.startsWith("server.web")||key.startsWith("client.")||key.startsWith("netty.")){
//LogUtil.APP.info("key is "+key+"£¬skip config from service");
return wapper.getProperty(key);
}
if(!ClientHandler.clientId.equals(-1)){
LogUtil.APP.info("get config from service");
//String result = HttpRequest.loadJSON("/system/clientConfig/config/"+ ClientHandler.clientId+"/"+key);
String url = "/system/clientConfig/config/"+ ClientHandler.clientId+ "/"+key;
LogUtil.APP.info("getProperty---url-{}", url);
String result = HttpRequest.loadJSON(url);
if(StringUtils.isNotEmpty(result))
{
@ -46,7 +44,8 @@ public class PropertiesProxy extends Properties {
if(res.get("code")!=null&&res.getInteger("code")==200)
{
String value= EncryptionUtils.decrypt(res.get("value").toString());
LogUtil.APP.info("get config from server:"+res.toJSONString()+";value="+value);
LogUtil.APP.info("get config from server succeed:"+res.toJSONString()+";");
//LogUtil.APP.info("get config from server:"+res.toJSONString()+";value="+value);
return value;
}
@ -64,7 +63,7 @@ public class PropertiesProxy extends Properties {
//获取参数
//通过接口获取服务端配置
try{
if(key.startsWith("server.web")){
if(key.startsWith("server.web")||key.startsWith("client.")||key.startsWith("netty.")){
LogUtil.APP.info("key is "+key+"skip config from service");
return wapper.getProperty(key);
}
@ -85,4 +84,5 @@ public class PropertiesProxy extends Properties {
}
return wapper.getProperty(key, defaultValue);
}
}

View File

@ -56,8 +56,6 @@ public class RunService {
}else{
HttpImpl.checkHostNet();
}
Thread.sleep(5000);
SysConfig.getConfiguration().getProperty("appid");
}
}