fix 项目副本中弃用兼容字段 parendId

This commit is contained in:
Hong 2023-12-19 15:01:14 +08:00
parent 7b2f36e6ef
commit 50be9b1ae3
12 changed files with 91 additions and 161 deletions

View File

@ -1,5 +1,13 @@
# 🚀 版本日志
### 2.10.47.2-beta
### 🐞 解决BUG、优化功能
1. 【agent】删除 项目副本中弃用兼容字段 `parendId`
------
### 2.10.47.1-beta (2023-12-19)
### 🐣 新增功能

View File

@ -372,13 +372,9 @@ public class NodeProjectInfoModel extends BaseWorkspaceModel {
return build.runProcess(opt);
}
@EqualsAndHashCode(callSuper = true)
@Data
public static class JavaCopyItem extends BaseJsonModel {
/**
* 父级项目id
*/
@Deprecated
private String parendId;
/**
* 名称
*/
@ -427,39 +423,5 @@ public class NodeProjectInfoModel extends BaseWorkspaceModel {
}
return StrUtil.format("{}:{}", id, copyId);
}
@Deprecated
public String getParendId() {
return parendId;
}
@Deprecated
public void setParendId(String parentId) {
this.parendId = parentId;
this.parentId = parentId;
}
public String getParentId() {
return StrUtil.emptyToDefault(this.parentId, this.parendId);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JavaCopyItem that = (JavaCopyItem) o;
return Objects.equals(parendId, that.parendId) &&
Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hash(parendId, id, jvm, args, modifyTime);
}
}
}

View File

@ -120,12 +120,7 @@ public class TestBigFileRead {
@Test
public void testTail() throws IOException {
FileUtil.tail(testFile, CharsetUtil.CHARSET_UTF_8, new LineHandler() {
@Override
public void handle(String line) {
System.out.println(line);
}
});
FileUtil.tail(testFile, CharsetUtil.CHARSET_UTF_8, System.out::println);
}
@Test

View File

@ -84,12 +84,7 @@ public class TestJps {
// System.out.println(ReUtil.get(regex, execSystemCommand, 0));
// System.out.println("----");
final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
ReUtil.get(pattern, execSystemCommand, new Consumer<Matcher>() {
@Override
public void accept(Matcher matcher) {
System.out.println(matcher.group());
}
});
ReUtil.get(pattern, execSystemCommand, matcher -> System.out.println(matcher.group()));
// System.out.println(allGroups);
Map<String, String> allGroupNames = ReUtil.getAllGroupNames(pattern, execSystemCommand);
for (Map.Entry<String, String> stringStringEntry : allGroupNames.entrySet()) {

View File

@ -432,9 +432,7 @@ public class BuildInfoController extends BaseServerController {
private void checkProjectSecondaryDirectory(JSONObject jsonObject) {
//
String projectSecondaryDirectory = jsonObject.getString("projectSecondaryDirectory");
Opt.ofBlankAble(projectSecondaryDirectory).ifPresent(s -> {
FileUtils.checkSlip(s, e -> new IllegalArgumentException("二级目录不能越级:" + e.getMessage()));
});
Opt.ofBlankAble(projectSecondaryDirectory).ifPresent(s -> FileUtils.checkSlip(s, e -> new IllegalArgumentException("二级目录不能越级:" + e.getMessage())));
}
/**

View File

@ -40,9 +40,7 @@ public class TestCron {
String CRON_ID = "test";
CronUtil.remove(CRON_ID);
CronUtil.setMatchSecond(true);
CronUtil.schedule(CRON_ID, "0/5 * * * * ?", () -> {
System.out.println("123");
});
CronUtil.schedule(CRON_ID, "0/5 * * * * ?", () -> System.out.println("123"));
CronUtil.restart();
// System.out.println(JpomApplicationEvent.getPid());
}

View File

@ -40,13 +40,10 @@ public class TestIp {
System.out.println(NetUtil.getLocalhostStr());
// System.out.println(NetUtil.getLocalhost().getHostAddress());
System.out.println("------");
final LinkedHashSet<InetAddress> localAddressList = NetUtil.localAddressList(new Filter<NetworkInterface>() {
@Override
public boolean accept(NetworkInterface networkInterface) {
System.out.println(networkInterface.isVirtual());
System.out.println(networkInterface.getIndex());
return true;
}
final LinkedHashSet<InetAddress> localAddressList = NetUtil.localAddressList(networkInterface -> {
System.out.println(networkInterface.isVirtual());
System.out.println(networkInterface.getIndex());
return true;
}, address -> {
// 非loopback地址指127.*.*.*的地址
return !address.isLoopbackAddress()

View File

@ -41,9 +41,9 @@ public class TestJarLoader {
ZipEntry zipEntry = jarFile1.getEntry("BOOT-INF/classes/cn/keepbx/jpom/common/interceptor/NotAuthorize.class");
System.out.println(zipEntry);
String path = "D:\\Idea\\Jpom\\modules\\agent\\target\\agent-2.4.2.jar";//外部jar包的路径
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();//所有的Class对象
Map<Class<?>, Annotation[]> classAnnotationMap = new HashMap<Class<?>, Annotation[]>();//每个Class对象上的注释对象
Map<Class<?>, Map<Method, Annotation[]>> classMethodAnnoMap = new HashMap<Class<?>, Map<Method, Annotation[]>>();//每个Class对象中每个方法上的注释对象
Set<Class<?>> classes = new LinkedHashSet<>();//所有的Class对象
Map<Class<?>, Annotation[]> classAnnotationMap = new HashMap<>();//每个Class对象上的注释对象
Map<Class<?>, Map<Method, Annotation[]>> classMethodAnnoMap = new HashMap<>();//每个Class对象中每个方法上的注释对象
try {
JarFile jarFile = new JarFile(new File(path));
URL url = new URL("file:" + path);
@ -63,7 +63,7 @@ public class TestJarLoader {
Annotation[] classAnnos = c.getDeclaredAnnotations();
classAnnotationMap.put(c, classAnnos);
Method[] classMethods = c.getDeclaredMethods();
Map<Method, Annotation[]> methodAnnoMap = new HashMap<Method, Annotation[]>();
Map<Method, Annotation[]> methodAnnoMap = new HashMap<>();
for (Method classMethod : classMethods) {
Annotation[] a = classMethod.getDeclaredAnnotations();
methodAnnoMap.put(classMethod, a);

View File

@ -44,80 +44,71 @@ public class TestRun {
Process p = processBuilder.start();
OutputStream outputStream = p.getOutputStream();
InputStream inputStream = p.getInputStream();
ThreadUtil.execute(new Runnable() {
@Override
public void run() {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, CharsetUtil.CHARSET_GBK);
//用于存储执行命令的结果
BufferedReader results = new BufferedReader(inputStreamReader);
IoUtil.readLines(results, new LineHandler() {
@Override
public void handle(String line) {
ThreadUtil.execute(() -> {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, CharsetUtil.CHARSET_GBK);
//用于存储执行命令的结果
BufferedReader results = new BufferedReader(inputStreamReader);
IoUtil.readLines(results, (LineHandler) line -> {
// String result = CharsetUtil.convert(line, CharsetUtil.CHARSET_ISO_8859_1, CharsetUtil.CHARSET_GBK);
System.out.println(line);
count[0]++;
if (count[0] == 10) {
processBuilder.inheritIO();
try {
outputStream.write(2);
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
results.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStreamReader.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("3*****");
try {
p.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
p.getErrorStream().close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(123456);
p.destroy();
}
}
});
System.out.println("123");
//用于存储执行命令的错误信息
BufferedReader errors = new BufferedReader(new InputStreamReader(p.getErrorStream(), ExtConfigBean.getConsoleLogCharset()));
IoUtil.readLines(errors, new LineHandler() {
@Override
public void handle(String line) {
System.out.println(line);
count[0]++;
if (count[0] == 10) {
processBuilder.inheritIO();
try {
outputStream.write(2);
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
results.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStreamReader.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("3*****");
try {
p.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
p.getErrorStream().close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(123456);
p.destroy();
}
});
System.out.println("123");
//用于存储执行命令的错误信息
BufferedReader errors = new BufferedReader(new InputStreamReader(p.getErrorStream(), ExtConfigBean.getConsoleLogCharset()));
IoUtil.readLines(errors, (LineHandler) line -> {
String result = CharsetUtil.convert(line, null, ExtConfigBean.getConsoleLogCharset());
System.out.println("error:" + result);
}
});
try {
p.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
String result = CharsetUtil.convert(line, null, ExtConfigBean.getConsoleLogCharset());
System.out.println("error:" + result);
});
try {
p.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
System.out.println("end");
} catch (Exception e) {

View File

@ -51,9 +51,7 @@ public class TestSSh {
channel.setPty(true);
channel.connect();
InputStream in = channel.getInputStream();
ThreadUtil.execute(() -> {
IoUtil.readLines(in, CharsetUtil.CHARSET_UTF_8, (LineHandler) System.out::println);
});
ThreadUtil.execute(() -> IoUtil.readLines(in, CharsetUtil.CHARSET_UTF_8, (LineHandler) System.out::println));
ThreadUtil.execute(() -> {
try {
IoUtil.readLines(channel.getExtInputStream(), CharsetUtil.CHARSET_UTF_8, (LineHandler) System.out::println);
@ -108,12 +106,7 @@ public class TestSSh {
// });
InputStream inputStream = channel.getInputStream();
channel.connect();
IoUtil.readLines(inputStream, CharsetUtil.CHARSET_UTF_8, new LineHandler() {
@Override
public void handle(String line) {
System.out.println(line);
}
});
IoUtil.readLines(inputStream, CharsetUtil.CHARSET_UTF_8, (LineHandler) System.out::println);
int exitStatus = channel.getExitStatus();
System.out.println(exitStatus);
channel.disconnect();

View File

@ -41,12 +41,8 @@ public class TestSynchronized {
User u1 = new User(50);
User u2 = new User(50);
log.info("第 - {} - 次", i);
Thread thread = new Thread(() -> {
u1.hit(u2);
}, "A");
Thread thread1 = new Thread(() -> {
u2.hit(u1);
}, "B");
Thread thread = new Thread(() -> u1.hit(u2), "A");
Thread thread1 = new Thread(() -> u2.hit(u1), "B");
thread1.start();
thread.start();

View File

@ -58,12 +58,9 @@ public class TestThread implements Callable<String> {
for (int i = 0; i < 5; i++) {
int finalI = i;
executorService.submit(new Callable<Object>() {
@Override
public Object call() throws Exception {
System.out.println(finalI);
return finalI;
}
executorService.submit((Callable<Object>) () -> {
System.out.println(finalI);
return finalI;
});
}