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);
}
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();
}
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));
}
}
Aggregations