mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: shade powerjob-client
This commit is contained in:
parent
ce745ce9d2
commit
c7812708c3
@ -14,16 +14,33 @@
|
|||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<powerjob.common.version>3.3.0</powerjob.common.version>
|
|
||||||
<junit.version>5.6.1</junit.version>
|
<junit.version>5.6.1</junit.version>
|
||||||
|
<fastjson.version>1.2.68</fastjson.version>
|
||||||
|
<powerjob.common.version>3.3.0</powerjob.common.version>
|
||||||
|
|
||||||
|
<mvn.shade.plugin.version>3.2.4</mvn.shade.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- fastJson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>${fastjson.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- oms-common -->
|
<!-- oms-common -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.kfcfans</groupId>
|
<groupId>com.github.kfcfans</groupId>
|
||||||
<artifactId>powerjob-common</artifactId>
|
<artifactId>powerjob-common</artifactId>
|
||||||
<version>${powerjob.common.version}</version>
|
<version>${powerjob.common.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.typesafe.akka</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Junit 测试 -->
|
<!-- Junit 测试 -->
|
||||||
@ -35,4 +52,47 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>${mvn.shade.plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>okhttp3</pattern>
|
||||||
|
<shadedPattern>shade.powerjob.okhttp3</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>okio</pattern>
|
||||||
|
<shadedPattern>shade.powerjob.okio</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.google</pattern>
|
||||||
|
<shadedPattern>shade.powerjob.com.google</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.apache</pattern>
|
||||||
|
<shadedPattern>shade.powerjob.org.apache</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>com.alibaba</pattern>
|
||||||
|
<shadedPattern>shade.powerjob.com.alibaba</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -1,5 +1,6 @@
|
|||||||
package com.github.kfcfans.powerjob.client;
|
package com.github.kfcfans.powerjob.client;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.kfcfans.powerjob.common.InstanceStatus;
|
import com.github.kfcfans.powerjob.common.InstanceStatus;
|
||||||
import com.github.kfcfans.powerjob.common.PowerJobException;
|
import com.github.kfcfans.powerjob.common.PowerJobException;
|
||||||
import com.github.kfcfans.powerjob.common.OpenAPIConstant;
|
import com.github.kfcfans.powerjob.common.OpenAPIConstant;
|
||||||
@ -8,7 +9,6 @@ import com.github.kfcfans.powerjob.common.request.http.SaveWorkflowRequest;
|
|||||||
import com.github.kfcfans.powerjob.common.response.*;
|
import com.github.kfcfans.powerjob.common.response.*;
|
||||||
import com.github.kfcfans.powerjob.common.utils.CommonUtils;
|
import com.github.kfcfans.powerjob.common.utils.CommonUtils;
|
||||||
import com.github.kfcfans.powerjob.common.utils.HttpUtils;
|
import com.github.kfcfans.powerjob.common.utils.HttpUtils;
|
||||||
import com.github.kfcfans.powerjob.common.utils.JsonUtils;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import okhttp3.FormBody;
|
import okhttp3.FormBody;
|
||||||
@ -62,7 +62,7 @@ public class OhMyClient {
|
|||||||
try {
|
try {
|
||||||
String result = assertApp(appName, password, url);
|
String result = assertApp(appName, password, url);
|
||||||
if (StringUtils.isNotEmpty(result)) {
|
if (StringUtils.isNotEmpty(result)) {
|
||||||
ResultDTO resultDTO = JsonUtils.parseObject(result, ResultDTO.class);
|
ResultDTO resultDTO = JSONObject.parseObject(result, ResultDTO.class);
|
||||||
if (resultDTO.isSuccess()) {
|
if (resultDTO.isSuccess()) {
|
||||||
appId = Long.parseLong(resultDTO.getData().toString());
|
appId = Long.parseLong(resultDTO.getData().toString());
|
||||||
currentAddress = addr;
|
currentAddress = addr;
|
||||||
@ -107,9 +107,9 @@ public class OhMyClient {
|
|||||||
|
|
||||||
request.setAppId(appId);
|
request.setAppId(appId);
|
||||||
MediaType jsonType = MediaType.parse("application/json; charset=utf-8");
|
MediaType jsonType = MediaType.parse("application/json; charset=utf-8");
|
||||||
String json = JsonUtils.toJSONStringUnsafe(request);
|
String json = JSONObject.toJSONString(request);
|
||||||
String post = postHA(OpenAPIConstant.SAVE_JOB, RequestBody.create(jsonType, json));
|
String post = postHA(OpenAPIConstant.SAVE_JOB, RequestBody.create(jsonType, json));
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,7 +124,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.FETCH_JOB, body);
|
String post = postHA(OpenAPIConstant.FETCH_JOB, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +139,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.DISABLE_JOB, body);
|
String post = postHA(OpenAPIConstant.DISABLE_JOB, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,7 +154,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.ENABLE_JOB, body);
|
String post = postHA(OpenAPIConstant.ENABLE_JOB, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +169,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.DELETE_JOB, body);
|
String post = postHA(OpenAPIConstant.DELETE_JOB, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +190,7 @@ public class OhMyClient {
|
|||||||
builder.add("instanceParams", instanceParams);
|
builder.add("instanceParams", instanceParams);
|
||||||
}
|
}
|
||||||
String post = postHA(OpenAPIConstant.RUN_JOB, builder.build());
|
String post = postHA(OpenAPIConstant.RUN_JOB, builder.build());
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
public ResultDTO<Long> runJob(Long jobId) throws Exception {
|
public ResultDTO<Long> runJob(Long jobId) throws Exception {
|
||||||
return runJob(jobId, null, 0);
|
return runJob(jobId, null, 0);
|
||||||
@ -209,7 +209,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.STOP_INSTANCE, body);
|
String post = postHA(OpenAPIConstant.STOP_INSTANCE, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,7 +225,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.CANCEL_INSTANCE, body);
|
String post = postHA(OpenAPIConstant.CANCEL_INSTANCE, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,7 +241,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.RETRY_INSTANCE, body);
|
String post = postHA(OpenAPIConstant.RETRY_INSTANCE, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +255,7 @@ public class OhMyClient {
|
|||||||
.add("instanceId", instanceId.toString())
|
.add("instanceId", instanceId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.FETCH_INSTANCE_STATUS, body);
|
String post = postHA(OpenAPIConstant.FETCH_INSTANCE_STATUS, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -269,7 +269,7 @@ public class OhMyClient {
|
|||||||
.add("instanceId", instanceId.toString())
|
.add("instanceId", instanceId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.FETCH_INSTANCE_INFO, body);
|
String post = postHA(OpenAPIConstant.FETCH_INSTANCE_INFO, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************* Workflow 区 ************* */
|
/* ************* Workflow 区 ************* */
|
||||||
@ -282,9 +282,9 @@ public class OhMyClient {
|
|||||||
public ResultDTO<Long> saveWorkflow(SaveWorkflowRequest request) throws Exception {
|
public ResultDTO<Long> saveWorkflow(SaveWorkflowRequest request) throws Exception {
|
||||||
request.setAppId(appId);
|
request.setAppId(appId);
|
||||||
MediaType jsonType = MediaType.parse("application/json; charset=utf-8");
|
MediaType jsonType = MediaType.parse("application/json; charset=utf-8");
|
||||||
String json = JsonUtils.toJSONStringUnsafe(request);
|
String json = JSONObject.toJSONString(request);
|
||||||
String post = postHA(OpenAPIConstant.SAVE_WORKFLOW, RequestBody.create(jsonType, json));
|
String post = postHA(OpenAPIConstant.SAVE_WORKFLOW, RequestBody.create(jsonType, json));
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -299,7 +299,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.FETCH_WORKFLOW, body);
|
String post = postHA(OpenAPIConstant.FETCH_WORKFLOW, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -314,7 +314,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.DISABLE_WORKFLOW, body);
|
String post = postHA(OpenAPIConstant.DISABLE_WORKFLOW, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -329,7 +329,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.ENABLE_WORKFLOW, body);
|
String post = postHA(OpenAPIConstant.ENABLE_WORKFLOW, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,7 +344,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.DELETE_WORKFLOW, body);
|
String post = postHA(OpenAPIConstant.DELETE_WORKFLOW, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -364,7 +364,7 @@ public class OhMyClient {
|
|||||||
builder.add("initParams", initParams);
|
builder.add("initParams", initParams);
|
||||||
}
|
}
|
||||||
String post = postHA(OpenAPIConstant.RUN_WORKFLOW, builder.build());
|
String post = postHA(OpenAPIConstant.RUN_WORKFLOW, builder.build());
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
public ResultDTO<Long> runWorkflow(Long workflowId) throws Exception {
|
public ResultDTO<Long> runWorkflow(Long workflowId) throws Exception {
|
||||||
return runWorkflow(workflowId, null, 0);
|
return runWorkflow(workflowId, null, 0);
|
||||||
@ -383,7 +383,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.STOP_WORKFLOW_INSTANCE, body);
|
String post = postHA(OpenAPIConstant.STOP_WORKFLOW_INSTANCE, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,7 +398,7 @@ public class OhMyClient {
|
|||||||
.add("appId", appId.toString())
|
.add("appId", appId.toString())
|
||||||
.build();
|
.build();
|
||||||
String post = postHA(OpenAPIConstant.FETCH_WORKFLOW_INSTANCE_INFO, body);
|
String post = postHA(OpenAPIConstant.FETCH_WORKFLOW_INSTANCE_INFO, body);
|
||||||
return JsonUtils.parseObject(post, ResultDTO.class);
|
return JSONObject.parseObject(post, ResultDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.kfcfans.powerjob.common.ExecuteType;
|
import com.github.kfcfans.powerjob.common.ExecuteType;
|
||||||
import com.github.kfcfans.powerjob.common.ProcessorType;
|
import com.github.kfcfans.powerjob.common.ProcessorType;
|
||||||
import com.github.kfcfans.powerjob.common.TimeExpressionType;
|
import com.github.kfcfans.powerjob.common.TimeExpressionType;
|
||||||
@ -5,7 +6,6 @@ import com.github.kfcfans.powerjob.common.request.http.SaveJobInfoRequest;
|
|||||||
import com.github.kfcfans.powerjob.common.response.JobInfoDTO;
|
import com.github.kfcfans.powerjob.common.response.JobInfoDTO;
|
||||||
import com.github.kfcfans.powerjob.common.response.ResultDTO;
|
import com.github.kfcfans.powerjob.common.response.ResultDTO;
|
||||||
import com.github.kfcfans.powerjob.client.OhMyClient;
|
import com.github.kfcfans.powerjob.client.OhMyClient;
|
||||||
import com.github.kfcfans.powerjob.common.utils.JsonUtils;
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -46,13 +46,13 @@ public class TestClient {
|
|||||||
newJobInfo.setMinDiskSpace(1.3);
|
newJobInfo.setMinDiskSpace(1.3);
|
||||||
|
|
||||||
ResultDTO<Long> resultDTO = ohMyClient.saveJob(newJobInfo);
|
ResultDTO<Long> resultDTO = ohMyClient.saveJob(newJobInfo);
|
||||||
System.out.println(JsonUtils.toJSONString(resultDTO));
|
System.out.println(JSONObject.toJSONString(resultDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFetchJob() throws Exception {
|
public void testFetchJob() throws Exception {
|
||||||
ResultDTO<JobInfoDTO> fetchJob = ohMyClient.fetchJob(1L);
|
ResultDTO<JobInfoDTO> fetchJob = ohMyClient.fetchJob(1L);
|
||||||
System.out.println(JsonUtils.toJSONStringUnsafe(fetchJob));
|
System.out.println(JSONObject.toJSONString(fetchJob));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -93,21 +93,21 @@ public class TestClient {
|
|||||||
@Test
|
@Test
|
||||||
public void testCancelInstanceInTimeWheel() throws Exception {
|
public void testCancelInstanceInTimeWheel() throws Exception {
|
||||||
ResultDTO<Long> startRes = ohMyClient.runJob(15L, "start by OhMyClient", 20000);
|
ResultDTO<Long> startRes = ohMyClient.runJob(15L, "start by OhMyClient", 20000);
|
||||||
System.out.println("runJob result: " + JsonUtils.toJSONString(startRes));
|
System.out.println("runJob result: " + JSONObject.toJSONString(startRes));
|
||||||
ResultDTO<Void> cancelRes = ohMyClient.cancelInstance(startRes.getData());
|
ResultDTO<Void> cancelRes = ohMyClient.cancelInstance(startRes.getData());
|
||||||
System.out.println("cancelJob result: " + JsonUtils.toJSONString(cancelRes));
|
System.out.println("cancelJob result: " + JSONObject.toJSONString(cancelRes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCancelInstanceInDatabase() throws Exception {
|
public void testCancelInstanceInDatabase() throws Exception {
|
||||||
ResultDTO<Long> startRes = ohMyClient.runJob(15L, "start by OhMyClient", 2000000);
|
ResultDTO<Long> startRes = ohMyClient.runJob(15L, "start by OhMyClient", 2000000);
|
||||||
System.out.println("runJob result: " + JsonUtils.toJSONString(startRes));
|
System.out.println("runJob result: " + JSONObject.toJSONString(startRes));
|
||||||
|
|
||||||
// 手动重启 server,干掉时间轮中的调度数据
|
// 手动重启 server,干掉时间轮中的调度数据
|
||||||
TimeUnit.MINUTES.sleep(1);
|
TimeUnit.MINUTES.sleep(1);
|
||||||
|
|
||||||
ResultDTO<Void> cancelRes = ohMyClient.cancelInstance(startRes.getData());
|
ResultDTO<Void> cancelRes = ohMyClient.cancelInstance(startRes.getData());
|
||||||
System.out.println("cancelJob result: " + JsonUtils.toJSONString(cancelRes));
|
System.out.println("cancelJob result: " + JSONObject.toJSONString(cancelRes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.kfcfans.powerjob.client.OhMyClient;
|
import com.github.kfcfans.powerjob.client.OhMyClient;
|
||||||
import com.github.kfcfans.powerjob.common.ExecuteType;
|
import com.github.kfcfans.powerjob.common.ExecuteType;
|
||||||
import com.github.kfcfans.powerjob.common.ProcessorType;
|
import com.github.kfcfans.powerjob.common.ProcessorType;
|
||||||
@ -5,7 +6,6 @@ import com.github.kfcfans.powerjob.common.TimeExpressionType;
|
|||||||
import com.github.kfcfans.powerjob.common.model.PEWorkflowDAG;
|
import com.github.kfcfans.powerjob.common.model.PEWorkflowDAG;
|
||||||
import com.github.kfcfans.powerjob.common.request.http.SaveJobInfoRequest;
|
import com.github.kfcfans.powerjob.common.request.http.SaveJobInfoRequest;
|
||||||
import com.github.kfcfans.powerjob.common.request.http.SaveWorkflowRequest;
|
import com.github.kfcfans.powerjob.common.request.http.SaveWorkflowRequest;
|
||||||
import com.github.kfcfans.powerjob.common.utils.JsonUtils;
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -37,7 +37,7 @@ public class TestWorkflow {
|
|||||||
base.setProcessorInfo("com.github.kfcfans.powerjob.samples.workflow.WorkflowStandaloneProcessor");
|
base.setProcessorInfo("com.github.kfcfans.powerjob.samples.workflow.WorkflowStandaloneProcessor");
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
SaveJobInfoRequest request = JsonUtils.parseObject(JsonUtils.toBytes(base), SaveJobInfoRequest.class);
|
SaveJobInfoRequest request = JSONObject.parseObject(JSONObject.toJSONBytes(base), SaveJobInfoRequest.class);
|
||||||
request.setJobName(request.getJobName() + i);
|
request.setJobName(request.getJobName() + i);
|
||||||
System.out.println(ohMyClient.saveJob(request));
|
System.out.println(ohMyClient.saveJob(request));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user