Skip to content

Commit aa069fa

Browse files
committed
fix test case
1 parent 7b85a12 commit aa069fa

File tree

6 files changed

+58
-58
lines changed

6 files changed

+58
-58
lines changed

disjob-admin/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java

-50
This file was deleted.

disjob-core/src/main/java/cn/ponfee/disjob/core/base/Worker.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
/**
3838
* Worker for execute task(JVM instance)
3939
*
40-
* <p>Also instance of use: @JsonCreator + @JsonProperty("group")
41-
*
4240
* @author Ponfee
4341
* @see com.fasterxml.jackson.annotation.JsonCreator
4442
* @see com.fasterxml.jackson.annotation.JsonProperty
@@ -200,11 +198,21 @@ private Current(String group, String workerId, String host, int port) {
200198
SingletonClassConstraint.constrain(Current.class);
201199
}
202200

201+
/**
202+
* 返回http headers,用于Worker远程调用Supervisor RPC接口的授权信息
203+
*
204+
* @return map of authenticate http headers
205+
*/
203206
public abstract Map<String, String> authenticateHeaders();
204207

208+
/**
209+
* 认证Supervisor远程调用Worker RPC接口的授权信息
210+
*
211+
* @param param authentication param
212+
*/
205213
public abstract void authenticate(AuthenticationParam param);
206214

207-
// need to use reflection do set
215+
// need do reflection call
208216
// use synchronized modify for help multiple thread read reference(write to main memory)
209217
private static synchronized Current create(String group, String workerId, String host, int port,
210218
String workerToken, String supervisorToken0) {

disjob-dispatch/disjob-dispatch-api/src/main/java/cn/ponfee/disjob/dispatch/ExecuteTaskParam.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ private String obtainJobHandler() {
213213
Assert.hasText(job.getJobHandler(), () -> "General job handler cannot be null: " + job.getJobId());
214214
return job.getJobHandler();
215215
}
216-
Assert.hasText(instance.getAttach(), () -> "Workflow node instance attach cannot be null: " + instance.getInstanceId());
216+
217217
InstanceAttach attach = Jsons.fromJson(instance.getAttach(), InstanceAttach.class);
218-
return DAGNode.fromString(attach.getCurNode()).getName();
218+
String curNode = DAGNode.fromString(attach.getCurNode()).getName();
219+
Assert.hasText(curNode, () -> "Workflow instance attach cur node cannot be null: " + instance.getInstanceId());
220+
return curNode;
219221
}
220222
}
221223

disjob-dispatch/disjob-dispatch-api/src/test/java/cn/ponfee/disjob/dispatch/route/ConsistentHashExecutionRouterTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void test() {
8383
String[] array = new String[ThreadLocalRandom.current().nextInt(17) + 3];
8484
array[0] = key;
8585
for (int i = 1; i < array.length; i++) {
86-
array[i] = RandomStringUtils.randomAlphanumeric(ThreadLocalRandom.current().nextInt(5) + 1);
86+
array[i] = RandomStringUtils.randomAlphanumeric(ThreadLocalRandom.current().nextInt(5) + 2);
8787
}
8888
List<String> workers = Arrays.asList(array);
8989
Collections.shuffle(workers);

disjob-id/src/main/java/cn/ponfee/disjob/id/snowflake/zk/ZkDistributedSnowflake.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
*
5252
* <pre>
5353
* /snowflake/{bizTag}
54-
* ├── tag
54+
* ├── tag (children are EPHEMERAL node)
5555
* │ ├── serverTag-a data=workerId-1
5656
* │ ├── serverTag-b data=workerId-2
5757
* │ └── serverTag-c data=workerId-3
58-
* └── id
58+
* └── id (children are EPHEMERAL node)
5959
* ├── workerId-1 data=lastHeartbeatTime
6060
* ├── workerId-2 data=lastHeartbeatTime
6161
* └── workerId-3 data=lastHeartbeatTime
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
///* __________ _____ *\
2+
//** \______ \____ _____/ ____\____ ____ Copyright (c) 2017-2023 Ponfee **
3+
//** | ___/ _ \ / \ __\/ __ \_/ __ \ http://www.ponfee.cn **
4+
//** | | ( <_> ) | \ | \ ___/\ ___/ Apache License Version 2.0 **
5+
//** |____| \____/|___| /__| \___ >\___ > http://www.apache.org/licenses/ **
6+
//** \/ \/ \/ **
7+
//\* */
8+
//
9+
//package cn.ponfee.disjob.supervisor.config;
10+
//
11+
//import cn.ponfee.disjob.core.param.worker.AuthenticationParam;
12+
//import org.apache.commons.lang3.ArrayUtils;
13+
//import org.aspectj.lang.JoinPoint;
14+
//import org.aspectj.lang.annotation.Aspect;
15+
//import org.aspectj.lang.annotation.Before;
16+
//import org.springframework.stereotype.Component;
17+
//
18+
///**
19+
// * Aspect test
20+
// *
21+
// * @author Ponfee
22+
// */
23+
//@Aspect
24+
//@Component
25+
//public class AuthenticationCallWorker {
26+
//
27+
// @Before("execution(* cn.ponfee.disjob..*.*(..,cn.ponfee.disjob.core.param.worker.AuthenticationParam+,..))")
28+
// public void doBefore(JoinPoint point) {
29+
// Object[] args = point.getArgs();
30+
// if (ArrayUtils.isEmpty(args)) {
31+
// return;
32+
// }
33+
// for (Object arg : args) {
34+
// if (arg instanceof AuthenticationParam) {
35+
// ((AuthenticationParam) arg).setSupervisorToken("xxxxx");
36+
// }
37+
// }
38+
// }
39+
//
40+
//}

0 commit comments

Comments
 (0)