|
@@ -0,0 +1,38 @@
|
|
1
|
+package com.xxl.executor.test;
|
|
2
|
+
|
|
3
|
+import com.xxl.job.core.biz.ExecutorBiz;
|
|
4
|
+import com.xxl.job.core.biz.model.ReturnT;
|
|
5
|
+import com.xxl.job.core.biz.model.TriggerParam;
|
|
6
|
+import com.xxl.job.core.enums.ExecutorBlockStrategyEnum;
|
|
7
|
+import com.xxl.job.core.glue.GlueTypeEnum;
|
|
8
|
+import com.xxl.job.core.rpc.netcom.NetComClientProxy;
|
|
9
|
+
|
|
10
|
+/**
|
|
11
|
+ * Created by xuxueli on 17/5/12.
|
|
12
|
+ */
|
|
13
|
+public class DemoJobHandlerTest {
|
|
14
|
+
|
|
15
|
+ public static void main(String[] args) throws Exception {
|
|
16
|
+
|
|
17
|
+ // param
|
|
18
|
+ String jobHandler = "demoJobHandler";
|
|
19
|
+ String params = "";
|
|
20
|
+
|
|
21
|
+ // trigger data
|
|
22
|
+ TriggerParam triggerParam = new TriggerParam();
|
|
23
|
+ triggerParam.setJobId(1);
|
|
24
|
+ triggerParam.setExecutorHandler(jobHandler);
|
|
25
|
+ triggerParam.setExecutorParams(params);
|
|
26
|
+ triggerParam.setExecutorBlockStrategy(ExecutorBlockStrategyEnum.COVER_EARLY.name());
|
|
27
|
+ triggerParam.setGlueType(GlueTypeEnum.BEAN.name());
|
|
28
|
+ triggerParam.setGlueSource(null);
|
|
29
|
+ triggerParam.setGlueUpdatetime(System.currentTimeMillis());
|
|
30
|
+ triggerParam.setLogId(1);
|
|
31
|
+ triggerParam.setLogDateTim(System.currentTimeMillis());
|
|
32
|
+
|
|
33
|
+ // do remote trigger
|
|
34
|
+ ExecutorBiz executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, "127.0.0.1:9999").getObject();
|
|
35
|
+ ReturnT<String> runResult = executorBiz.run(triggerParam);
|
|
36
|
+ }
|
|
37
|
+
|
|
38
|
+}
|