修改测试程序支持maat回调类配置下发到redis中
This commit is contained in:
@@ -84,11 +84,13 @@ public class MaatTestController {
|
||||
FileUtils.addStrToFile(sdf.format(new Date()) + "\t" + "开始删除业务类型" + serviceType + "下的maat配置" + configId + "\n",
|
||||
Configurations.getStringProperty("maatTestLogPath", ""), true);
|
||||
|
||||
// Map<Integer, Map<Integer, List<Long>>> restMap = new HashMap<Integer, Map<Integer, List<Long>>>();
|
||||
// Map<Integer, Map<Integer, List<Long>>> restMap = new HashMap<Integer,
|
||||
// Map<Integer, List<Long>>>();
|
||||
// Iterator<Integer> serviceIterator = compileMap.keySet().iterator();
|
||||
// while (serviceIterator.hasNext()) {
|
||||
// Integer service = Integer.valueOf(serviceIterator.next().toString());
|
||||
// List<Integer> dbIndexList = ServiceAndRDBIndexReal.getRedisDBByService(service);
|
||||
// List<Integer> dbIndexList =
|
||||
// ServiceAndRDBIndexReal.getRedisDBByService(service);
|
||||
// if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) {
|
||||
// for (Integer dbIndex : dbIndexList) {
|
||||
// if (restMap.containsKey(dbIndex)) {
|
||||
@@ -100,7 +102,8 @@ public class MaatTestController {
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// FileUtils.addStrToFile(sdf.format(new Date()) + "\t" + "error:获取业务类型" + service + "对应的redisDb失败\n",
|
||||
// FileUtils.addStrToFile(sdf.format(new Date()) + "\t" + "error:获取业务类型" +
|
||||
// service + "对应的redisDb失败\n",
|
||||
// Configurations.getStringProperty("maatTestLogPath", ""), true);
|
||||
// return "error";
|
||||
// }
|
||||
@@ -522,6 +525,7 @@ public class MaatTestController {
|
||||
|
||||
/**
|
||||
* 组装json串,然后下发配置,在验证配置是否正确,然后删除配置
|
||||
*
|
||||
* @param service
|
||||
* @param saveCount
|
||||
* @param map
|
||||
@@ -536,20 +540,25 @@ public class MaatTestController {
|
||||
jsonString.append("[");
|
||||
for (int i = 0; i < saveCount; i++) {
|
||||
jsonString.append("{");
|
||||
List<String> srcList = new ArrayList<String>();
|
||||
for (CommonSourceFieldCfg commonSourceFieldCfg : commonSourceFieldCfgList) {
|
||||
String fieldType = commonSourceFieldCfg.getFieldType();
|
||||
String srcName = commonSourceFieldCfg.getSrcName();
|
||||
String dstName = commonSourceFieldCfg.getDstName();
|
||||
if (!srcList.contains(srcName)) {
|
||||
jsonString.append("\"");
|
||||
jsonString.append(srcName);
|
||||
jsonString.append("\":");
|
||||
if (fieldType.equals("String")) {
|
||||
if (srcName.toLowerCase().equals("service")) {
|
||||
jsonString.append("\"" + service + "\"");
|
||||
} else if (srcName.toLowerCase().equals("dstfile")) {
|
||||
jsonString.append(
|
||||
"\"http://10.0.6.249/group1/M00/00/02/CgAG-VtziqWAIzafAAITEbfJ8Zw992.jpg\"");
|
||||
// } else if (dstName.toLowerCase().contains("redisfile")) {
|
||||
// jsonString.append(
|
||||
// "\"http://192.168.10.205:9000/maat-redis/201810284141049-212b64ca-5b5d-4b13-873e-c57868b4b46b.jpg\"");
|
||||
} else {
|
||||
jsonString.append("\"" + UUID.randomUUID() + "\"");
|
||||
// jsonString.append("\"" + UUID.randomUUID() + "\"");
|
||||
jsonString.append(
|
||||
"\"http://192.168.10.205:9000/maat-redis/201810284141049-212b64ca-5b5d-4b13-873e-c57868b4b46b.jpg\"");
|
||||
}
|
||||
} else if (fieldType.equals("Number")) {
|
||||
if (srcName.toLowerCase().equals("addrtype")) {
|
||||
@@ -564,7 +573,9 @@ public class MaatTestController {
|
||||
jsonString.append("1");
|
||||
} else if (srcName.toLowerCase().equals("isvalid")) {
|
||||
jsonString.append("1");
|
||||
} else if (srcName.toLowerCase().equals("cfgid")||srcName.toLowerCase().equals("keyringid")||srcName.toLowerCase().equals("fileid")) {
|
||||
} else if (srcName.toLowerCase().equals("cfgid")
|
||||
|| srcName.toLowerCase().equals("keyringid")
|
||||
|| srcName.toLowerCase().equals("fileid")) {
|
||||
Long incrId = configRedisService.getIncrId("seq_compileid");
|
||||
compileIdList.add(incrId);
|
||||
jsonString.append(incrId);
|
||||
@@ -588,10 +599,13 @@ public class MaatTestController {
|
||||
}
|
||||
jsonString.append(",");
|
||||
}
|
||||
srcList.add(srcName);
|
||||
}
|
||||
String str = jsonString.substring(0, jsonString.lastIndexOf(","));
|
||||
jsonString.setLength(0);
|
||||
jsonString.append(str);
|
||||
jsonString.append("},");
|
||||
|
||||
}
|
||||
String jsonStr = jsonString.substring(0, jsonString.lastIndexOf(","));
|
||||
jsonStr += "]";
|
||||
|
||||
@@ -386,7 +386,7 @@ public class MaatTestServiceimpl {
|
||||
maatTableName.substring(maatTableName.lastIndexOf("_") + 1));
|
||||
dstStr = dstPath.replace("{fileName}", dstStr.substring(dstStr.lastIndexOf("/") + 1));
|
||||
} else if ("file_id".equals(commonSourceFieldCfg.getDstName())) {
|
||||
dstStr = dstStr.substring(dstStr.indexOf("group"));
|
||||
// dstStr = dstStr.substring(dstStr.indexOf("group"));
|
||||
}
|
||||
}
|
||||
switch (commonSourceFieldCfg.getFieldType()) {
|
||||
@@ -562,7 +562,7 @@ public class MaatTestServiceimpl {
|
||||
if (!isNum(attrName)) {
|
||||
String beanVal = map.get(attrName);
|
||||
String redisVal = valArr[i];
|
||||
if (beanVal == null || redisVal == null || !beanVal.trim().equals(redisVal.trim())) {
|
||||
if (!attrName.contains("redisFile")&&(beanVal == null || redisVal == null || !beanVal.trim().equals(redisVal.trim()))) {
|
||||
FileUtils.addStrToFile(
|
||||
"\t" + sdf.format(new Date()) + " error:" + redisDb + "号redis库中key=" + key + "的值第" + i
|
||||
+ "位" + attrName + "的值:" + redisVal + "与实际传的值不一样,实际值是:{}\n",
|
||||
|
||||
Reference in New Issue
Block a user