@Test(expected = JobConfigurationException.class) public void assertRegisterDisabledJob() { when(disableJobService.isDisabled("transient_test_job")).thenReturn(true); producerManager.register(transientJobConfig); }
public void register(final CloudJobConfigurationPOJO cloudJobConfig) { if (disableJobService.isDisabled(cloudJobConfig.getJobName())) { throw new JobConfigurationException("Job '%s' has been disable.", cloudJobConfig.getJobName()); } Optional<CloudAppConfigurationPOJO> appConfigFromZk = appConfigService.load(cloudJobConfig.getAppName()); if (!appConfigFromZk.isPresent()) { throw new AppConfigurationException("Register app '%s' firstly.", cloudJobConfig.getAppName()); } Optional<CloudJobConfigurationPOJO> jobConfigFromZk = configService.load(cloudJobConfig.getJobName()); if (jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Job '%s' already existed.", cloudJobConfig.getJobName()); } configService.add(cloudJobConfig); schedule(cloudJobConfig); }
ProducerManager { public void register(final CloudJobConfigurationPOJO cloudJobConfig) { if (disableJobService.isDisabled(cloudJobConfig.getJobName())) { throw new JobConfigurationException("Job '%s' has been disable.", cloudJobConfig.getJobName()); } Optional<CloudAppConfigurationPOJO> appConfigFromZk = appConfigService.load(cloudJobConfig.getAppName()); if (!appConfigFromZk.isPresent()) { throw new AppConfigurationException("Register app '%s' firstly.", cloudJobConfig.getAppName()); } Optional<CloudJobConfigurationPOJO> jobConfigFromZk = configService.load(cloudJobConfig.getJobName()); if (jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Job '%s' already existed.", cloudJobConfig.getJobName()); } configService.add(cloudJobConfig); schedule(cloudJobConfig); } }
ProducerManager { public void register(final CloudJobConfigurationPOJO cloudJobConfig) { if (disableJobService.isDisabled(cloudJobConfig.getJobName())) { throw new JobConfigurationException("Job '%s' has been disable.", cloudJobConfig.getJobName()); } Optional<CloudAppConfigurationPOJO> appConfigFromZk = appConfigService.load(cloudJobConfig.getAppName()); if (!appConfigFromZk.isPresent()) { throw new AppConfigurationException("Register app '%s' firstly.", cloudJobConfig.getAppName()); } Optional<CloudJobConfigurationPOJO> jobConfigFromZk = configService.load(cloudJobConfig.getJobName()); if (jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Job '%s' already existed.", cloudJobConfig.getJobName()); } configService.add(cloudJobConfig); schedule(cloudJobConfig); } ProducerManager(final SchedulerDriver schedulerDriver, final CoordinatorRegistryCenter regCenter); }
ProducerManager { public void register(final CloudJobConfigurationPOJO cloudJobConfig) { if (disableJobService.isDisabled(cloudJobConfig.getJobName())) { throw new JobConfigurationException("Job '%s' has been disable.", cloudJobConfig.getJobName()); } Optional<CloudAppConfigurationPOJO> appConfigFromZk = appConfigService.load(cloudJobConfig.getAppName()); if (!appConfigFromZk.isPresent()) { throw new AppConfigurationException("Register app '%s' firstly.", cloudJobConfig.getAppName()); } Optional<CloudJobConfigurationPOJO> jobConfigFromZk = configService.load(cloudJobConfig.getJobName()); if (jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Job '%s' already existed.", cloudJobConfig.getJobName()); } configService.add(cloudJobConfig); schedule(cloudJobConfig); } ProducerManager(final SchedulerDriver schedulerDriver, final CoordinatorRegistryCenter regCenter); void startup(); void register(final CloudJobConfigurationPOJO cloudJobConfig); void update(final CloudJobConfigurationPOJO cloudJobConfig); void deregister(final String jobName); void schedule(final CloudJobConfigurationPOJO cloudJobConfig); void unschedule(final String jobName); void reschedule(final String jobName); void sendFrameworkMessage(final ExecutorID executorId, final SlaveID slaveId, final byte[] data); void shutdown(); }
ProducerManager { public void register(final CloudJobConfigurationPOJO cloudJobConfig) { if (disableJobService.isDisabled(cloudJobConfig.getJobName())) { throw new JobConfigurationException("Job '%s' has been disable.", cloudJobConfig.getJobName()); } Optional<CloudAppConfigurationPOJO> appConfigFromZk = appConfigService.load(cloudJobConfig.getAppName()); if (!appConfigFromZk.isPresent()) { throw new AppConfigurationException("Register app '%s' firstly.", cloudJobConfig.getAppName()); } Optional<CloudJobConfigurationPOJO> jobConfigFromZk = configService.load(cloudJobConfig.getJobName()); if (jobConfigFromZk.isPresent()) { throw new JobConfigurationException("Job '%s' already existed.", cloudJobConfig.getJobName()); } configService.add(cloudJobConfig); schedule(cloudJobConfig); } ProducerManager(final SchedulerDriver schedulerDriver, final CoordinatorRegistryCenter regCenter); void startup(); void register(final CloudJobConfigurationPOJO cloudJobConfig); void update(final CloudJobConfigurationPOJO cloudJobConfig); void deregister(final String jobName); void schedule(final CloudJobConfigurationPOJO cloudJobConfig); void unschedule(final String jobName); void reschedule(final String jobName); void sendFrameworkMessage(final ExecutorID executorId, final SlaveID slaveId, final byte[] data); void shutdown();  }