Search in sources :

Example 1 with JobEventBus

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

the class JobEventRdbListenerTest method setUp.

@Before
public void setUp() throws JobEventListenerConfigurationException, SQLException, NoSuchFieldException {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName(org.h2.Driver.class.getName());
    dataSource.setUrl("jdbc:h2:mem:job_event_storage");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    JobEventRdbListener jobEventRdbListener = new JobEventRdbListener(dataSource);
    ReflectionUtils.setFieldValue(jobEventRdbListener, "repository", repository);
    when(jobEventRdbConfiguration.createJobEventListener()).thenReturn(jobEventRdbListener);
    jobEventBus = new JobEventBus(jobEventRdbConfiguration);
}
Also used : JobEventBus(com.dangdang.ddframe.job.event.JobEventBus) BasicDataSource(org.apache.commons.dbcp.BasicDataSource) Before(org.junit.Before)

Example 2 with JobEventBus

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

the class SchedulerEngineTest method setUp.

@Before
public void setUp() throws NoSuchFieldException {
    schedulerEngine = new SchedulerEngine(taskScheduler, facadeService, new JobEventBus(), frameworkIDService, statisticManager);
    ReflectionUtils.setFieldValue(schedulerEngine, "facadeService", facadeService);
    when(facadeService.load("test_job")).thenReturn(Optional.of(CloudJobConfigurationBuilder.createCloudJobConfiguration("test_job")));
    new RunningService(Mockito.mock(CoordinatorRegistryCenter.class)).clear();
}
Also used : JobEventBus(com.dangdang.ddframe.job.event.JobEventBus) RunningService(com.dangdang.ddframe.job.cloud.scheduler.state.running.RunningService) Before(org.junit.Before)

Example 3 with JobEventBus

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

the class TaskExecutor method registered.

@Override
public void registered(final ExecutorDriver executorDriver, final Protos.ExecutorInfo executorInfo, final Protos.FrameworkInfo frameworkInfo, final Protos.SlaveInfo slaveInfo) {
    if (!executorInfo.getData().isEmpty()) {
        Map<String, String> data = SerializationUtils.deserialize(executorInfo.getData().toByteArray());
        BasicDataSource dataSource = new BasicDataSource();
        dataSource.setDriverClassName(data.get("event_trace_rdb_driver"));
        dataSource.setUrl(data.get("event_trace_rdb_url"));
        dataSource.setPassword(data.get("event_trace_rdb_password"));
        dataSource.setUsername(data.get("event_trace_rdb_username"));
        jobEventBus = new JobEventBus(new JobEventRdbConfiguration(dataSource));
    }
}
Also used : JobEventBus(com.dangdang.ddframe.job.event.JobEventBus) JobEventRdbConfiguration(com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration) BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Aggregations

JobEventBus (com.dangdang.ddframe.job.event.JobEventBus)3 BasicDataSource (org.apache.commons.dbcp.BasicDataSource)2 Before (org.junit.Before)2 RunningService (com.dangdang.ddframe.job.cloud.scheduler.state.running.RunningService)1 JobEventRdbConfiguration (com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration)1