Search in sources :

Example 1 with JobEventRdbSearch

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch in project elastic-job by dangdangdotcom.

the class CloudJobRestfulApi method init.

/**
     * 初始化.
     * 
     * @param regCenter 注册中心
     * @param producerManager 生产管理器
     */
public static void init(final CoordinatorRegistryCenter regCenter, final ProducerManager producerManager) {
    CloudJobRestfulApi.regCenter = regCenter;
    CloudJobRestfulApi.producerManager = producerManager;
    GsonFactory.registerTypeAdapter(CloudJobConfiguration.class, new CloudJobConfigurationGsonFactory.CloudJobConfigurationGsonTypeAdapter());
    Optional<JobEventRdbConfiguration> jobEventRdbConfig = BootstrapEnvironment.getInstance().getJobEventRdbConfiguration();
    if (jobEventRdbConfig.isPresent()) {
        jobEventRdbSearch = new JobEventRdbSearch(jobEventRdbConfig.get().getDataSource());
    } else {
        jobEventRdbSearch = null;
    }
}
Also used : CloudJobConfigurationGsonFactory(com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfigurationGsonFactory) JobEventRdbConfiguration(com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration) JobEventRdbSearch(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch)

Example 2 with JobEventRdbSearch

use of com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch in project elastic-job by dangdangdotcom.

the class AbstractCloudRestfulApiTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    regCenter = mock(CoordinatorRegistryCenter.class);
    jobEventRdbSearch = mock(JobEventRdbSearch.class);
    SchedulerDriver schedulerDriver = mock(SchedulerDriver.class);
    ProducerManager producerManager = new ProducerManager(schedulerDriver, regCenter);
    producerManager.startup();
    restfulService = new RestfulService(regCenter, new RestfulServerConfiguration(19000), producerManager);
    restfulService.start();
}
Also used : JobEventRdbSearch(com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch) ProducerManager(com.dangdang.ddframe.job.cloud.scheduler.producer.ProducerManager) RestfulServerConfiguration(com.dangdang.ddframe.job.cloud.scheduler.env.RestfulServerConfiguration) SchedulerDriver(org.apache.mesos.SchedulerDriver) CoordinatorRegistryCenter(com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter) BeforeClass(org.junit.BeforeClass)

Aggregations

JobEventRdbSearch (com.dangdang.ddframe.job.event.rdb.JobEventRdbSearch)2 CloudJobConfigurationGsonFactory (com.dangdang.ddframe.job.cloud.scheduler.config.job.CloudJobConfigurationGsonFactory)1 RestfulServerConfiguration (com.dangdang.ddframe.job.cloud.scheduler.env.RestfulServerConfiguration)1 ProducerManager (com.dangdang.ddframe.job.cloud.scheduler.producer.ProducerManager)1 JobEventRdbConfiguration (com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration)1 CoordinatorRegistryCenter (com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter)1 SchedulerDriver (org.apache.mesos.SchedulerDriver)1 BeforeClass (org.junit.BeforeClass)1