diff --git a/metadata/index.json b/metadata/index.json index 742cfa29f..d5d31580c 100644 --- a/metadata/index.json +++ b/metadata/index.json @@ -82,6 +82,14 @@ "directory": "org.apache.commons/commons-pool2", "module": "org.apache.commons:commons-pool2" }, + { + "directory": "org.apache.shardingsphere.elasticjob/elasticjob-lite-core", + "module": "org.apache.shardingsphere.elasticjob:elasticjob-lite-core", + "requires": [ + "org.mockito:mockito-core", + "org.quartz-scheduler:quartz" + ] + }, { "directory": "ch.qos.logback/logback-classic", "module": "ch.qos.logback:logback-classic" diff --git a/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/index.json b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/index.json new file mode 100644 index 000000000..11ac50cc5 --- /dev/null +++ b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/index.json @@ -0,0 +1,4 @@ +[ + "reflect-config.json", + "resource-config.json" +] diff --git a/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/reflect-config.json b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/reflect-config.json new file mode 100644 index 000000000..542d6fde8 --- /dev/null +++ b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/reflect-config.json @@ -0,0 +1,2632 @@ +[ + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + }, + "name": "com.google.common.util.concurrent.AbstractFuture", + "fields": [ + { + "name": "listeners" + }, + { + "name": "value" + }, + { + "name": "waiters" + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + }, + "name": "com.google.common.util.concurrent.AbstractFuture$Waiter", + "fields": [ + { + "name": "next" + }, + { + "name": "thread" + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.setup.SetUpFacade" + }, + "name": "com.google.common.util.concurrent.AbstractScheduledService", + "methods": [ + { + "name": "isRunning", + "parameterTypes": [] + }, + { + "name": "stopAsync", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.beans.PropertyVetoException" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine" + }, + "name": "java.lang.Object", + "allDeclaredFields": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.lang.Object", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "java.lang.Object", + "methods": [ + { + "name": "", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.lang.ObjectBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.lang.ObjectCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.env.TimeService" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.registry.JobInstanceRegistry$JobInstanceRegistryListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService$$Lambda$587/0x0000000800fdcd98" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobTriggerListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.setup.SetUpFacade" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus" + }, + "name": "java.lang.StackWalker", + "methods": [ + { + "name": "walk", + "parameterTypes": [ + "java.util.function.Function" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.env.TimeService" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.registry.JobInstanceRegistry$JobInstanceRegistryListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService$$Lambda$587/0x0000000800fdcd98" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobTriggerListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.setup.SetUpFacade" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus" + }, + "name": "java.lang.StackWalker$StackFrame", + "methods": [ + { + "name": "getClassName", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.snapshot.SnapshotService" + }, + "name": "java.lang.Throwable", + "methods": [ + { + "name": "getSuppressed", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.env.TimeService" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.config.RescheduleListenerManager$CronSettingAndJobEventChangedJobListener" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService$$Lambda$587/0x0000000800fdcd98" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.setup.SetUpFacade" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus" + }, + "name": "java.lang.reflect.Executable", + "methods": [ + { + "name": "getParameterCount", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.sql.Date" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "java.sql.Timestamp" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "kotlin.jvm.JvmInline" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.env.TimeService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.env.TimeService", + "queryAllDeclaredMethods": true, + "queryAllDeclaredConstructors": true, + "methods": [ + { + "name": "getCurrentMillis", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setJobInstanceId", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setServerIp", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "allDeclaredFields": true, + "methods": [ + { + "name": "getJobInstanceId", + "parameterTypes": [] + }, + { + "name": "getLabels", + "parameterTypes": [] + }, + { + "name": "getServerIp", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setJobInstanceId", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setServerIp", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setJobInstanceId", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setServerIp", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstanceBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstanceCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobListenerTypes", + "parameterTypes": [ + "java.util.Collection" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "queryAllPublicMethods": true, + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.registry.JobInstanceRegistry$JobInstanceRegistryListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setLabel", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "getCron", + "parameterTypes": [] + }, + { + "name": "getDescription", + "parameterTypes": [] + }, + { + "name": "getJobErrorHandlerType", + "parameterTypes": [] + }, + { + "name": "getJobExecutorServiceHandlerType", + "parameterTypes": [] + }, + { + "name": "getJobExtraConfigurations", + "parameterTypes": [] + }, + { + "name": "getJobListenerTypes", + "parameterTypes": [] + }, + { + "name": "getJobName", + "parameterTypes": [] + }, + { + "name": "getJobParameter", + "parameterTypes": [] + }, + { + "name": "getJobShardingStrategyType", + "parameterTypes": [] + }, + { + "name": "getLabel", + "parameterTypes": [] + }, + { + "name": "getMaxTimeDiffSeconds", + "parameterTypes": [] + }, + { + "name": "getProps", + "parameterTypes": [] + }, + { + "name": "getReconcileIntervalMinutes", + "parameterTypes": [] + }, + { + "name": "getShardingItemParameters", + "parameterTypes": [] + }, + { + "name": "getShardingTotalCount", + "parameterTypes": [] + }, + { + "name": "getTimeZone", + "parameterTypes": [] + }, + { + "name": "isDisabled", + "parameterTypes": [] + }, + { + "name": "isFailover", + "parameterTypes": [] + }, + { + "name": "isMisfire", + "parameterTypes": [] + }, + { + "name": "isMonitorExecution", + "parameterTypes": [] + }, + { + "name": "isOverwrite", + "parameterTypes": [] + }, + { + "name": "isStaticSharding", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobListenerTypes", + "parameterTypes": [ + "java.util.Collection" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.config.RescheduleListenerManager$CronSettingAndJobEventChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverListenerManager$FailoverSettingsChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.guarantee.GuaranteeService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "getCron", + "parameterTypes": [] + }, + { + "name": "getDescription", + "parameterTypes": [] + }, + { + "name": "getJobErrorHandlerType", + "parameterTypes": [] + }, + { + "name": "getJobExecutorServiceHandlerType", + "parameterTypes": [] + }, + { + "name": "getJobExtraConfigurations", + "parameterTypes": [] + }, + { + "name": "getJobListenerTypes", + "parameterTypes": [] + }, + { + "name": "getJobName", + "parameterTypes": [] + }, + { + "name": "getJobParameter", + "parameterTypes": [] + }, + { + "name": "getJobShardingStrategyType", + "parameterTypes": [] + }, + { + "name": "getLabel", + "parameterTypes": [] + }, + { + "name": "getMaxTimeDiffSeconds", + "parameterTypes": [] + }, + { + "name": "getProps", + "parameterTypes": [] + }, + { + "name": "getReconcileIntervalMinutes", + "parameterTypes": [] + }, + { + "name": "getShardingItemParameters", + "parameterTypes": [] + }, + { + "name": "getShardingTotalCount", + "parameterTypes": [] + }, + { + "name": "getTimeZone", + "parameterTypes": [] + }, + { + "name": "isDisabled", + "parameterTypes": [] + }, + { + "name": "isFailover", + "parameterTypes": [] + }, + { + "name": "isMisfire", + "parameterTypes": [] + }, + { + "name": "isMonitorExecution", + "parameterTypes": [] + }, + { + "name": "isOverwrite", + "parameterTypes": [] + }, + { + "name": "isStaticSharding", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJobFacade" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobListenerTypes", + "parameterTypes": [ + "java.util.Collection" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionContextService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.MonitorExecutionListenerManager$MonitorExecutionSettingsChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ListenServersChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingListenerManager$ShardingTotalCountChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobListenerTypes", + "parameterTypes": [ + "java.util.Collection" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "methods": [ + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO", + "allDeclaredFields": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCron", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDescription", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setDisabled", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setFailover", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setJobListenerTypes", + "parameterTypes": [ + "java.util.Collection" + ] + }, + { + "name": "setJobName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setJobParameter", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMaxTimeDiffSeconds", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setMisfire", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setMonitorExecution", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setOverwrite", + "parameterTypes": [ + "boolean" + ] + }, + { + "name": "setReconcileIntervalMinutes", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setShardingItemParameters", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setShardingTotalCount", + "parameterTypes": [ + "int" + ] + }, + { + "name": "setStaticSharding", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJOBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJOCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener", + "methods": [ + { + "name": "notifyWaitingTaskComplete", + "parameterTypes": [] + }, + { + "name": "notifyWaitingTaskStart", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.reconcile.ReconcileService" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationService", + "methods": [ + { + "name": "load", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.election.LeaderService", + "methods": [ + { + "name": "isLeaderUntilBlock", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceNode", + "queryAllDeclaredMethods": true, + "queryAllDeclaredConstructors": true, + "methods": [ + { + "name": "getInstanceFullPath", + "parameterTypes": [] + }, + { + "name": "getLocalInstancePath", + "parameterTypes": [] + }, + { + "name": "isInstancePath", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService", + "methods": [ + { + "name": "isLocalJobInstanceExisted", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService", + "queryAllDeclaredMethods": true, + "queryAllDeclaredConstructors": true, + "methods": [ + { + "name": "persistOnline", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.config.RescheduleListenerManager$CronSettingAndJobEventChangedJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController", + "methods": [ + { + "name": "rescheduleJob", + "parameterTypes": [ + "java.lang.String", + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.ShutdownListenerManager$InstanceShutdownStatusJobListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController", + "methods": [ + { + "name": "isPaused", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController", + "methods": [ + { + "name": "pauseJob", + "parameterTypes": [] + }, + { + "name": "resumeJob", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPlugin", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPlugin", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPlugin", + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setCleanShutdown", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPluginBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPluginCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.server.ServerService", + "methods": [ + { + "name": "isEnableServer", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "persistOnline", + "parameterTypes": [ + "boolean" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService", + "queryAllDeclaredMethods": true, + "queryAllDeclaredConstructors": true, + "methods": [ + { + "name": "clearRunningInfo", + "parameterTypes": [ + "java.util.List" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ExecutionService", + "methods": [ + { + "name": "clearMisfire", + "parameterTypes": [ + "java.util.Collection" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.listener.RegistryCenterConnectionStateListener" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService", + "methods": [ + { + "name": "getLocalShardingItems", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.failover.FailoverService" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage", + "methods": [ + { + "name": "getJobNodeChildrenKeys", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "getJobNodeDataDirectly", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "isJobNodeExisted", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.instance.InstanceService$$Lambda$587/0x0000000800fdcd98" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage", + "methods": [ + { + "name": "createJobNodeIfNeeded", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.sharding.ShardingService" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage", + "methods": [ + { + "name": "isJobNodeExisted", + "parameterTypes": [ + "java.lang.String" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodeStorage", + "methods": [ + { + "name": "getJobRootNodeData", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJobFacade" + }, + "name": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus", + "queryAllDeclaredMethods": true, + "queryAllDeclaredConstructors": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus" + }, + "name": "org.apache.shardingsphere.elasticjob.tracing.JobTracingEventBus", + "methods": [ + { + "name": "post", + "parameterTypes": [ + "org.apache.shardingsphere.elasticjob.tracing.event.JobEvent" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.zookeeper.AddWatchMode" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter" + }, + "name": "org.apache.zookeeper.ClientCnxnSocketNIO", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.apache.zookeeper.client.ZKClientConfig" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.zookeeper.server.quorum.MultipleAddresses", + "methods": [ + { + "name": "getReachableOrOne", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer", + "fields": [ + { + "name": "addr" + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController" + }, + "name": "org.mockito.internal.matchers.InstanceOf", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.quartz.simpl.CascadingClassLoadHelper", + "methods": [ + { + "name": "", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.RAMJobStore", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap" + }, + "name": "org.quartz.simpl.RAMJobStore", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.quartz.simpl.RAMJobStore", + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setInstanceId", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setInstanceName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setMisfireThreshold", + "parameterTypes": [ + "long" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.RAMJobStoreBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.RAMJobStoreCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.SimpleThreadPool", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap" + }, + "name": "org.quartz.simpl.SimpleThreadPool", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler" + }, + "name": "org.quartz.simpl.SimpleThreadPool", + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setInstanceId", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setInstanceName", + "parameterTypes": [ + "java.lang.String" + ] + }, + { + "name": "setThreadCount", + "parameterTypes": [ + "int" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.SimpleThreadPoolBeanInfo" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "name": "org.quartz.simpl.SimpleThreadPoolCustomizer" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + }, + "name": "sun.misc.Unsafe", + "allDeclaredFields": true + }, + { + "condition": { + "typeReachable": "org.quartz.simpl.SimpleJobFactory" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob", + "queryAllPublicMethods": true, + "methods": [ + { + "name": "", + "parameterTypes": [] + }, + { + "name": "setJobExecutor", + "parameterTypes": [ + "org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor" + ] + } + ] + } +] diff --git a/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/resource-config.json b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/resource-config.json new file mode 100644 index 000000000..a1493a1a8 --- /dev/null +++ b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/resource-config.json @@ -0,0 +1,61 @@ +{ + "resources": { + "includes": [ + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandlerFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.error.handler.JobErrorHandler\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutorFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.item.JobItemExecutorFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.TypedJobItemExecutor\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.context.Reloadable\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobShardingStrategyFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobShardingStrategy\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.handler.threadpool.JobExecutorServiceHandlerFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.handler.threadpool.JobExecutorServiceHandler\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListenerFactory" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.reg.exception.RegExceptionHandler" + }, + "pattern": "\\QMETA-INF/services/org.apache.shardingsphere.elasticjob.reg.exception.IgnoredExceptionProvider\\E" + }, + { + "condition": { + "typeReachable": "org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap" + }, + "pattern": "\\Qorg/quartz/core/quartz-build.properties\\E" + } + ] + }, + "bundles": [] +} diff --git a/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/index.json b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/index.json new file mode 100644 index 000000000..4d69b7682 --- /dev/null +++ b/metadata/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/index.json @@ -0,0 +1,10 @@ +[ + { + "latest": true, + "metadata-version": "3.0.2", + "module": "org.apache.shardingsphere.elasticjob:elasticjob-lite-core", + "tested-versions": [ + "3.0.2" + ] + } +] diff --git a/metadata/org.mockito/mockito-core/4.8.1/reflect-config.json b/metadata/org.mockito/mockito-core/4.8.1/reflect-config.json index a04cb45fe..f524acbd9 100644 --- a/metadata/org.mockito/mockito-core/4.8.1/reflect-config.json +++ b/metadata/org.mockito/mockito-core/4.8.1/reflect-config.json @@ -197,5 +197,19 @@ "parameterTypes": [] } ] + }, + { + "condition": { + "typeReachable": "org.mockito.internal.invocation.TypeSafeMatching" + }, + "name": "org.mockito.internal.matchers.Any", + "queryAllPublicMethods": true + }, + { + "condition": { + "typeReachable": "org.mockito.internal.invocation.TypeSafeMatching" + }, + "name": "org.mockito.internal.matchers.Equals", + "queryAllPublicMethods": true } ] diff --git a/tests/src/index.json b/tests/src/index.json index d4d2495d1..b1ffc8a9e 100644 --- a/tests/src/index.json +++ b/tests/src/index.json @@ -186,6 +186,17 @@ } ] }, + { + "test-project-path": "org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2", + "libraries": [ + { + "name": "org.apache.shardingsphere.elasticjob:elasticjob-lite-core", + "versions": [ + "3.0.2" + ] + } + ] + }, { "test-project-path": "ch.qos.logback/logback-classic/1.2.11", "libraries": [ diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/.gitignore b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/.gitignore new file mode 100644 index 000000000..c98c7875b --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/.gitignore @@ -0,0 +1,4 @@ +gradlew.bat +gradlew +gradle/ +build/ diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/build.gradle b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/build.gradle new file mode 100644 index 000000000..37891a671 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/build.gradle @@ -0,0 +1,39 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ + +plugins { + id "org.graalvm.internal.tck" + id "io.freefair.lombok" version "6.6-rc1" +} + +String libraryVersion = tck.testedLibraryVersion.get() + +dependencies { + testImplementation "org.apache.shardingsphere.elasticjob:elasticjob-lite-core:$libraryVersion" + testImplementation 'org.assertj:assertj-core:3.22.0' + testImplementation 'org.mockito:mockito-core:4.11.0' + testImplementation 'org.mockito:mockito-junit-jupiter:4.11.0' + testImplementation 'org.hamcrest:hamcrest:2.2' + testImplementation 'org.awaitility:awaitility:4.2.0' + testImplementation 'ch.qos.logback:logback-classic:1.2.11' +} + +graalvmNative { + agent { + defaultMode = "conditional" + modes { + conditional { + userCodeFilterPath = "user-code-filter.json" + } + } + metadataCopy { + mergeWithExisting = true + inputTaskNames.add("test") + outputDirectories.add("src/test/resources/META-INF/native-image/org.apache.shardingsphere.elasticjob/elasticjob-lite-core") + } + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/gradle.properties b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/gradle.properties new file mode 100644 index 000000000..a6dd1c7e4 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/gradle.properties @@ -0,0 +1,2 @@ +library.version = 3.0.2 +metadata.dir = org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/ diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/settings.gradle b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/settings.gradle new file mode 100644 index 000000000..e6e076736 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/settings.gradle @@ -0,0 +1,13 @@ +pluginManagement { + def tckPath = Objects.requireNonNullElse( + System.getenv("GVM_TCK_TCKDIR"), + "../../../../tck-build-logic" + ) + includeBuild(tckPath) +} + +plugins { + id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT" +} + +rootProject.name = 'org.apache.shardingsphere.elasticjob.elasticjob-lite-core_tests' diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/election/LeaderNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/election/LeaderNodeTest.java new file mode 100644 index 000000000..6d6af752a --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/election/LeaderNodeTest.java @@ -0,0 +1,26 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.election; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class LeaderNodeTest { + private final LeaderNode leaderNode = new LeaderNode("test_job"); + + @Test + public void assertIsLeaderInstancePath() { + assertTrue(leaderNode.isLeaderInstancePath("/test_job/leader/election/instance")); + } + + @Test + public void assertIsNotLeaderInstancePath() { + assertFalse(leaderNode.isLeaderInstancePath("/test_job/leader/election/instance1")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverNodeTest.java new file mode 100644 index 000000000..71186aa8c --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/failover/FailoverNodeTest.java @@ -0,0 +1,42 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.failover; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; + +public final class FailoverNodeTest { + private final FailoverNode failoverNode = new FailoverNode("test_job"); + + @Test + public void assertGetItemsNode() { + assertThat(FailoverNode.getItemsNode(0), is("leader/failover/items/0")); + } + + @Test + public void assertGetExecutionFailoverNode() { + assertThat(FailoverNode.getExecutionFailoverNode(0), is("sharding/0/failover")); + } + + @Test + public void assertGetItemWhenNotExecutionFailoverPath() { + assertNull(failoverNode.getItemByExecutionFailoverPath("/test_job/sharding/0/completed")); + } + + @Test + public void assertGetItemByExecutionFailoverPath() { + assertThat(failoverNode.getItemByExecutionFailoverPath("/test_job/sharding/0/failover"), is(0)); + } + + @Test + public void assertGetProcessingFailoverNode() { + assertThat(FailoverNode.getExecutingFailoverNode(0), is("sharding/0/failovering")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeNodeTest.java new file mode 100644 index 000000000..5abd0c72f --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/guarantee/GuaranteeNodeTest.java @@ -0,0 +1,48 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.guarantee; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class GuaranteeNodeTest { + private final GuaranteeNode guaranteeNode = new GuaranteeNode("test_job"); + + @Test + public void assertGetStartedNode() { + assertThat(GuaranteeNode.getStartedNode(1), is("guarantee/started/1")); + } + + @Test + public void assertGetCompletedNode() { + assertThat(GuaranteeNode.getCompletedNode(1), is("guarantee/completed/1")); + } + + @Test + public void assertIsStartedRootNode() { + assertTrue(guaranteeNode.isStartedRootNode("/test_job/guarantee/started")); + } + + @Test + public void assertIsNotStartedRootNode() { + assertFalse(guaranteeNode.isStartedRootNode("/otherJob/guarantee/started")); + } + + @Test + public void assertIsCompletedRootNode() { + assertTrue(guaranteeNode.isCompletedRootNode("/test_job/guarantee/completed")); + } + + @Test + public void assertIsNotCompletedRootNode() { + assertFalse(guaranteeNode.isCompletedRootNode("/otherJob/guarantee/completed")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/instance/InstanceNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/instance/InstanceNodeTest.java new file mode 100644 index 000000000..4e4e0cc40 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/instance/InstanceNodeTest.java @@ -0,0 +1,62 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.instance; + +import org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class InstanceNodeTest { + private static InstanceNode instanceNode; + + @BeforeAll + public static void setUp() { + JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0")); + instanceNode = new InstanceNode("test_job"); + } + + @Test + public void assertGetInstanceFullPath() { + assertThat(instanceNode.getInstanceFullPath(), is("/test_job/instances")); + } + + @Test + public void assertIsInstancePath() { + assertTrue(instanceNode.isInstancePath("/test_job/instances/127.0.0.1@-@0")); + } + + @Test + public void assertIsNotInstancePath() { + assertFalse(instanceNode.isInstancePath("/test_job/other/127.0.0.1@-@0")); + } + + @Test + public void assertIsLocalInstancePath() { + assertTrue(instanceNode.isLocalInstancePath("/test_job/instances/127.0.0.1@-@0")); + } + + @Test + public void assertIsNotLocalInstancePath() { + assertFalse(instanceNode.isLocalInstancePath("/test_job/instances/127.0.0.2@-@0")); + } + + @Test + public void assertGetLocalInstancePath() { + assertThat(instanceNode.getLocalInstancePath(), is("instances/127.0.0.1@-@0")); + } + + @Test + public void assertGetInstancePath() { + assertThat(instanceNode.getInstancePath("127.0.0.1@-@0"), is("instances/127.0.0.1@-@0")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/server/ServerNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/server/ServerNodeTest.java new file mode 100644 index 000000000..db17ead4a --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/server/ServerNodeTest.java @@ -0,0 +1,51 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.server; + +import org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class ServerNodeTest { + private final ServerNode serverNode = new ServerNode("test_job"); + + @BeforeAll + public static void setUp() { + JobRegistry.getInstance().addJobInstance("test_job", new JobInstance("127.0.0.1@-@0", null, "127.0.0.1")); + } + + @Test + public void assertIsServerPath() { + assertTrue(serverNode.isServerPath("/test_job/servers/127.0.0.1")); + } + + @Test + public void assertIsNotServerPath() { + assertFalse(serverNode.isServerPath("/test_job/servers/255.255.255.256")); + } + + @Test + public void assertIsLocalServerPath() { + assertTrue(serverNode.isLocalServerPath("/test_job/servers/127.0.0.1")); + } + + @Test + public void assertIsNotLocalServerPath() { + assertFalse(serverNode.isLocalServerPath("/test_job/servers/127.0.0.2")); + } + + @Test + public void assertGetServerNode() { + assertThat(serverNode.getServerNode("127.0.0.1"), is("servers/127.0.0.1")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingNodeTest.java new file mode 100644 index 000000000..1d0f34bac --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ShardingNodeTest.java @@ -0,0 +1,38 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org.apache.shardingsphere.elasticjob.lite.internal.sharding; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; + +public final class ShardingNodeTest { + + private final ShardingNode shardingNode = new ShardingNode("test_job"); + + @Test + public void assertGetRunningNode() { + assertThat(ShardingNode.getRunningNode(0), is("sharding/0/running")); + } + + @Test + public void assertGetMisfireNode() { + assertThat(ShardingNode.getMisfireNode(0), is("sharding/0/misfire")); + } + + @Test + public void assertGetItemWhenNotRunningItemPath() { + assertNull(shardingNode.getItemByRunningItemPath("/test_job/sharding/0/completed")); + } + + @Test + public void assertGetItemByRunningItemPath() { + assertThat(shardingNode.getItemByRunningItemPath("/test_job/sharding/0/running"), is(0)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/bootstrap/impl/OneOffJobBootstrapTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/bootstrap/impl/OneOffJobBootstrapTest.java new file mode 100644 index 000000000..4b015be79 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/bootstrap/impl/OneOffJobBootstrapTest.java @@ -0,0 +1,108 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.bootstrap.impl; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.EmbedTestingServer; +import lombok.SneakyThrows; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduler; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter; +import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; + +import java.lang.reflect.Field; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class OneOffJobBootstrapTest { + + private static final ZookeeperConfiguration ZOOKEEPER_CONFIGURATION = new ZookeeperConfiguration(EmbedTestingServer.getConnectionString(), OneOffJobBootstrapTest.class.getSimpleName()); + + private static final int SHARDING_TOTAL_COUNT = 3; + + private ZookeeperRegistryCenter zkRegCenter; + + @BeforeAll + public static void init() { + EmbedTestingServer.start(); + } + + @BeforeEach + public void setUp() { + zkRegCenter = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIGURATION); + zkRegCenter.init(); + } + + @AfterEach + public void teardown() { + zkRegCenter.close(); + } + + @Test + public void assertConfigFailedWithCron() { + assertThrows(IllegalArgumentException.class, () -> new OneOffJobBootstrap(zkRegCenter, (SimpleJob) shardingContext -> { + }, JobConfiguration.newBuilder("test_one_off_job_execute_with_config_cron", SHARDING_TOTAL_COUNT).cron("0/5 * * * * ?").build())); + } + + @Test + public void assertExecute() { + AtomicInteger counter = new AtomicInteger(0); + final OneOffJobBootstrap oneOffJobBootstrap = new OneOffJobBootstrap( + zkRegCenter, + (SimpleJob) shardingContext -> counter.incrementAndGet(), + JobConfiguration.newBuilder("test_one_off_job_execute", SHARDING_TOTAL_COUNT).build() + ); + oneOffJobBootstrap.execute(); + blockUtilFinish(oneOffJobBootstrap, counter); + assertThat(counter.get(), is(SHARDING_TOTAL_COUNT)); + getJobScheduler(oneOffJobBootstrap).shutdown(); + } + + @Test + public void assertShutdown() throws SchedulerException { + OneOffJobBootstrap oneOffJobBootstrap = new OneOffJobBootstrap(zkRegCenter, (SimpleJob) shardingContext -> { + }, JobConfiguration.newBuilder("test_one_off_job_shutdown", SHARDING_TOTAL_COUNT).build()); + oneOffJobBootstrap.shutdown(); + assertTrue(getScheduler(oneOffJobBootstrap).isShutdown()); + } + + @SneakyThrows + private JobScheduler getJobScheduler(final OneOffJobBootstrap oneOffJobBootstrap) { + Field field = OneOffJobBootstrap.class.getDeclaredField("jobScheduler"); + field.setAccessible(true); + return (JobScheduler) field.get(oneOffJobBootstrap); + } + + @SneakyThrows + private Scheduler getScheduler(final OneOffJobBootstrap oneOffJobBootstrap) { + JobScheduler jobScheduler = getJobScheduler(oneOffJobBootstrap); + Field schedulerField = JobScheduleController.class.getDeclaredField("scheduler"); + schedulerField.setAccessible(true); + return (Scheduler) schedulerField.get(jobScheduler.getJobScheduleController()); + } + + @SuppressWarnings("BusyWait") + @SneakyThrows + private void blockUtilFinish(final OneOffJobBootstrap oneOffJobBootstrap, final AtomicInteger counter) { + Scheduler scheduler = getScheduler(oneOffJobBootstrap); + while (0 == counter.get() || !scheduler.getCurrentlyExecutingJobs().isEmpty()) { + Thread.sleep(100); + } + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/ElasticJobListenerCaller.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/ElasticJobListenerCaller.java new file mode 100644 index 000000000..aad0c024d --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/ElasticJobListenerCaller.java @@ -0,0 +1,13 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.listener.fixture; + +public interface ElasticJobListenerCaller { + void before(); + + void after(); +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestDistributeOnceElasticJobListener.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestDistributeOnceElasticJobListener.java new file mode 100644 index 000000000..f0f341236 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestDistributeOnceElasticJobListener.java @@ -0,0 +1,39 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.listener.fixture; + +import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; +import org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener; + +@SuppressWarnings("unused") +public final class TestDistributeOnceElasticJobListener extends AbstractDistributeOnceElasticJobListener { + private final ElasticJobListenerCaller caller; + + public TestDistributeOnceElasticJobListener() { + this(null); + } + + public TestDistributeOnceElasticJobListener(final ElasticJobListenerCaller caller) { + super(1L, 1L); + this.caller = caller; + } + + @Override + public void doBeforeJobExecutedAtLastStarted(final ShardingContexts shardingContexts) { + caller.before(); + } + + @Override + public void doAfterJobExecutedAtLastCompleted(final ShardingContexts shardingContexts) { + caller.after(); + } + + @Override + public String getType() { + return "DISTRIBUTE"; + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestElasticJobListener.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestElasticJobListener.java new file mode 100644 index 000000000..4e3e094a4 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/listener/fixture/TestElasticJobListener.java @@ -0,0 +1,46 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.listener.fixture; + +import lombok.RequiredArgsConstructor; +import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener; +import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; + +@SuppressWarnings("unused") +@RequiredArgsConstructor +public final class TestElasticJobListener implements ElasticJobListener { + private final ElasticJobListenerCaller caller; + private final String name; + private final int order; + private final StringBuilder orderResult; + + public TestElasticJobListener() { + this(null, null, 0, new StringBuilder()); + } + + @Override + public void beforeJobExecuted(final ShardingContexts shardingContexts) { + caller.before(); + orderResult.append(name); + } + + @Override + public void afterJobExecuted(final ShardingContexts shardingContexts) { + caller.after(); + orderResult.append(name); + } + + @Override + public String getType() { + return "TEST"; + } + + @Override + public int order() { + return order; + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/registry/JobInstanceRegistryTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/registry/JobInstanceRegistryTest.java new file mode 100644 index 000000000..95ee26f4d --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/api/registry/JobInstanceRegistryTest.java @@ -0,0 +1,68 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.registry; + +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.handler.sharding.JobInstance; +import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO; +import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; +import org.apache.shardingsphere.elasticjob.lite.api.registry.JobInstanceRegistry; +import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter; +import org.apache.shardingsphere.elasticjob.reg.listener.DataChangedEvent; +import org.apache.shardingsphere.elasticjob.reg.listener.DataChangedEvent.Type; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +@ExtendWith(MockitoExtension.class) +public final class JobInstanceRegistryTest { + + @Mock + private CoordinatorRegistryCenter regCenter; + + @Test + public void assertListenWithoutConfigPath() { + JobInstanceRegistry jobInstanceRegistry = new JobInstanceRegistry(regCenter, new JobInstance("id")); + jobInstanceRegistry.new JobInstanceRegistryListener().onChange(new DataChangedEvent(Type.ADDED, "/jobName", "")); + verify(regCenter, times(0)).get("/jobName"); + } + + @Test + public void assertListenLabelNotMatch() { + JobInstanceRegistry jobInstanceRegistry = new JobInstanceRegistry(regCenter, new JobInstance("id", "label1,label2")); + String jobConfig = toYaml(JobConfiguration.newBuilder("jobName", 1).label("label").build()); + jobInstanceRegistry.new JobInstanceRegistryListener().onChange(new DataChangedEvent(Type.ADDED, "/jobName/config", jobConfig)); + verify(regCenter, times(0)).get("/jobName"); + } + + @Test + public void assertListenScheduleJob() { + assertThrows(RuntimeException.class, () -> { + JobInstanceRegistry jobInstanceRegistry = new JobInstanceRegistry(regCenter, new JobInstance("id")); + String jobConfig = toYaml(JobConfiguration.newBuilder("jobName", 1).cron("0/1 * * * * ?").label("label").build()); + jobInstanceRegistry.new JobInstanceRegistryListener().onChange(new DataChangedEvent(Type.ADDED, "/jobName/config", jobConfig)); + }); + } + + @Test + public void assertListenOneOffJob() { + assertThrows(RuntimeException.class, () -> { + JobInstanceRegistry jobInstanceRegistry = new JobInstanceRegistry(regCenter, new JobInstance("id", "label")); + String jobConfig = toYaml(JobConfiguration.newBuilder("jobName", 1).label("label").build()); + jobInstanceRegistry.new JobInstanceRegistryListener().onChange(new DataChangedEvent(Type.ADDED, "/jobName/config", jobConfig)); + }); + } + + private String toYaml(final JobConfiguration build) { + return YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(build)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/EmbedTestingServer.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/EmbedTestingServer.java new file mode 100644 index 000000000..60ca4f281 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/EmbedTestingServer.java @@ -0,0 +1,64 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture; + +import org.apache.curator.framework.CuratorFramework; +import org.apache.curator.framework.CuratorFrameworkFactory; +import org.apache.curator.retry.ExponentialBackoffRetry; +import org.apache.shardingsphere.elasticjob.reg.exception.RegExceptionHandler; +import org.awaitility.Awaitility; + +import java.io.File; +import java.time.Duration; + +public final class EmbedTestingServer { + private static final int PORT = 7181; + private static Process process; + + private EmbedTestingServer() { + } + + public static String getConnectionString() { + return "localhost:" + PORT; + } + + public static void start() { + if (process != null && process.isAlive()) { + return; + } + try { + System.out.println("Starting Zookeeper ..."); + process = new ProcessBuilder("docker", "run", "--rm", "-p", PORT + ":2181", "-e", "JVMFLAGS=-Xmx1024m", "zookeeper:3.8.0") + .redirectOutput(new File("zookeeper-stdout.txt")) + .redirectError(new File("zookeeper-stderr.txt")) + .start(); + Awaitility.await().atMost(Duration.ofMinutes(1)).ignoreExceptions().until(() -> { + CuratorFramework client = CuratorFrameworkFactory.builder() + .connectString(getConnectionString()) + .retryPolicy(new ExponentialBackoffRetry(1000, 3)) + .build(); + client.start(); + client.close(); + return true; + }); + } catch (final Exception ex) { + RegExceptionHandler.handleException(ex); + } finally { + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + try { + if (process != null && process.isAlive()) { + System.out.println("Shutting down Zookeeper"); + process.destroy(); + } + } catch (final Exception ex) { + RegExceptionHandler.handleException(ex); + } + })); + } + } +} + diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/LiteYamlConstants.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/LiteYamlConstants.java new file mode 100644 index 000000000..4a48792ee --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/LiteYamlConstants.java @@ -0,0 +1,47 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@SuppressWarnings("unused") +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class LiteYamlConstants { + private static final String JOB_YAML = """ + jobName: test_job + cron: 0/1 * * * * ? + shardingTotalCount: 3 + jobParameter: 'param' + failover: %s + monitorExecution: %s + misfire: false + maxTimeDiffSeconds: %s + reconcileIntervalMinutes: 15 + description: 'desc' + disabled: true + overwrite: true"""; + private static final boolean DEFAULT_FAILOVER = true; + private static final boolean DEFAULT_MONITOR_EXECUTION = true; + private static final int DEFAULT_MAX_TIME_DIFF_SECONDS = 1000; + + public static String getJobYaml() { + return String.format(JOB_YAML, DEFAULT_FAILOVER, DEFAULT_MONITOR_EXECUTION, DEFAULT_MAX_TIME_DIFF_SECONDS); + } + + public static String getJobYaml(final int maxTimeDiffSeconds) { + return String.format(JOB_YAML, DEFAULT_FAILOVER, DEFAULT_MONITOR_EXECUTION, maxTimeDiffSeconds); + } + + public static String getJobYamlWithFailover(final boolean failover) { + return String.format(JOB_YAML, failover, DEFAULT_MONITOR_EXECUTION, DEFAULT_MAX_TIME_DIFF_SECONDS); + } + + public static String getJobYamlWithMonitorExecution(final boolean monitorExecution) { + return String.format(JOB_YAML, DEFAULT_FAILOVER, monitorExecution, DEFAULT_MAX_TIME_DIFF_SECONDS); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/executor/ClassedFooJobExecutor.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/executor/ClassedFooJobExecutor.java new file mode 100644 index 000000000..b3c2a4be6 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/executor/ClassedFooJobExecutor.java @@ -0,0 +1,25 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.executor; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.FooJob; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.api.ShardingContext; +import org.apache.shardingsphere.elasticjob.executor.JobFacade; +import org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor; + +public final class ClassedFooJobExecutor implements ClassedJobItemExecutor { + @Override + public void process(final FooJob elasticJob, final JobConfiguration jobConfig, final JobFacade jobFacade, final ShardingContext shardingContext) { + elasticJob.foo(shardingContext); + } + + @Override + public Class getElasticJobClass() { + return FooJob.class; + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/DetailedFooJob.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/DetailedFooJob.java new file mode 100644 index 000000000..6dd62ff78 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/DetailedFooJob.java @@ -0,0 +1,27 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job; + +import lombok.Getter; +import org.apache.shardingsphere.elasticjob.api.ShardingContext; + +import java.util.Collection; +import java.util.concurrent.CopyOnWriteArraySet; + +public final class DetailedFooJob implements FooJob { + + private final Collection completedJobItems = new CopyOnWriteArraySet<>(); + + @Getter + private volatile boolean completed; + + @Override + public void foo(final ShardingContext shardingContext) { + completedJobItems.add(shardingContext.getShardingItem()); + completed = completedJobItems.size() == shardingContext.getShardingTotalCount(); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/FooJob.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/FooJob.java new file mode 100644 index 000000000..bc1302255 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/fixture/job/FooJob.java @@ -0,0 +1,14 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job; + +import org.apache.shardingsphere.elasticjob.api.ElasticJob; +import org.apache.shardingsphere.elasticjob.api.ShardingContext; + +public interface FooJob extends ElasticJob { + void foo(ShardingContext shardingContext); +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/BaseIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/BaseIntegrateTest.java new file mode 100644 index 000000000..7f6ac76e1 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/BaseIntegrateTest.java @@ -0,0 +1,82 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.EmbedTestingServer; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util.ReflectionUtils; +import lombok.AccessLevel; +import lombok.Getter; +import org.apache.shardingsphere.elasticjob.api.ElasticJob; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.JobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.internal.election.LeaderService; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; + +@Getter(AccessLevel.PROTECTED) +public abstract class BaseIntegrateTest { + private static final ZookeeperConfiguration ZOOKEEPER_CONFIG = new ZookeeperConfiguration(EmbedTestingServer.getConnectionString(), "zkRegTestCenter"); + @Getter(AccessLevel.PROTECTED) + private static final CoordinatorRegistryCenter REGISTRY_CENTER = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIG); + private final ElasticJob elasticJob; + private final JobConfiguration jobConfiguration; + private final JobBootstrap jobBootstrap; + private final LeaderService leaderService; + private final String jobName = System.nanoTime() + "_test_job"; + + protected BaseIntegrateTest(final TestType type, final ElasticJob elasticJob) { + this.elasticJob = elasticJob; + jobConfiguration = getJobConfiguration(jobName); + jobBootstrap = createJobBootstrap(type, elasticJob); + leaderService = new LeaderService(REGISTRY_CENTER, jobName); + } + + protected abstract JobConfiguration getJobConfiguration(String jobName); + + @SuppressWarnings("UnnecessaryDefault") + private JobBootstrap createJobBootstrap(final TestType type, final ElasticJob elasticJob) { + return switch (type) { + case SCHEDULE -> new ScheduleJobBootstrap(REGISTRY_CENTER, elasticJob, jobConfiguration); + case ONE_OFF -> new OneOffJobBootstrap(REGISTRY_CENTER, elasticJob, jobConfiguration); + default -> throw new RuntimeException(String.format("Cannot support `%s`", type)); + }; + } + + @BeforeAll + public static void init() { + EmbedTestingServer.start(); + ZOOKEEPER_CONFIG.setConnectionTimeoutMilliseconds(30000); + REGISTRY_CENTER.init(); + } + + @BeforeEach + public void setUp() { + if (jobBootstrap instanceof ScheduleJobBootstrap) { + ((ScheduleJobBootstrap) jobBootstrap).schedule(); + } else { + ((OneOffJobBootstrap) jobBootstrap).execute(); + } + } + + @AfterEach + public void tearDown() { + jobBootstrap.shutdown(); + ReflectionUtils.setFieldValue(JobRegistry.getInstance(), "instance", null); + } + + public enum TestType { + + SCHEDULE, ONE_OFF + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/DisabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/DisabledJobIntegrateTest.java new file mode 100644 index 000000000..10937a090 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/DisabledJobIntegrateTest.java @@ -0,0 +1,46 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.disable; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.BaseIntegrateTest; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.infra.env.IpUtils; +import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO; +import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.apache.shardingsphere.elasticjob.lite.internal.server.ServerStatus; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; + +public abstract class DisabledJobIntegrateTest extends BaseIntegrateTest { + + public DisabledJobIntegrateTest(final TestType type) { + super(type, new DetailedFooJob()); + } + + protected final void assertDisabledRegCenterInfo() { + assertThat(JobRegistry.getInstance().getCurrentShardingTotalCount(getJobName()), is(3)); + assertThat(JobRegistry.getInstance().getJobInstance(getJobName()).getServerIp(), is(IpUtils.getIp())); + JobConfiguration jobConfig = YamlEngine.unmarshal(getREGISTRY_CENTER().get("/" + getJobName() + "/config"), JobConfigurationPOJO.class).toJobConfiguration(); + assertThat(jobConfig.getShardingTotalCount(), is(3)); + if (getJobBootstrap() instanceof ScheduleJobBootstrap) { + assertThat(jobConfig.getCron(), is("0/1 * * * * ?")); + } else { + assertNull(jobConfig.getCron()); + } + assertThat(jobConfig.getShardingItemParameters(), is("0=A,1=B,2=C")); + assertThat(getREGISTRY_CENTER().get("/" + getJobName() + "/servers/" + JobRegistry.getInstance().getJobInstance(getJobName()).getServerIp()), is(ServerStatus.DISABLED.name())); + while (null != getREGISTRY_CENTER().get("/" + getJobName() + "/leader/election/instance")) { + BlockUtils.waitingShortTime(); + } + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/OneOffDisabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/OneOffDisabledJobIntegrateTest.java new file mode 100644 index 000000000..1f380434a --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/OneOffDisabledJobIntegrateTest.java @@ -0,0 +1,30 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.disable; + +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.junit.jupiter.api.Test; + +public final class OneOffDisabledJobIntegrateTest extends DisabledJobIntegrateTest { + + public OneOffDisabledJobIntegrateTest() { + super(TestType.ONE_OFF); + } + + @Override + protected JobConfiguration getJobConfiguration(final String jobName) { + return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C") + .jobListenerTypes("INTEGRATE-TEST", "INTEGRATE-DISTRIBUTE").disabled(true).overwrite(true).build(); + } + + @Test + public void assertJobRunning() { + BlockUtils.waitingShortTime(); + assertDisabledRegCenterInfo(); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/ScheduleDisabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/ScheduleDisabledJobIntegrateTest.java new file mode 100644 index 000000000..526969329 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/disable/ScheduleDisabledJobIntegrateTest.java @@ -0,0 +1,50 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.disable; + +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.apache.shardingsphere.elasticjob.lite.internal.server.ServerStatus; +import org.junit.jupiter.api.Test; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.BaseIntegrateTest; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class ScheduleDisabledJobIntegrateTest extends DisabledJobIntegrateTest { + public ScheduleDisabledJobIntegrateTest() { + super(BaseIntegrateTest.TestType.SCHEDULE); + } + + @Override + protected JobConfiguration getJobConfiguration(final String jobName) { + return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C") + .jobListenerTypes("INTEGRATE-TEST", "INTEGRATE-DISTRIBUTE").disabled(true).overwrite(true).build(); + } + + @Test + public void assertJobRunning() { + BlockUtils.waitingShortTime(); + assertDisabledRegCenterInfo(); + setJobEnable(); + while (!((DetailedFooJob) getElasticJob()).isCompleted()) { + BlockUtils.waitingShortTime(); + } + assertEnabledRegCenterInfo(); + } + + private void setJobEnable() { + BaseIntegrateTest.getREGISTRY_CENTER().persist("/" + getJobName() + "/servers/" + JobRegistry.getInstance().getJobInstance(getJobName()).getServerIp(), ServerStatus.ENABLED.name()); + } + + private void assertEnabledRegCenterInfo() { + assertTrue(BaseIntegrateTest.getREGISTRY_CENTER().isExisted("/" + getJobName() + "/instances/" + JobRegistry.getInstance().getJobInstance(getJobName()).getJobInstanceId())); + BaseIntegrateTest.getREGISTRY_CENTER().remove("/" + getJobName() + "/leader/election"); + assertTrue(BaseIntegrateTest.getREGISTRY_CENTER().isExisted("/" + getJobName() + "/sharding")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/EnabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/EnabledJobIntegrateTest.java new file mode 100644 index 000000000..eeed56ba6 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/EnabledJobIntegrateTest.java @@ -0,0 +1,48 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.enable; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.BaseIntegrateTest; +import org.apache.shardingsphere.elasticjob.api.ElasticJob; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.env.IpUtils; +import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO; +import org.apache.shardingsphere.elasticjob.infra.yaml.YamlEngine; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.apache.shardingsphere.elasticjob.lite.internal.server.ServerStatus; +import org.junit.jupiter.api.BeforeEach; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public abstract class EnabledJobIntegrateTest extends BaseIntegrateTest { + protected EnabledJobIntegrateTest(final TestType type, final ElasticJob elasticJob) { + super(type, elasticJob); + } + + @BeforeEach + public final void assertEnabledRegCenterInfo() { + assertThat(JobRegistry.getInstance().getCurrentShardingTotalCount(getJobName()), is(3)); + assertThat(JobRegistry.getInstance().getJobInstance(getJobName()).getServerIp(), is(IpUtils.getIp())); + JobConfiguration jobConfig = YamlEngine.unmarshal(getREGISTRY_CENTER().get("/" + getJobName() + "/config"), JobConfigurationPOJO.class).toJobConfiguration(); + assertThat(jobConfig.getShardingTotalCount(), is(3)); + if (getJobBootstrap() instanceof ScheduleJobBootstrap) { + assertThat(jobConfig.getCron(), is("0/1 * * * * ?")); + } else { + assertNull(jobConfig.getCron()); + } + assertThat(jobConfig.getShardingItemParameters(), is("0=A,1=B,2=C")); + assertThat(getREGISTRY_CENTER().get("/" + getJobName() + "/servers/" + JobRegistry.getInstance().getJobInstance(getJobName()).getServerIp()), is(ServerStatus.ENABLED.name())); + assertThat(getREGISTRY_CENTER().get("/" + getJobName() + "/leader/election/instance"), is(JobRegistry.getInstance().getJobInstance(getJobName()).getJobInstanceId())); + assertTrue(getREGISTRY_CENTER().isExisted("/" + getJobName() + "/instances/" + JobRegistry.getInstance().getJobInstance(getJobName()).getJobInstanceId())); + getREGISTRY_CENTER().remove("/" + getJobName() + "/leader/election"); + assertTrue(getLeaderService().isLeaderUntilBlock()); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/OneOffEnabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/OneOffEnabledJobIntegrateTest.java new file mode 100644 index 000000000..bee28f970 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/OneOffEnabledJobIntegrateTest.java @@ -0,0 +1,34 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.enable; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class OneOffEnabledJobIntegrateTest extends EnabledJobIntegrateTest { + public OneOffEnabledJobIntegrateTest() { + super(TestType.ONE_OFF, new DetailedFooJob()); + } + + @Override + protected JobConfiguration getJobConfiguration(final String jobName) { + return JobConfiguration.newBuilder(jobName, 3).shardingItemParameters("0=A,1=B,2=C") + .jobListenerTypes("INTEGRATE-TEST", "INTEGRATE-DISTRIBUTE").overwrite(true).build(); + } + + @Test + public void assertJobInit() { + while (!((DetailedFooJob) getElasticJob()).isCompleted()) { + BlockUtils.waitingShortTime(); + } + assertTrue(getREGISTRY_CENTER().isExisted("/" + getJobName() + "/sharding")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/ScheduleEnabledJobIntegrateTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/ScheduleEnabledJobIntegrateTest.java new file mode 100644 index 000000000..c2ee60927 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/enable/ScheduleEnabledJobIntegrateTest.java @@ -0,0 +1,35 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.enable; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.BaseIntegrateTest; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.infra.concurrent.BlockUtils; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public final class ScheduleEnabledJobIntegrateTest extends EnabledJobIntegrateTest { + public ScheduleEnabledJobIntegrateTest() { + super(TestType.SCHEDULE, new DetailedFooJob()); + } + + @Override + protected JobConfiguration getJobConfiguration(final String jobName) { + return JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").shardingItemParameters("0=A,1=B,2=C") + .jobListenerTypes("INTEGRATE-TEST", "INTEGRATE-DISTRIBUTE").overwrite(true).build(); + } + + @Test + public void assertJobInit() { + while (!((DetailedFooJob) getElasticJob()).isCompleted()) { + BlockUtils.waitingShortTime(); + } + assertTrue(BaseIntegrateTest.getREGISTRY_CENTER().isExisted("/" + getJobName() + "/sharding")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestDistributeOnceElasticJobListener.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestDistributeOnceElasticJobListener.java new file mode 100644 index 000000000..7e02e5efa --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestDistributeOnceElasticJobListener.java @@ -0,0 +1,29 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.listener; + +import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; +import org.apache.shardingsphere.elasticjob.lite.api.listener.AbstractDistributeOnceElasticJobListener; + +public class TestDistributeOnceElasticJobListener extends AbstractDistributeOnceElasticJobListener { + public TestDistributeOnceElasticJobListener() { + super(100L, 100L); + } + + @Override + public void doBeforeJobExecutedAtLastStarted(final ShardingContexts shardingContexts) { + } + + @Override + public void doAfterJobExecutedAtLastCompleted(final ShardingContexts shardingContexts) { + } + + @Override + public String getType() { + return "INTEGRATE-DISTRIBUTE"; + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestElasticJobListener.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestElasticJobListener.java new file mode 100644 index 000000000..6d201c272 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/integrate/listener/TestElasticJobListener.java @@ -0,0 +1,25 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.listener; + +import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener; +import org.apache.shardingsphere.elasticjob.infra.listener.ShardingContexts; + +public class TestElasticJobListener implements ElasticJobListener { + @Override + public void beforeJobExecuted(final ShardingContexts shardingContexts) { + } + + @Override + public void afterJobExecuted(final ShardingContexts shardingContexts) { + } + + @Override + public String getType() { + return "INTEGRATE-TEST"; + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/config/ConfigurationNodeTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/config/ConfigurationNodeTest.java new file mode 100644 index 000000000..44d4aad42 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/config/ConfigurationNodeTest.java @@ -0,0 +1,20 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.config; + +import org.apache.shardingsphere.elasticjob.lite.internal.config.ConfigurationNode; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class ConfigurationNodeTest { + private final ConfigurationNode configurationNode = new ConfigurationNode("test_job"); + + @Test + public void assertIsConfigPath() { + Assertions.assertTrue(configurationNode.isConfigPath("/test_job/config")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/listener/ListenerNotifierManagerTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/listener/ListenerNotifierManagerTest.java new file mode 100644 index 000000000..dca24a763 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/listener/ListenerNotifierManagerTest.java @@ -0,0 +1,35 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.listener; + +import org.apache.shardingsphere.elasticjob.lite.internal.listener.ListenerNotifierManager; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.util.concurrent.Executor; + +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +@ExtendWith(MockitoExtension.class) +public class ListenerNotifierManagerTest { + + @Test + public void assertRegisterAndGetJobNotifyExecutor() { + String jobName = "test_job"; + ListenerNotifierManager.getInstance().registerJobNotifyExecutor(jobName); + assertThat(ListenerNotifierManager.getInstance().getJobNotifyExecutor(jobName), notNullValue(Executor.class)); + } + + @Test + public void assertRemoveAndShutDownJobNotifyExecutor() { + String jobName = "test_job"; + ListenerNotifierManager.getInstance().registerJobNotifyExecutor(jobName); + ListenerNotifierManager.getInstance().removeJobNotifyExecutor(jobName); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/schedule/JobScheduleControllerTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/schedule/JobScheduleControllerTest.java new file mode 100644 index 000000000..062a497e5 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/schedule/JobScheduleControllerTest.java @@ -0,0 +1,281 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.schedule; + +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.quartz.Trigger; +import org.quartz.TriggerKey; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util.ReflectionUtils; +import org.apache.shardingsphere.elasticjob.infra.exception.JobSystemException; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.quartz.impl.triggers.CronTriggerImpl; +import org.quartz.impl.triggers.SimpleTriggerImpl; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +public final class JobScheduleControllerTest { + @Mock + private Scheduler scheduler; + + @Mock + private JobDetail jobDetail; + + private JobScheduleController jobScheduleController; + + @BeforeEach + public void setUp() { + jobScheduleController = new JobScheduleController(scheduler, jobDetail, "test_job_Trigger"); + } + + @Test + public void assertIsPausedFailure() throws SchedulerException { + doThrow(SchedulerException.class).when(scheduler).getTriggerState(new TriggerKey("test_job_Trigger")); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.isPaused()); + } finally { + verify(scheduler).getTriggerState(new TriggerKey("test_job_Trigger")); + } + } + + @Test + public void assertIsPausedIfTriggerStateIsNormal() throws SchedulerException { + when(scheduler.getTriggerState(new TriggerKey("test_job_Trigger"))).thenReturn(Trigger.TriggerState.NORMAL); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + assertFalse(jobScheduleController.isPaused()); + } + + @Test + public void assertIsPausedIfTriggerStateIsPaused() throws SchedulerException { + when(scheduler.getTriggerState(new TriggerKey("test_job_Trigger"))).thenReturn(Trigger.TriggerState.PAUSED); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + assertTrue(jobScheduleController.isPaused()); + } + + @Test + public void assertIsPauseJobIfShutdown() throws SchedulerException { + when(scheduler.isShutdown()).thenReturn(true); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + assertFalse(jobScheduleController.isPaused()); + } + + @Test + public void assertPauseJobIfShutdown() throws SchedulerException { + when(scheduler.isShutdown()).thenReturn(true); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.pauseJob(); + verify(scheduler, times(0)).pauseAll(); + } + + @Test + public void assertPauseJobFailure() throws SchedulerException { + doThrow(SchedulerException.class).when(scheduler).pauseAll(); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.pauseJob()); + } finally { + verify(scheduler).pauseAll(); + } + } + + @Test + public void assertPauseJobSuccess() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.pauseJob(); + verify(scheduler).pauseAll(); + } + + @Test + public void assertResumeJobIfShutdown() throws SchedulerException { + when(scheduler.isShutdown()).thenReturn(true); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.resumeJob(); + verify(scheduler, times(0)).resumeAll(); + } + + @Test + public void assertResumeJobFailure() throws SchedulerException { + doThrow(SchedulerException.class).when(scheduler).resumeAll(); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.resumeJob()); + } finally { + verify(scheduler).resumeAll(); + } + } + + @Test + public void assertResumeJobSuccess() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.resumeJob(); + verify(scheduler).resumeAll(); + } + + @Test + public void assertTriggerJobIfShutdown() throws SchedulerException { + when(scheduler.isShutdown()).thenReturn(true); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + ReflectionUtils.setFieldValue(jobScheduleController, "jobDetail", jobDetail); + jobScheduleController.triggerJob(); + verify(jobDetail, times(0)).getKey(); + verify(scheduler, times(0)).triggerJob(any()); + } + + @Test + public void assertTriggerJobFailure() throws SchedulerException { + JobKey jobKey = new JobKey("test_job"); + when(jobDetail.getKey()).thenReturn(jobKey); + when(scheduler.checkExists(jobKey)).thenReturn(true); + doThrow(SchedulerException.class).when(scheduler).triggerJob(jobKey); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + ReflectionUtils.setFieldValue(jobScheduleController, "jobDetail", jobDetail); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.triggerJob()); + } finally { + verify(jobDetail, times(2)).getKey(); + verify(scheduler).triggerJob(jobKey); + } + } + + @Test + public void assertTriggerJobSuccess() throws SchedulerException { + JobKey jobKey = new JobKey("test_job"); + when(jobDetail.getKey()).thenReturn(jobKey); + when(scheduler.checkExists(any(JobKey.class))).thenReturn(true); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + ReflectionUtils.setFieldValue(jobScheduleController, "jobDetail", jobDetail); + jobScheduleController.triggerJob(); + verify(jobDetail, times(2)).getKey(); + verify(scheduler).triggerJob(jobKey); + } + + @Test + public void assertTriggerOneOffJobSuccess() throws SchedulerException { + JobKey jobKey = new JobKey("test_job"); + when(jobDetail.getKey()).thenReturn(jobKey); + when(scheduler.checkExists(jobDetail.getKey())).thenReturn(false); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + ReflectionUtils.setFieldValue(jobScheduleController, "jobDetail", jobDetail); + jobScheduleController.triggerJob(); + verify(jobDetail, times(2)).getKey(); + verify(scheduler).scheduleJob(eq(jobDetail), any(Trigger.class)); + verify(scheduler).start(); + } + + @Test + public void assertShutdownJobIfShutdown() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + when(scheduler.isShutdown()).thenReturn(true); + jobScheduleController.shutdown(); + verify(scheduler, times(0)).shutdown(); + } + + @Test + public void assertShutdownFailure() throws SchedulerException { + doThrow(SchedulerException.class).when(scheduler).shutdown(false); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.shutdown()); + } finally { + verify(scheduler).shutdown(false); + } + } + + @Test + public void assertShutdownSuccess() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.shutdown(); + verify(scheduler).shutdown(false); + } + + @Test + public void assertRescheduleJobIfShutdown() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + when(scheduler.isShutdown()).thenReturn(true); + jobScheduleController.rescheduleJob("0/1 * * * * ?", null); + verify(scheduler, times(0)).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + + @Test + public void assertRescheduleJobFailure() throws SchedulerException { + when(scheduler.getTrigger(TriggerKey.triggerKey("test_job_Trigger"))).thenReturn(new CronTriggerImpl()); + doThrow(SchedulerException.class).when(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.rescheduleJob("0/1 * * * * ?", null)); + } finally { + verify(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + } + + @Test + public void assertRescheduleJobSuccess() throws SchedulerException { + when(scheduler.getTrigger(TriggerKey.triggerKey("test_job_Trigger"))).thenReturn(new CronTriggerImpl()); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.rescheduleJob("0/1 * * * * ?", null); + verify(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + + @Test + public void assertRescheduleJobWhenTriggerIsNull() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.rescheduleJob("0/1 * * * * ?", null); + verify(scheduler, times(0)).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + + @Test + public void assertRescheduleJobIfShutdownForOneOffJob() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + when(scheduler.isShutdown()).thenReturn(true); + jobScheduleController.rescheduleJob(); + verify(scheduler, times(0)).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + + @Test + public void assertRescheduleJobFailureForOneOffJob() throws SchedulerException { + when(scheduler.getTrigger(TriggerKey.triggerKey("test_job_Trigger"))).thenReturn(new SimpleTriggerImpl()); + doThrow(SchedulerException.class).when(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + try { + assertThrows(JobSystemException.class, () -> jobScheduleController.rescheduleJob()); + } finally { + verify(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + } + + @Test + public void assertRescheduleJobSuccessForOneOffJob() throws SchedulerException { + when(scheduler.getTrigger(TriggerKey.triggerKey("test_job_Trigger"))).thenReturn(new SimpleTriggerImpl()); + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.rescheduleJob(); + verify(scheduler).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } + + @Test + public void assertRescheduleJobWhenTriggerIsNullForOneOffJob() throws SchedulerException { + ReflectionUtils.setFieldValue(jobScheduleController, "scheduler", scheduler); + jobScheduleController.rescheduleJob(); + verify(scheduler, times(0)).rescheduleJob(eq(TriggerKey.triggerKey("test_job_Trigger")), any()); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/DefaultJobClassNameProviderTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/DefaultJobClassNameProviderTest.java new file mode 100644 index 000000000..57747cf86 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/DefaultJobClassNameProviderTest.java @@ -0,0 +1,34 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.setup; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.FooJob; +import org.apache.shardingsphere.elasticjob.lite.internal.setup.DefaultJobClassNameProvider; +import org.apache.shardingsphere.elasticjob.lite.internal.setup.JobClassNameProvider; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class DefaultJobClassNameProviderTest { + @Test + public void assertGetOrdinaryClassJobName() { + JobClassNameProvider jobClassNameProvider = new DefaultJobClassNameProvider(); + String result = jobClassNameProvider.getJobClassName(new DetailedFooJob()); + assertThat(result, is(DetailedFooJob.class.getName())); + } + + @Test + public void assertGetLambdaJobName() { + JobClassNameProvider jobClassNameProvider = new DefaultJobClassNameProvider(); + FooJob lambdaFooJob = shardingContext -> { + }; + String result = jobClassNameProvider.getJobClassName(lambdaFooJob); + assertThat(result, is("org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.setup.DefaultJobClassNameProviderTest$$Lambda$")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/JobClassNameProviderFactoryTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/JobClassNameProviderFactoryTest.java new file mode 100644 index 000000000..80b146547 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/setup/JobClassNameProviderFactoryTest.java @@ -0,0 +1,21 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.setup; + +import org.apache.shardingsphere.elasticjob.lite.internal.setup.DefaultJobClassNameProvider; +import org.apache.shardingsphere.elasticjob.lite.internal.setup.JobClassNameProviderFactory; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.instanceOf; + +public final class JobClassNameProviderFactoryTest { + @Test + public void assertGetDefaultStrategy() { + MatcherAssert.assertThat(JobClassNameProviderFactory.getProvider(), instanceOf(DefaultJobClassNameProvider.class)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/BaseSnapshotServiceTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/BaseSnapshotServiceTest.java new file mode 100644 index 000000000..a54777abf --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/BaseSnapshotServiceTest.java @@ -0,0 +1,64 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.snapshot; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.EmbedTestingServer; +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util.ReflectionUtils; +import lombok.AccessLevel; +import lombok.Getter; +import org.apache.shardingsphere.elasticjob.api.ElasticJob; +import org.apache.shardingsphere.elasticjob.api.JobConfiguration; +import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap; +import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; +import org.apache.shardingsphere.elasticjob.lite.internal.snapshot.SnapshotService; +import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration; +import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; + +@SuppressWarnings("FieldMayBeFinal") +public abstract class BaseSnapshotServiceTest { + static final int DUMP_PORT = 9000; + + private static final ZookeeperConfiguration ZOOKEEPER_CONFIG = new ZookeeperConfiguration(EmbedTestingServer.getConnectionString(), "zkRegTestCenter"); + + @Getter(value = AccessLevel.PROTECTED) + private static final CoordinatorRegistryCenter REG_CENTER = new ZookeeperRegistryCenter(ZOOKEEPER_CONFIG); + + @Getter(value = AccessLevel.PROTECTED) + private static SnapshotService snapshotService = new SnapshotService(REG_CENTER, DUMP_PORT); + + private final ScheduleJobBootstrap bootstrap; + + @Getter(value = AccessLevel.PROTECTED) + private final String jobName = System.nanoTime() + "_test_job"; + + public BaseSnapshotServiceTest(final ElasticJob elasticJob) { + bootstrap = new ScheduleJobBootstrap(REG_CENTER, elasticJob, JobConfiguration.newBuilder(jobName, 3).cron("0/1 * * * * ?").overwrite(true).build()); + } + + @BeforeAll + public static void init() { + EmbedTestingServer.start(); + ZOOKEEPER_CONFIG.setConnectionTimeoutMilliseconds(30000); + REG_CENTER.init(); + } + + @BeforeEach + public final void setUp() { + REG_CENTER.init(); + bootstrap.schedule(); + } + + @AfterEach + public final void tearDown() { + bootstrap.shutdown(); + ReflectionUtils.setFieldValue(JobRegistry.getInstance(), "instance", null); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceDisableTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceDisableTest.java new file mode 100644 index 000000000..1bf00d1d2 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceDisableTest.java @@ -0,0 +1,51 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.snapshot; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import lombok.SneakyThrows; +import org.apache.shardingsphere.elasticjob.lite.internal.snapshot.SnapshotService; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.ServerSocket; + +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +public final class SnapshotServiceDisableTest extends BaseSnapshotServiceTest { + + public SnapshotServiceDisableTest() { + super(new DetailedFooJob()); + } + + @Test + public void assertMonitorWithDumpCommand() { + assertThrows(IOException.class, () -> SocketUtils.sendCommand(SnapshotService.DUMP_COMMAND, DUMP_PORT - 1)); + } + + @Test + public void assertPortInvalid() { + assertThrows(IllegalArgumentException.class, () -> { + SnapshotService snapshotService = new SnapshotService(getREG_CENTER(), -1); + snapshotService.listen(); + }); + } + + @Test + @SneakyThrows + public void assertListenException() { + ServerSocket serverSocket = new ServerSocket(9898); + SnapshotService snapshotService = new SnapshotService(getREG_CENTER(), 9898); + snapshotService.listen(); + serverSocket.close(); + Field field = snapshotService.getClass().getDeclaredField("serverSocket"); + field.setAccessible(true); + assertNull(field.get(snapshotService)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceEnableTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceEnableTest.java new file mode 100644 index 000000000..ebca22986 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SnapshotServiceEnableTest.java @@ -0,0 +1,40 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.snapshot; + +import org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.job.DetailedFooJob; +import org.apache.shardingsphere.elasticjob.lite.internal.snapshot.SnapshotService; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +public final class SnapshotServiceEnableTest extends BaseSnapshotServiceTest { + public SnapshotServiceEnableTest() { + super(new DetailedFooJob()); + } + + @BeforeEach + public void listenMonitor() { + getSnapshotService().listen(); + } + + @AfterEach + public void closeMonitor() { + getSnapshotService().close(); + } + + @Test + public void assertMonitorWithCommand() throws IOException { + assertNotNull(SocketUtils.sendCommand(SnapshotService.DUMP_COMMAND + getJobName(), DUMP_PORT)); + assertNull(SocketUtils.sendCommand("unknown_command", DUMP_PORT)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SocketUtils.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SocketUtils.java new file mode 100644 index 000000000..c9ae7f198 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/snapshot/SocketUtils.java @@ -0,0 +1,31 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.snapshot; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.Socket; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class SocketUtils { + public static String sendCommand(final String command, final int dumpPort) throws IOException { + try (Socket socket = new Socket("127.0.0.1", dumpPort); + BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))) { + writer.write(command); + writer.newLine(); + writer.flush(); + return reader.readLine(); + } + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/storage/JobNodePathTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/storage/JobNodePathTest.java new file mode 100644 index 000000000..b2cf9d659 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/storage/JobNodePathTest.java @@ -0,0 +1,48 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.storage; + +import org.apache.shardingsphere.elasticjob.lite.internal.storage.JobNodePath; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class JobNodePathTest { + + private final JobNodePath jobNodePath = new JobNodePath("test_job"); + + @Test + public void assertGetFullPath() { + assertThat(jobNodePath.getFullPath("node"), is("/test_job/node")); + } + + @Test + public void assertGetServerNodePath() { + assertThat(jobNodePath.getServerNodePath(), is("/test_job/servers")); + } + + @Test + public void assertGetServerNodePathForServerIp() { + assertThat(jobNodePath.getServerNodePath("ip0"), is("/test_job/servers/ip0")); + } + + @Test + public void assertGetShardingNodePath() { + assertThat(jobNodePath.getShardingNodePath(), is("/test_job/sharding")); + } + + @Test + public void assertGetShardingNodePathWihItemAndNode() { + assertThat(jobNodePath.getShardingNodePath("0", "running"), is("/test_job/sharding/0/running")); + } + + @Test + public void assertGetLeaderIpNodePath() { + assertThat(jobNodePath.getLeaderHostNodePath(), is("/test_job/leader/election/instance")); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/util/SensitiveInfoUtilsTest.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/util/SensitiveInfoUtilsTest.java new file mode 100644 index 000000000..faeeaad82 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/internal/util/SensitiveInfoUtilsTest.java @@ -0,0 +1,34 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.internal.util; + +import org.apache.shardingsphere.elasticjob.lite.internal.util.SensitiveInfoUtils; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +public final class SensitiveInfoUtilsTest { + @Test + public void assertFilterContentWithoutIp() { + List actual = Arrays.asList("/simpleElasticDemoJob/servers", "/simpleElasticDemoJob/leader"); + MatcherAssert.assertThat(SensitiveInfoUtils.filterSensitiveIps(actual), is(actual)); + } + + @Test + public void assertFilterContentWithSensitiveIp() { + List actual = Arrays.asList("/simpleElasticDemoJob/servers/127.0.0.1", "/simpleElasticDemoJob/servers/192.168.0.1/hostName | 192.168.0.1", + "/simpleElasticDemoJob/servers/192.168.0.11", "/simpleElasticDemoJob/servers/192.168.0.111"); + List expected = Arrays.asList("/simpleElasticDemoJob/servers/ip1", "/simpleElasticDemoJob/servers/ip2/hostName | ip2", + "/simpleElasticDemoJob/servers/ip3", "/simpleElasticDemoJob/servers/ip4"); + assertThat(SensitiveInfoUtils.filterSensitiveIps(actual), is(expected)); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/util/ReflectionUtils.java b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/util/ReflectionUtils.java new file mode 100644 index 000000000..ca95864aa --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/java/org_apache_shardingsphere_elasticjob/elasticjob_lite_core/util/ReflectionUtils.java @@ -0,0 +1,31 @@ +/* + * Copyright and related rights waived via CC0 + * + * You should have received a copy of the CC0 legalcode along with this + * work. If not, see . + */ +package org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.SneakyThrows; + +import java.lang.reflect.Field; + +@SuppressWarnings("unused") +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public final class ReflectionUtils { + @SneakyThrows + public static void setFieldValue(final Object target, final String fieldName, final Object fieldValue) { + Field field = target.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(target, fieldValue); + } + + @SneakyThrows + public static void setSuperclassFieldValue(final Object target, final String fieldName, final Object fieldValue) { + Field field = target.getClass().getSuperclass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(target, fieldValue); + } +} diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/proxy-config.json b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/proxy-config.json new file mode 100644 index 000000000..b8a4b78b4 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/proxy-config.json @@ -0,0 +1,26 @@ +[ + { + "condition": { + "typeReachable": "org.mockito.internal.creation.proxy.ProxyMockMaker" + }, + "interfaces": [ + "org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter" + ] + }, + { + "condition": { + "typeReachable": "org.mockito.internal.creation.proxy.ProxyMockMaker" + }, + "interfaces": [ + "org.quartz.JobDetail" + ] + }, + { + "condition": { + "typeReachable": "org.mockito.internal.creation.proxy.ProxyMockMaker" + }, + "interfaces": [ + "org.quartz.Scheduler" + ] + } +] diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/reflect-config.json b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/reflect-config.json new file mode 100644 index 000000000..55df19972 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/elasticjob-test-metadata/reflect-config.json @@ -0,0 +1,27 @@ +[ + { + "condition": { + "typeReachable": "org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util.ReflectionUtils" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobScheduleController", + "fields": [ + { + "name": "jobDetail" + }, + { + "name": "scheduler" + } + ] + }, + { + "condition": { + "typeReachable": "org_apache_shardingsphere_elasticjob.elasticjob_lite_core.util.ReflectionUtils" + }, + "name": "org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry", + "fields": [ + { + "name": "instance" + } + ] + } +] diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.6.0/reflect-config.json b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.6.0/reflect-config.json new file mode 100644 index 000000000..294ae6479 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/native-image/org.apache.zookeeper/zookeeper/3.6.0/reflect-config.json @@ -0,0 +1,52 @@ +[ + { + "condition": { + "typeReachable": "org.apache.zookeeper.ClientCnxn$SendThread" + }, + "name": "java.lang.Throwable", + "methods": [ + { + "name": "getSuppressed", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.zookeeper.ClientCnxnSocketNIO" + }, + "name": "java.lang.Throwable", + "methods": [ + { + "name": "getSuppressed", + "parameterTypes": [] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.zookeeper.ZooKeeper" + }, + "name": "org.apache.zookeeper.ClientCnxnSocketNIO", + "methods": [ + { + "name": "", + "parameterTypes": [ + "org.apache.zookeeper.client.ZKClientConfig" + ] + } + ] + }, + { + "condition": { + "typeReachable": "org.apache.zookeeper.client.ZooKeeperSaslClient" + }, + "name": "sun.security.provider.ConfigFile", + "methods": [ + { + "name": "", + "parameterTypes": [] + } + ] + } +] diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor new file mode 100644 index 000000000..d81841012 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.executor.item.impl.ClassedJobItemExecutor @@ -0,0 +1 @@ +org_apache_shardingsphere_elasticjob.elasticjob_lite_core.fixture.executor.ClassedFooJobExecutor diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener new file mode 100644 index 000000000..a67c9efa7 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/META-INF/services/org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener @@ -0,0 +1,4 @@ +org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.listener.fixture.TestDistributeOnceElasticJobListener +org_apache_shardingsphere_elasticjob.elasticjob_lite_core.api.listener.fixture.TestElasticJobListener +org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.listener.TestDistributeOnceElasticJobListener +org_apache_shardingsphere_elasticjob.elasticjob_lite_core.integrate.listener.TestElasticJobListener diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..5494acdc6 --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +org.mockito.internal.creation.proxy.ProxyMockMaker diff --git a/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/user-code-filter.json b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/user-code-filter.json new file mode 100644 index 000000000..d40df5b7c --- /dev/null +++ b/tests/src/org.apache.shardingsphere.elasticjob/elasticjob-lite-core/3.0.2/user-code-filter.json @@ -0,0 +1,10 @@ +{ + "rules": [ + { + "excludeClasses": "**" + }, + { + "includeClasses": "org.apache.shardingsphere.elasticjob.**" + } + ] +}