use of org.exoplatform.services.scheduler.impl.JobSchedulerServiceImpl in project kernel by exoplatform.
the class TestPersistedQuartzScheduler method setUp.
public void setUp() throws Exception {
manager = PortalContainer.getInstance();
manager.getComponentInstanceOfType(InitialContextInitializer.class);
DataSource dataSource = (DataSource) new InitialContext().lookup("jdbcjcr");
connection = dataSource.getConnection();
connection.setAutoCommit(true);
st = connection.createStatement();
/**
*init quartz tables**
*/
String scripts = IOUtil.getStreamContentAsString(PrivilegedFileHelper.getResourceAsStream("/quartz_hsqldb.sql"));
for (String query : splitWithSQLDelimiter(scripts)) {
st.executeUpdate(query);
}
/**
*init QuartzSheduler Service**
*/
InitParams initParams = new InitParams();
ValueParam valueParam = new ValueParam();
valueParam.setName("org.quartz.dataSource.quartzDS.jndiURL");
valueParam.setValue("jdbcjcr");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.jobStore.driverDelegateClass");
valueParam.setValue("org.quartz.impl.jdbcjobstore.StdJDBCDelegate");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.jobStore.class");
valueParam.setValue("org.quartz.impl.jdbcjobstore.JobStoreTX");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.threadPool.threadCount");
valueParam.setValue("5");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.jobStore.dataSource");
valueParam.setValue("quartzDS");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.jobStore.tablePrefix");
valueParam.setValue("QRTZ_");
initParams.addParameter(valueParam);
valueParam = new ValueParam();
valueParam.setName("org.quartz.jobStore.useProperties");
valueParam.setValue("true");
initParams.addParameter(valueParam);
QueueTasks queueTasks = new QueueTasks();
QuartzSheduler quartzSheduler = new QuartzSheduler(PortalContainer.getInstance().getContext(), initParams);
jobSchedulerService = new JobSchedulerServiceImpl(quartzSheduler, queueTasks);
}
Aggregations