diff --git a/powerjob-client/pom.xml b/powerjob-client/pom.xml
index bf2c173e..951ca22b 100644
--- a/powerjob-client/pom.xml
+++ b/powerjob-client/pom.xml
@@ -10,11 +10,11 @@
4.0.0
powerjob-client
- 3.0.1
+ 3.1.0
jar
- 3.0.1
+ 3.1.0
5.6.1
diff --git a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java
index fbb0c1e4..b6ee21b8 100644
--- a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java
+++ b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java
@@ -15,6 +15,7 @@ import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.apache.commons.lang3.StringUtils;
+import java.io.IOException;
import java.util.List;
import java.util.Objects;
@@ -39,8 +40,8 @@ public class OhMyClient {
* @param domain www.oms-server.com(内网域名,自行完成DNS & Proxy)
* @param appName 负责的应用名称
*/
- public OhMyClient(String domain, String appName) {
- this(Lists.newArrayList(domain), appName);
+ public OhMyClient(String domain, String appName, String password) {
+ this(Lists.newArrayList(domain), appName, password);
}
@@ -49,16 +50,16 @@ public class OhMyClient {
* @param addressList IP:Port 列表
* @param appName 负责的应用名称
*/
- public OhMyClient(List addressList, String appName) {
+ public OhMyClient(List addressList, String appName, String password) {
Objects.requireNonNull(addressList, "domain can't be null!");
Objects.requireNonNull(appName, "appName can't be null");
allAddress = addressList;
for (String addr : addressList) {
- String url = getUrl(OpenAPIConstant.ASSERT, addr) + "?appName=" + appName;
+ String url = getUrl(OpenAPIConstant.ASSERT, addr);
try {
- String result = HttpUtils.get(url);
+ String result = assertApp(appName, password, url);
if (StringUtils.isNotEmpty(result)) {
ResultDTO resultDTO = JsonUtils.parseObject(result, ResultDTO.class);
if (resultDTO.isSuccess()) {
@@ -77,6 +78,15 @@ public class OhMyClient {
log.info("[OhMyClient] {}'s oms-client bootstrap successfully.", appName);
}
+ private static String assertApp(String appName, String password, String url) throws IOException {
+ FormBody.Builder builder = new FormBody.Builder()
+ .add("appName", appName);
+ if (password != null) {
+ builder.add("password", password);
+ }
+ return HttpUtils.post(url, builder.build());
+ }
+
private static String getUrl(String path, String address) {
return String.format(URL_PATTERN, address, OpenAPIConstant.WEB_PATH, path);
diff --git a/powerjob-client/src/test/java/TestClient.java b/powerjob-client/src/test/java/TestClient.java
index 8edae482..2306dffc 100644
--- a/powerjob-client/src/test/java/TestClient.java
+++ b/powerjob-client/src/test/java/TestClient.java
@@ -21,7 +21,7 @@ public class TestClient {
@BeforeAll
public static void initClient() throws Exception {
- ohMyClient = new OhMyClient("127.0.0.1:7700", "oms-test2");
+ ohMyClient = new OhMyClient("127.0.0.1:7700", "oms-test2", null);
}
@Test
@@ -29,7 +29,7 @@ public class TestClient {
SaveJobInfoRequest newJobInfo = new SaveJobInfoRequest();
// newJobInfo.setId(8L);
- newJobInfo.setJobName("omsOpenAPIJob");
+ newJobInfo.setJobName("omsOpenAPIJobccccc");
newJobInfo.setJobDescription("tes OpenAPI");
newJobInfo.setJobParams("{'aa':'bb'}");
newJobInfo.setTimeExpressionType(TimeExpressionType.CRON);
diff --git a/powerjob-client/src/test/java/TestWorkflow.java b/powerjob-client/src/test/java/TestWorkflow.java
index 64ef1e4d..3b5f2f75 100644
--- a/powerjob-client/src/test/java/TestWorkflow.java
+++ b/powerjob-client/src/test/java/TestWorkflow.java
@@ -20,7 +20,7 @@ public class TestWorkflow {
@BeforeAll
public static void initClient() throws Exception {
- ohMyClient = new OhMyClient("127.0.0.1:7700", "oms-test");
+ ohMyClient = new OhMyClient("127.0.0.1:7700", "oms-test", null);
}
@Test
diff --git a/powerjob-common/pom.xml b/powerjob-common/pom.xml
index be200502..0e9d02c1 100644
--- a/powerjob-common/pom.xml
+++ b/powerjob-common/pom.xml
@@ -10,7 +10,7 @@
4.0.0
powerjob-common
- 3.0.1
+ 3.1.0
jar
diff --git a/powerjob-server/pom.xml b/powerjob-server/pom.xml
index efb56e95..59d9120e 100644
--- a/powerjob-server/pom.xml
+++ b/powerjob-server/pom.xml
@@ -10,13 +10,13 @@
4.0.0
powerjob-server
- 3.0.1
+ 3.1.0
jar
2.9.2
2.2.6.RELEASE
- 3.0.1
+ 3.1.0
8.0.19
1.4.200
2.5.2
diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/web/controller/OpenAPIController.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/web/controller/OpenAPIController.java
index 5e7c1254..df4662c2 100644
--- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/web/controller/OpenAPIController.java
+++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/web/controller/OpenAPIController.java
@@ -3,8 +3,7 @@ package com.github.kfcfans.powerjob.server.web.controller;
import com.github.kfcfans.powerjob.common.InstanceStatus;
import com.github.kfcfans.powerjob.common.OpenAPIConstant;
import com.github.kfcfans.powerjob.common.request.http.SaveWorkflowRequest;
-import com.github.kfcfans.powerjob.server.persistence.core.model.AppInfoDO;
-import com.github.kfcfans.powerjob.server.persistence.core.repository.AppInfoRepository;
+import com.github.kfcfans.powerjob.server.service.AppInfoService;
import com.github.kfcfans.powerjob.server.service.CacheService;
import com.github.kfcfans.powerjob.server.service.JobService;
import com.github.kfcfans.powerjob.server.service.instance.InstanceService;
@@ -15,7 +14,6 @@ import com.github.kfcfans.powerjob.common.response.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
-import java.util.Optional;
/**
* 开放接口(OpenAPI)控制器,对接 oms-client
@@ -27,6 +25,8 @@ import java.util.Optional;
@RequestMapping(OpenAPIConstant.WEB_PATH)
public class OpenAPIController {
+ @Resource
+ private AppInfoService appInfoService;
@Resource
private JobService jobService;
@Resource
@@ -39,14 +39,10 @@ public class OpenAPIController {
@Resource
private CacheService cacheService;
- @Resource
- private AppInfoRepository appInfoRepository;
- @GetMapping(OpenAPIConstant.ASSERT)
- public ResultDTO assertAppName(String appName) {
- Optional appInfoOpt = appInfoRepository.findByAppName(appName);
- return appInfoOpt.map(appInfoDO -> ResultDTO.success(appInfoDO.getId()))
- .orElseGet(() -> ResultDTO.failed(appName + " is not registered!"));
+ @PostMapping(OpenAPIConstant.ASSERT)
+ public ResultDTO assertAppName(String appName, @RequestParam(required = false) String password) {
+ return ResultDTO.success(appInfoService.assertApp(appName, password));
}
/* ************* Job 区 ************* */
diff --git a/powerjob-worker-agent/pom.xml b/powerjob-worker-agent/pom.xml
index cdc8df20..89629745 100644
--- a/powerjob-worker-agent/pom.xml
+++ b/powerjob-worker-agent/pom.xml
@@ -10,12 +10,12 @@
4.0.0
powerjob-worker-agent
- 3.0.1
+ 3.1.0
jar
- 3.0.1
+ 3.1.0
1.2.3
4.3.2
diff --git a/powerjob-worker-samples/pom.xml b/powerjob-worker-samples/pom.xml
index 700cd387..cb063bd8 100644
--- a/powerjob-worker-samples/pom.xml
+++ b/powerjob-worker-samples/pom.xml
@@ -10,11 +10,11 @@
4.0.0
powerjob-worker-samples
- 3.0.1
+ 3.1.0
2.2.6.RELEASE
- 3.0.1
+ 3.1.0
1.2.68
diff --git a/powerjob-worker/pom.xml b/powerjob-worker/pom.xml
index 50795566..a46e28b2 100644
--- a/powerjob-worker/pom.xml
+++ b/powerjob-worker/pom.xml
@@ -10,12 +10,12 @@
4.0.0
powerjob-worker
- 3.0.1
+ 3.1.0
jar
5.2.4.RELEASE
- 3.0.1
+ 3.1.0
1.4.200
3.4.2
5.6.1