From c20a64e93aae34228ac322977fc54bfe9c1c8fc1 Mon Sep 17 00:00:00 2001 From: Ponfee Date: Tue, 12 Dec 2023 21:35:55 +0800 Subject: [PATCH] optimize test cases cost time --- .../src/main/resources/application-worker.yml | 2 +- .../disjob/common/model/PageResponse.java | 7 ++ .../conf-worker/application-worker.yml | 2 +- .../src/main/resources/worker-conf.yml | 2 +- .../application/SchedGroupService.java | 5 +- .../response/SchedGroupResponse.java | 15 +++++ .../supervisor/base/RateLimiterTest.java | 8 +-- .../disjob/supervisor/base/RedisLockTest.java | 64 +++++++------------ .../supervisor/base/ThreadExceptionTest.java | 2 +- .../disjob/supervisor/util/CommonTest.java | 2 +- .../disjob/supervisor/util/HashTest.java | 4 +- .../disjob/supervisor/util/NumbersTest.java | 2 +- .../util/ScheduledExecutorTest.java | 4 +- .../supervisor/util/TimingWheelTest.java | 6 +- disjob-test/pom.xml | 5 ++ sql/mysql-disjob.sql | 30 ++++----- 16 files changed, 87 insertions(+), 73 deletions(-) diff --git a/disjob-admin/ruoyi-disjob/src/main/resources/application-worker.yml b/disjob-admin/ruoyi-disjob/src/main/resources/application-worker.yml index dab7f5dda..271a8ca96 100644 --- a/disjob-admin/ruoyi-disjob/src/main/resources/application-worker.yml +++ b/disjob-admin/ruoyi-disjob/src/main/resources/application-worker.yml @@ -1,6 +1,6 @@ # Disjob worker configuration disjob.worker: - group: default + group: app-test timing-wheel-tick-ms: 100 timing-wheel-ring-size: 60 maximum-pool-size: 100 diff --git a/disjob-common/src/main/java/cn/ponfee/disjob/common/model/PageResponse.java b/disjob-common/src/main/java/cn/ponfee/disjob/common/model/PageResponse.java index 27dbbb9dc..e26c838fd 100644 --- a/disjob-common/src/main/java/cn/ponfee/disjob/common/model/PageResponse.java +++ b/disjob-common/src/main/java/cn/ponfee/disjob/common/model/PageResponse.java @@ -14,6 +14,7 @@ import java.io.Serializable; import java.util.List; +import java.util.function.Consumer; /** * Page query response @@ -57,6 +58,12 @@ public int getTotalPages() { return computeTotalPages(request.getPageSize(), total); } + public void forEachRow(Consumer action) { + if (rows != null) { + rows.forEach(action); + } + } + public static int computeTotalPages(int pageSize, long total) { return (int) ((total + pageSize - 1) / pageSize); } diff --git a/disjob-samples/conf-worker/application-worker.yml b/disjob-samples/conf-worker/application-worker.yml index dab7f5dda..271a8ca96 100644 --- a/disjob-samples/conf-worker/application-worker.yml +++ b/disjob-samples/conf-worker/application-worker.yml @@ -1,6 +1,6 @@ # Disjob worker configuration disjob.worker: - group: default + group: app-test timing-wheel-tick-ms: 100 timing-wheel-ring-size: 60 maximum-pool-size: 100 diff --git a/disjob-samples/disjob-samples-frameless-worker/src/main/resources/worker-conf.yml b/disjob-samples/disjob-samples-frameless-worker/src/main/resources/worker-conf.yml index 2eaa11f9a..049801304 100644 --- a/disjob-samples/disjob-samples-frameless-worker/src/main/resources/worker-conf.yml +++ b/disjob-samples/disjob-samples-frameless-worker/src/main/resources/worker-conf.yml @@ -9,7 +9,7 @@ disjob: max-count: 5 backoff-period: 3000 worker: - group: default + group: app-test timing-wheel-tick-ms: 100 timing-wheel-ring-size: 60 maximum-pool-size: 100 diff --git a/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/SchedGroupService.java b/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/SchedGroupService.java index 24f9d05d7..a69752130 100644 --- a/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/SchedGroupService.java +++ b/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/SchedGroupService.java @@ -124,11 +124,14 @@ public List matchGroup(String term) { } public PageResponse queryForPage(SchedGroupPageRequest pageRequest) { - return pageRequest.query( + PageResponse page = pageRequest.query( schedGroupMapper::queryPageCount, schedGroupMapper::queryPageRecords, SchedGroupConverter.INSTANCE::convert ); + + page.forEachRow(SchedGroupResponse::maskToken); + return page; } // ------------------------------------------------------------close diff --git a/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/response/SchedGroupResponse.java b/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/response/SchedGroupResponse.java index b0ddeac6c..953b15db3 100644 --- a/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/response/SchedGroupResponse.java +++ b/disjob-supervisor/src/main/java/cn/ponfee/disjob/supervisor/application/response/SchedGroupResponse.java @@ -11,6 +11,7 @@ import cn.ponfee.disjob.common.base.ToJsonString; import lombok.Getter; import lombok.Setter; +import org.apache.commons.lang3.StringUtils; import java.io.Serializable; import java.util.Date; @@ -39,4 +40,18 @@ public class SchedGroupResponse extends ToJsonString implements Serializable { private Date createdAt; private String updatedBy; private String createdBy; + + public void maskToken() { + this.supervisorToken = mask(supervisorToken); + this.workerToken = mask(workerToken); + this.userToken = mask(userToken); + } + + private static String mask(String str) { + if (StringUtils.isEmpty(str)) { + return str; + } + return "*****"; + } + } diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RateLimiterTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RateLimiterTest.java index 09d29afaf..305da57d2 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RateLimiterTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RateLimiterTest.java @@ -39,9 +39,9 @@ public void testJoin() throws InterruptedException { public void testStop() throws InterruptedException { MyThread1 thread = new MyThread1(); thread.start(); - Thread.sleep(2000); + Thread.sleep(500); Assertions.assertFalse(Threads.isStopped(thread)); - Threads.stopThread(thread, 1000, 2, 500); + Threads.stopThread(thread, 1000, 2, 200); Thread.sleep(100); Assertions.assertTrue(Threads.isStopped(thread)); thread.join(); @@ -51,10 +51,10 @@ public void testStop() throws InterruptedException { public void testInterrupt() throws InterruptedException { MyThread2 thread = new MyThread2(); thread.start(); - Thread.sleep(2000); + Thread.sleep(1000); Assertions.assertFalse(Threads.isStopped(thread)); thread.interrupt(); - Thread.sleep(1000); + Thread.sleep(500); Assertions.assertFalse(Threads.isStopped(thread)); // RateLimiter不会interrupt } diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RedisLockTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RedisLockTest.java index c92ff8d83..2983b3c62 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RedisLockTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/RedisLockTest.java @@ -14,7 +14,6 @@ import cn.ponfee.disjob.common.util.UuidUtils; import cn.ponfee.disjob.supervisor.SpringBootTestBase; import com.google.common.base.Stopwatch; -import com.google.common.collect.ImmutableMap; import com.google.common.io.Files; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.Assertions; @@ -26,13 +25,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.function.Consumer; -import java.util.stream.Collectors; /** * Redis lock test @@ -42,8 +41,7 @@ public class RedisLockTest extends SpringBootTestBase { private static final String NAME = RandomStringUtils.randomAlphabetic(3); - private static final int ROUND = 5; - private static final int RATIO = 7; + private static final int ROUND = 1; private RedisLockFactory factory; @@ -55,24 +53,24 @@ protected void beforeEach() { @Test public void test0() throws InterruptedException { String key = "test:" + UuidUtils.uuid32(); - RedisLock redisLock = factory.create(key, 10000); + RedisLock redisLock = factory.create(key, 5000); Assertions.assertTrue(redisLock.tryLock()); Thread.sleep(55); Long ttl1 = bean.getExpire("lock:" + key, TimeUnit.MILLISECONDS); System.out.println("ttl1: " + ttl1); - Assertions.assertTrue(ttl1 > 9000 && ttl1 < 10000); + Assertions.assertTrue(ttl1 > 4000 && ttl1 < 5000); - Thread.sleep(5000); + Thread.sleep(1000); Long ttl2 = bean.getExpire("lock:" + key, TimeUnit.MILLISECONDS); System.out.println("ttl2: " + ttl2); - Assertions.assertTrue(ttl2 > 4000 && ttl2 < 5000); + Assertions.assertTrue(ttl2 > 3000 && ttl2 < 4000); Assertions.assertTrue(redisLock.tryLock()); Thread.sleep(50); Long ttl3 = bean.getExpire("lock:" + key, TimeUnit.MILLISECONDS); System.out.println("ttl3: " + ttl3); - Assertions.assertTrue(ttl3 > 9000 && ttl3 < 10000); + Assertions.assertTrue(ttl3 > 4000 && ttl3 < 5000); Assertions.assertTrue(redisLock.isLocked()); Assertions.assertTrue(redisLock.isHeldByCurrentThread()); @@ -105,10 +103,8 @@ public void test1() throws IOException, InterruptedException { List threads = new ArrayList<>(); System.out.println("\n=========================START========================"); for (int i = 0; i < ROUND && (line = reader.readLine()) != null; i++) { - if (ThreadLocalRandom.current().nextInt(RATIO) == 0) { - final String line0 = line; - threads.add(new Thread(() -> printer.output(NAME + "-" + num.getAndIncrement() + "\t" + line0 + "\n"))); - } + final String line0 = line; + threads.add(new Thread(() -> printer.output(NAME + "-" + num.getAndIncrement() + "\t" + line0 + "\n"))); } reader.close(); for (Thread thread : threads) { @@ -129,12 +125,10 @@ public void test2() throws IOException, InterruptedException { List threads = new ArrayList<>(); System.out.println("\n=========================START========================"); for (int i = 0; i < ROUND && (line = reader.readLine()) != null; i++) { - if (ThreadLocalRandom.current().nextInt(RATIO) == 0) { - final String _line = line; - threads.add(new Thread( - () -> new Printer(lock).output(NAME + "-" + num.getAndIncrement() + "\t" + _line + "\n") - )); - } + final String _line = line; + threads.add(new Thread( + () -> new Printer(lock).output(NAME + "-" + num.getAndIncrement() + "\t" + _line + "\n") + )); } reader.close(); for (Thread thread : threads) { @@ -155,11 +149,9 @@ public void test3() throws IOException, InterruptedException { System.out.println("\n=========================START========================"); for (int i = 0; i < ROUND && (line = reader.readLine()) != null; i++) { final String line0 = line; - if (ThreadLocalRandom.current().nextInt(RATIO) == 0) { - threads.add(new Thread( - () -> new Printer(factory.create("test:lock:3", 30000)).output(NAME + "-" + num.getAndIncrement() + "\t" + line0 + "\n") - )); - } + threads.add(new Thread( + () -> new Printer(factory.create("test:lock:3", 30000)).output(NAME + "-" + num.getAndIncrement() + "\t" + line0 + "\n") + )); } reader.close(); for (Thread thread : threads) { @@ -174,19 +166,11 @@ public void test3() throws IOException, InterruptedException { @Test public void test4() throws IOException { Printer printer = new Printer(factory.create("test:lock:4", 30000)); - AtomicInteger num = new AtomicInteger(RATIO); System.out.println("\n=========================START========================"); - List> lines = Files.readLines(file(), StandardCharsets.UTF_8) - .subList(0, ROUND) - .stream() - .filter(e -> ThreadLocalRandom.current().nextInt(3) == 0) - .map(line -> ImmutableMap.of(num.getAndIncrement(), line)) - .collect(Collectors.toList()); - - execute(lines, map -> { - Entry line = map.entrySet().iterator().next(); - printer.output(NAME + "-" + line.getKey() + "\t" + line.getValue() + "\n"); - }, ForkJoinPool.commonPool()); + List lines = Files.readLines(file(), StandardCharsets.UTF_8) + .subList(0, ROUND); + + execute(lines, line -> printer.output(NAME + "-" + line + "\n"), ForkJoinPool.commonPool()); System.out.println("=========================END========================\n"); } @@ -199,7 +183,7 @@ public void test4() throws IOException { */ @Test public void testTryLockWithTimeout() throws InterruptedException { - int expire = 2000; + int expire = 1000; String lockKey = "test:lock:" + UuidUtils.uuid32(); String actualKey = "lock:" + lockKey; diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/ThreadExceptionTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/ThreadExceptionTest.java index 58e455845..5342121b0 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/ThreadExceptionTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/base/ThreadExceptionTest.java @@ -61,7 +61,7 @@ public void testQueueOfferAsync() throws InterruptedException { t.start(); t.interrupt(); //Thread.interrupted(); - Thread.sleep(2000); + Thread.sleep(500); System.out.println("end---"); } diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/CommonTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/CommonTest.java index fe3ac2d89..f9d222909 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/CommonTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/CommonTest.java @@ -170,7 +170,7 @@ public void testNumberSplit() { System.out.println(Numbers.partition(47, 2)); System.out.println(Numbers.partition(256, 2)); System.out.println(Numbers.partition(256, 4)); - for (int i = 0; i < 1000000; i++) { + for (int i = 0; i < 10000; i++) { int number = ThreadLocalRandom.current().nextInt(100000) + 1, size = ThreadLocalRandom.current().nextInt(31) + 1; List> split = Numbers.partition(number, size); Assertions.assertTrue(Collects.getFirst(split).a == 0); diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/HashTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/HashTest.java index be6bc173e..46f7f15b9 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/HashTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/HashTest.java @@ -95,7 +95,7 @@ public void testMD5() throws ClassNotFoundException { Assertions.assertEquals(String.class, Class.forName("java.lang.String")); } - static long round = 1_000_000_000L; + static long round = 1_000_000L; @Test public void testNexFloat() { @@ -188,7 +188,7 @@ public void testThreadPool() throws InterruptedException { System.out.println("------------b"); }); System.out.println("------------1"); - Thread.sleep(4000); + Thread.sleep(1000); } } diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/NumbersTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/NumbersTest.java index 8caae969c..a1cadbe25 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/NumbersTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/NumbersTest.java @@ -38,7 +38,7 @@ public void testFormat() { public void testRandom() { double min = 1.0D, max = 0.0D; Random random = new Random(); - for (int i = 0; i < 100000000; i++) { + for (int i = 0; i < 1000000; i++) { double r = random.nextDouble(); if (r < min) { min = r; diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/ScheduledExecutorTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/ScheduledExecutorTest.java index 3ab2a9b6e..3e8981ef1 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/ScheduledExecutorTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/ScheduledExecutorTest.java @@ -23,7 +23,7 @@ public class ScheduledExecutorTest { @Test public void testSubmit() throws InterruptedException { ScheduledThreadPoolExecutor registryScheduledExecutor = new ScheduledThreadPoolExecutor(1, ThreadPoolExecutors.DISCARD); - registryScheduledExecutor.scheduleWithFixedDelay(() -> System.out.println("scheduled"), 2, 1, TimeUnit.SECONDS); + registryScheduledExecutor.scheduleWithFixedDelay(() -> System.out.println("scheduled"), 500, 200, TimeUnit.MILLISECONDS); System.out.println(new Date()); @@ -31,6 +31,6 @@ public void testSubmit() throws InterruptedException { registryScheduledExecutor.execute(() -> System.out.println("execute")); System.out.println(new Date()); - Thread.sleep(5000); + Thread.sleep(1000); } } diff --git a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/TimingWheelTest.java b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/TimingWheelTest.java index 9a4a637c4..59573b4d8 100644 --- a/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/TimingWheelTest.java +++ b/disjob-supervisor/src/test/java/cn/ponfee/disjob/supervisor/util/TimingWheelTest.java @@ -81,9 +81,9 @@ public void testHashMapCapt() { @Test public void testTimeSecond() throws InterruptedException { - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 5; i++) { Assertions.assertEquals((int) ((System.currentTimeMillis() % 60000) / 1000), Calendar.getInstance().get(Calendar.SECOND)); - Thread.sleep(ThreadLocalRandom.current().nextLong(200)); + Thread.sleep(ThreadLocalRandom.current().nextLong(50)); } } @@ -190,7 +190,7 @@ public void testTimingWheel() { long hour = TimeUnit.HOURS.toMillis(10); System.out.println("hour=" + hour); - for (int i = 0; i < 100000; i++) { + for (int i = 0; i < 1000; i++) { long triggerTime = System.currentTimeMillis() + 5000 + ThreadLocalRandom.current().nextLong(hour); timingWheel.offer(CommonTest.createExecuteTaskParam(Operations.TRIGGER, 0, 0, 1L, 0, triggerTime, JobType.GENERAL, RouteStrategy.ROUND_ROBIN, 1, "jobHandler", new Worker("default", "workerId", "host", 1))); } diff --git a/disjob-test/pom.xml b/disjob-test/pom.xml index 6d68c9169..47332a5a7 100644 --- a/disjob-test/pom.xml +++ b/disjob-test/pom.xml @@ -60,6 +60,11 @@ org.springframework.boot spring-boot-starter-jdbc + + org.slf4j + slf4j-simple + true + diff --git a/sql/mysql-disjob.sql b/sql/mysql-disjob.sql index 808d696ad..553956ca6 100644 --- a/sql/mysql-disjob.sql +++ b/sql/mysql-disjob.sql @@ -178,21 +178,21 @@ CREATE TABLE `sched_group` ( -- INITIALIZE TEST SAMPLES JOB -- ---------------------------- INSERT INTO `sched_group` (`group`, `own_user`, `supervisor_token`, `worker_token`, `user_token`, `dev_users`) -VALUES ('default', 'disjob', '20bb8b7f1cb94dc894b45546a7c2982f', '358678bfe34648f68b607036a27c6854', '1878f0158782423f9306e7d4c70c999c', 'admin,disjob'); - -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351000, 'default', 'noop-job', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 1, '', 1, '0/40 * * * * ?', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351001, 'default', 'http-job', 'cn.ponfee.disjob.core.handle.impl.HttpJobHandler', 1, 1, 1, '{"method":"GET", "url":"https://www.baidu.com"}', 1, '0/50 * * * * ?', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351002, 'default', 'command-job', 'cn.ponfee.disjob.core.handle.impl.CommandJobHandler', 0, 1, 1, '{"cmdarray":["/bin/sh","-c","echo $(date +%Y/%m/%d)"]}', 1, '0/40 * * * * ?', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351003, 'default', 'script-job', 'cn.ponfee.disjob.core.handle.impl.ScriptJobHandler', 0, 1, 1, '{"type":"SHELL", "script":"#!/bin/sh \necho hello-shell!"}', 1, '0/50 * * * * ?', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351004, 'default', 'prime-count', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler', 1, 1, 1, '{\"m\":1,\"n\":1000000000,\"blockSize\":50000000,\"parallel\":4}', 2, '2022-10-06 22:53:00', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351005, 'default', 'broadcast-job', 'cn.ponfee.disjob.test.handler.TestBroadcastJobHandler', 1, 1, 6, 'broadcast-job-param', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351006, 'default', 'workflow-job', 'AJobHandler,BJobHandler->CJobHandler->DJobHandler,EJobHandler', 1, 2, 1, '', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351007, 'default', 'depend-job', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler', 1, 1, 1, '{\"m\":1,\"n\":500000000,\"blockSize\":20000000,\"parallel\":3}', 6, '1003164910267351000,1003164910267351001', null ); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351020, 'default', 'fixed-rate', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 1, 'fixed-rate demo', 4, '20', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351021, 'default', 'fixed-delay', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 5, 'fixed-delay demo', 5, '20', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351008, 'default', 'workflow-json-graph', '[{"source":"1:1:AJobHandler","target":"1:1:CJobHandler"},{"source":"1:1:AJobHandler","target":"1:1:DJobHandler"},{"source":"1:1:BJobHandler","target":"1:1:DJobHandler"},{"source":"1:1:BJobHandler","target":"1:1:EJobHandler"}]', 1, 2, 2, '', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351009, 'default', 'prime-count-dag', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler -> cn.ponfee.disjob.test.handler.PrimeAccumulateJobHandler', 1, 2, 3, '{\"m\":1,\"n\":2000000000,\"blockSize\":100000000,\"parallel\":3}', 2, '2023-09-02 18:00:00', unix_timestamp()*1000); -INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351010, 'default', 'groovy-job', 'cn.ponfee.disjob.core.handle.impl.GroovyJobHandler', 1, 1, 4, 'import java.util.*; savepoint.save(new Date().toString() + ": " + UUID.randomUUID().toString()); return "execute at: " + new Date() + jobHandler.toString()', 1, '0/50 * * * * ?', unix_timestamp()*1000); +VALUES ('app-test', 'disjob', '20bb8b7f1cb94dc894b45546a7c2982f', '358678bfe34648f68b607036a27c6854', '1878f0158782423f9306e7d4c70c999c', 'admin,alice'); + +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351000, 'app-test', 'noop-job', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 1, '', 1, '0/40 * * * * ?', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351001, 'app-test', 'http-job', 'cn.ponfee.disjob.core.handle.impl.HttpJobHandler', 1, 1, 1, '{"method":"GET", "url":"https://www.baidu.com"}', 1, '0/50 * * * * ?', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351002, 'app-test', 'command-job', 'cn.ponfee.disjob.core.handle.impl.CommandJobHandler', 0, 1, 1, '{"cmdarray":["/bin/sh","-c","echo $(date +%Y/%m/%d)"]}', 1, '0/40 * * * * ?', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351003, 'app-test', 'script-job', 'cn.ponfee.disjob.core.handle.impl.ScriptJobHandler', 0, 1, 1, '{"type":"SHELL", "script":"#!/bin/sh \necho hello-shell!"}', 1, '0/50 * * * * ?', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351004, 'app-test', 'prime-count', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler', 1, 1, 1, '{\"m\":1,\"n\":1000000000,\"blockSize\":50000000,\"parallel\":4}', 2, '2022-10-06 22:53:00', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351005, 'app-test', 'broadcast-job', 'cn.ponfee.disjob.test.handler.TestBroadcastJobHandler', 1, 1, 6, 'broadcast-job-param', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351006, 'app-test', 'workflow-job', 'AJobHandler,BJobHandler->CJobHandler->DJobHandler,EJobHandler', 1, 2, 1, '', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351007, 'app-test', 'depend-job', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler', 1, 1, 1, '{\"m\":1,\"n\":500000000,\"blockSize\":20000000,\"parallel\":3}', 6, '1003164910267351000,1003164910267351001', null ); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351020, 'app-test', 'fixed-rate', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 1, 'fixed-rate demo', 4, '20', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351021, 'app-test', 'fixed-delay', 'cn.ponfee.disjob.test.handler.NoopJobHandler', 1, 1, 5, 'fixed-delay demo', 5, '20', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351008, 'app-test', 'workflow-json-graph', '[{"source":"1:1:AJobHandler","target":"1:1:CJobHandler"},{"source":"1:1:AJobHandler","target":"1:1:DJobHandler"},{"source":"1:1:BJobHandler","target":"1:1:DJobHandler"},{"source":"1:1:BJobHandler","target":"1:1:EJobHandler"}]', 1, 2, 2, '', 2, '2023-03-18 21:30:00', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351009, 'app-test', 'prime-count-dag', 'cn.ponfee.disjob.test.handler.PrimeCountJobHandler -> cn.ponfee.disjob.test.handler.PrimeAccumulateJobHandler', 1, 2, 3, '{\"m\":1,\"n\":2000000000,\"blockSize\":100000000,\"parallel\":3}', 2, '2023-09-02 18:00:00', unix_timestamp()*1000); +INSERT INTO `sched_job` (`job_id`, `group`, `job_name`, `job_handler`, `job_state`, `job_type`, `route_strategy`, `job_param`, `trigger_type`, `trigger_value`, `next_trigger_time`) VALUES (1003164910267351010, 'app-test', 'groovy-job', 'cn.ponfee.disjob.core.handle.impl.GroovyJobHandler', 1, 1, 4, 'import java.util.*; savepoint.save(new Date().toString() + ": " + UUID.randomUUID().toString()); return "execute at: " + new Date() + jobHandler.toString()', 1, '0/50 * * * * ?', unix_timestamp()*1000); INSERT INTO `sched_depend` (`child_job_id`, `parent_job_id`, `sequence`) VALUES (1003164910267351007, 1003164910267351000, 1); INSERT INTO `sched_depend` (`child_job_id`, `parent_job_id`, `sequence`) VALUES (1003164910267351007, 1003164910267351001, 2);