test_class.declarator: schedulerService
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private SchedulerService schedulerService;
test_class.type: SchedulerService
test_class.var_name: schedulerService
test_class.declarator: emailServiceClient
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private EmailServiceClient emailServiceClient;
test_class.type: EmailServiceClient
test_class.var_name: emailServiceClient
test_class.file: services/task-server/src/test/java/com/opencloud/task/server/service/SchedulerServiceTest.java
test_class.identifier: SchedulerServiceTest
test_class.superclass: extends BaseTest
test_case.body: @Test
      public void addCronJob() {
          String cron = "3 * * * * ? *";
          TaskInfo taskInfo = new TaskInfo();
          Map data = Maps.newHashMap();
          String serviceId = "upm-server";
          data.put("serviceId", serviceId);
          data.put("method", "get");
          data.put("path", "/test");
          data.put("contentType", "application/x-www-form-urlencoded");
          data.put("alarmMail", "515608851@qq.com");
          taskInfo.setData(data);
          taskInfo.setJobName("定时任务测试");
          taskInfo.setJobDescription("定时任务描述3秒执行一次");
          taskInfo.setJobClassName(HttpExecuteJob.class.getName());
          taskInfo.setJobGroupName(Scheduler.DEFAULT_GROUP);
          taskInfo.setCronExpression(cron);
          schedulerService.addCronJob(taskInfo);
      }
test_case.class_method_signature: SchedulerServiceTest.addCronJob()
test_case.full_signature: @Test public void addCronJob()
test_case.identifier: addCronJob
test_case.invocations: newHashMap put put put put put setData setJobName setJobDescription setJobClassName getName setJobGroupName setCronExpression addCronJob
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addCronJob()
focal_class.declarator: scheduler
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private Scheduler scheduler;
focal_class.type: Scheduler
focal_class.var_name: scheduler
focal_class.file: services/task-server/src/main/java/com/opencloud/task/server/service/SchedulerService.java
focal_class.identifier: SchedulerService
focal_class.class_method_signature: SchedulerService.getJobGroupNames()
focal_class.full_signature: public List<String> getJobGroupNames()
focal_class.identifier: getJobGroupNames
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<String>
focal_class.signature: List<String> getJobGroupNames()
focal_class.class_method_signature: SchedulerService.getJobList()
focal_class.full_signature: public List<TaskInfo> getJobList()
focal_class.identifier: getJobList
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<TaskInfo>
focal_class.signature: List<TaskInfo> getJobList()
focal_class.class_method_signature: SchedulerService.addSimpleJob(TaskInfo info)
focal_class.full_signature: public void addSimpleJob(TaskInfo info)
focal_class.identifier: addSimpleJob
focal_class.modifiers: public
focal_class.parameters: (TaskInfo info)
focal_class.return: void
focal_class.signature: void addSimpleJob(TaskInfo info)
focal_class.class_method_signature: SchedulerService.addCronJob(TaskInfo info)
focal_class.full_signature: public void addCronJob(TaskInfo info)
focal_class.identifier: addCronJob
focal_class.modifiers: public
focal_class.parameters: (TaskInfo info)
focal_class.return: void
focal_class.signature: void addCronJob(TaskInfo info)
focal_class.class_method_signature: SchedulerService.editSimpleJob(TaskInfo info)
focal_class.full_signature: public void editSimpleJob(TaskInfo info)
focal_class.identifier: editSimpleJob
focal_class.modifiers: public
focal_class.parameters: (TaskInfo info)
focal_class.return: void
focal_class.signature: void editSimpleJob(TaskInfo info)
focal_class.class_method_signature: SchedulerService.editCronJob(TaskInfo info)
focal_class.full_signature: public void editCronJob(TaskInfo info)
focal_class.identifier: editCronJob
focal_class.modifiers: public
focal_class.parameters: (TaskInfo info)
focal_class.return: void
focal_class.signature: void editCronJob(TaskInfo info)
focal_class.class_method_signature: SchedulerService.deleteJob(String jobName, String jobGroup)
focal_class.full_signature: public void deleteJob(String jobName, String jobGroup)
focal_class.identifier: deleteJob
focal_class.modifiers: public
focal_class.parameters: (String jobName, String jobGroup)
focal_class.return: void
focal_class.signature: void deleteJob(String jobName, String jobGroup)
focal_class.class_method_signature: SchedulerService.pauseJob(String jobName, String jobGroup)
focal_class.full_signature: public void pauseJob(String jobName, String jobGroup)
focal_class.identifier: pauseJob
focal_class.modifiers: public
focal_class.parameters: (String jobName, String jobGroup)
focal_class.return: void
focal_class.signature: void pauseJob(String jobName, String jobGroup)
focal_class.class_method_signature: SchedulerService.resumeJob(String jobName, String jobGroup)
focal_class.full_signature: public void resumeJob(String jobName, String jobGroup)
focal_class.identifier: resumeJob
focal_class.modifiers: public
focal_class.parameters: (String jobName, String jobGroup)
focal_class.return: void
focal_class.signature: void resumeJob(String jobName, String jobGroup)
focal_class.class_method_signature: SchedulerService.checkExists(String jobName, String jobGroup)
focal_class.full_signature: private boolean checkExists(String jobName, String jobGroup)
focal_class.identifier: checkExists
focal_class.modifiers: private
focal_class.parameters: (String jobName, String jobGroup)
focal_class.return: boolean
focal_class.signature: boolean checkExists(String jobName, String jobGroup)
focal_method.body: public void addCronJob(TaskInfo info) {
          String jobName = info.getJobName();
          String jobClassName = info.getJobClassName();
          String jobGroupName = info.getJobGroupName();
          String jobDescription = info.getJobDescription();
          String cronExpression = info.getCronExpression();
          Date createTime = new Date();
          JobDataMap dataMap = new JobDataMap();
          if (info.getData() != null) {
              dataMap.putAll(info.getData());
          }
          dataMap.put("createTime", createTime);
          try {
              if (checkExists(jobName, jobGroupName)) {
                  throw new OpenAlertException(String.format("任务已经存在, jobName:[%s],jobGroup:[%s]", jobName, jobGroupName));
              }
              TriggerKey triggerKey = TriggerKey.triggerKey(jobName, jobGroupName);
              JobKey jobKey = JobKey.jobKey(jobName, jobGroupName);
              CronScheduleBuilder schedBuilder = CronScheduleBuilder
                      .cronSchedule(cronExpression)
                      .withMisfireHandlingInstructionDoNothing();
              CronTrigger trigger = TriggerBuilder.newTrigger()
                      .withIdentity(triggerKey)
                      .withSchedule(schedBuilder).build();
  
              Class<? extends Job> clazz = (Class<? extends Job>) Class
                      .forName(jobClassName);
              JobDetail jobDetail = JobBuilder.newJob(clazz).withIdentity(jobKey)
                      .withDescription(jobDescription).usingJobData(dataMap).build();
              scheduler.scheduleJob(jobDetail, trigger);
          } catch (SchedulerException | ClassNotFoundException e) {
              throw new OpenAlertException("任务添加失败");
          }
      }
focal_method.class_method_signature: SchedulerService.addCronJob(TaskInfo info)
focal_method.full_signature: public void addCronJob(TaskInfo info)
focal_method.identifier: addCronJob
focal_method.invocations: getJobName getJobClassName getJobGroupName getJobDescription getCronExpression getData putAll getData put checkExists format triggerKey jobKey withMisfireHandlingInstructionDoNothing cronSchedule build withSchedule withIdentity newTrigger forName build usingJobData withDescription withIdentity newJob scheduleJob
focal_method.modifiers: public
focal_method.parameters: (TaskInfo info)
focal_method.return: void
focal_method.signature: void addCronJob(TaskInfo info)