@Test public void assertAddJobStatusTraceEvent() { assertTrue(storage.addJobStatusTraceEvent( new JobStatusTraceEvent("test_job", "fake_task_id", "fake_slave_id", Source.LITE_EXECUTOR, "READY", "0", State.TASK_RUNNING, "message is empty."))); }
public boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { String originalTaskId = jobStatusTraceEvent.getOriginalTaskId(); if (State.TASK_STAGING != jobStatusTraceEvent.getState()) { originalTaskId = getOriginalTaskId(jobStatusTraceEvent.getTaskId()); } boolean result = false; try ( Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobStatusTraceLog())) { preparedStatement.setString(1, UUID.randomUUID().toString()); preparedStatement.setString(2, jobStatusTraceEvent.getJobName()); preparedStatement.setString(3, originalTaskId); preparedStatement.setString(4, jobStatusTraceEvent.getTaskId()); preparedStatement.setString(5, jobStatusTraceEvent.getSlaveId()); preparedStatement.setString(6, jobStatusTraceEvent.getSource().toString()); preparedStatement.setString(7, jobStatusTraceEvent.getExecutionType()); preparedStatement.setString(8, jobStatusTraceEvent.getShardingItems()); preparedStatement.setString(9, jobStatusTraceEvent.getState().toString()); preparedStatement.setString(10, truncateString(jobStatusTraceEvent.getMessage())); preparedStatement.setTimestamp(11, new Timestamp(jobStatusTraceEvent.getCreationTime().getTime())); preparedStatement.execute(); result = true; } catch (final SQLException ex) { log.error(ex.getMessage()); } return result; }
RDBJobEventStorage { public boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { String originalTaskId = jobStatusTraceEvent.getOriginalTaskId(); if (State.TASK_STAGING != jobStatusTraceEvent.getState()) { originalTaskId = getOriginalTaskId(jobStatusTraceEvent.getTaskId()); } boolean result = false; try ( Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobStatusTraceLog())) { preparedStatement.setString(1, UUID.randomUUID().toString()); preparedStatement.setString(2, jobStatusTraceEvent.getJobName()); preparedStatement.setString(3, originalTaskId); preparedStatement.setString(4, jobStatusTraceEvent.getTaskId()); preparedStatement.setString(5, jobStatusTraceEvent.getSlaveId()); preparedStatement.setString(6, jobStatusTraceEvent.getSource().toString()); preparedStatement.setString(7, jobStatusTraceEvent.getExecutionType()); preparedStatement.setString(8, jobStatusTraceEvent.getShardingItems()); preparedStatement.setString(9, jobStatusTraceEvent.getState().toString()); preparedStatement.setString(10, truncateString(jobStatusTraceEvent.getMessage())); preparedStatement.setTimestamp(11, new Timestamp(jobStatusTraceEvent.getCreationTime().getTime())); preparedStatement.execute(); result = true; } catch (final SQLException ex) { log.error(ex.getMessage()); } return result; } }
RDBJobEventStorage { public boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { String originalTaskId = jobStatusTraceEvent.getOriginalTaskId(); if (State.TASK_STAGING != jobStatusTraceEvent.getState()) { originalTaskId = getOriginalTaskId(jobStatusTraceEvent.getTaskId()); } boolean result = false; try ( Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobStatusTraceLog())) { preparedStatement.setString(1, UUID.randomUUID().toString()); preparedStatement.setString(2, jobStatusTraceEvent.getJobName()); preparedStatement.setString(3, originalTaskId); preparedStatement.setString(4, jobStatusTraceEvent.getTaskId()); preparedStatement.setString(5, jobStatusTraceEvent.getSlaveId()); preparedStatement.setString(6, jobStatusTraceEvent.getSource().toString()); preparedStatement.setString(7, jobStatusTraceEvent.getExecutionType()); preparedStatement.setString(8, jobStatusTraceEvent.getShardingItems()); preparedStatement.setString(9, jobStatusTraceEvent.getState().toString()); preparedStatement.setString(10, truncateString(jobStatusTraceEvent.getMessage())); preparedStatement.setTimestamp(11, new Timestamp(jobStatusTraceEvent.getCreationTime().getTime())); preparedStatement.execute(); result = true; } catch (final SQLException ex) { log.error(ex.getMessage()); } return result; } RDBJobEventStorage(final DataSource dataSource); }
RDBJobEventStorage { public boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { String originalTaskId = jobStatusTraceEvent.getOriginalTaskId(); if (State.TASK_STAGING != jobStatusTraceEvent.getState()) { originalTaskId = getOriginalTaskId(jobStatusTraceEvent.getTaskId()); } boolean result = false; try ( Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobStatusTraceLog())) { preparedStatement.setString(1, UUID.randomUUID().toString()); preparedStatement.setString(2, jobStatusTraceEvent.getJobName()); preparedStatement.setString(3, originalTaskId); preparedStatement.setString(4, jobStatusTraceEvent.getTaskId()); preparedStatement.setString(5, jobStatusTraceEvent.getSlaveId()); preparedStatement.setString(6, jobStatusTraceEvent.getSource().toString()); preparedStatement.setString(7, jobStatusTraceEvent.getExecutionType()); preparedStatement.setString(8, jobStatusTraceEvent.getShardingItems()); preparedStatement.setString(9, jobStatusTraceEvent.getState().toString()); preparedStatement.setString(10, truncateString(jobStatusTraceEvent.getMessage())); preparedStatement.setTimestamp(11, new Timestamp(jobStatusTraceEvent.getCreationTime().getTime())); preparedStatement.execute(); result = true; } catch (final SQLException ex) { log.error(ex.getMessage()); } return result; } RDBJobEventStorage(final DataSource dataSource); boolean addJobExecutionEvent(final JobExecutionEvent jobExecutionEvent); boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent); }
RDBJobEventStorage { public boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { String originalTaskId = jobStatusTraceEvent.getOriginalTaskId(); if (State.TASK_STAGING != jobStatusTraceEvent.getState()) { originalTaskId = getOriginalTaskId(jobStatusTraceEvent.getTaskId()); } boolean result = false; try ( Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(sqlMapper.getInsertForJobStatusTraceLog())) { preparedStatement.setString(1, UUID.randomUUID().toString()); preparedStatement.setString(2, jobStatusTraceEvent.getJobName()); preparedStatement.setString(3, originalTaskId); preparedStatement.setString(4, jobStatusTraceEvent.getTaskId()); preparedStatement.setString(5, jobStatusTraceEvent.getSlaveId()); preparedStatement.setString(6, jobStatusTraceEvent.getSource().toString()); preparedStatement.setString(7, jobStatusTraceEvent.getExecutionType()); preparedStatement.setString(8, jobStatusTraceEvent.getShardingItems()); preparedStatement.setString(9, jobStatusTraceEvent.getState().toString()); preparedStatement.setString(10, truncateString(jobStatusTraceEvent.getMessage())); preparedStatement.setTimestamp(11, new Timestamp(jobStatusTraceEvent.getCreationTime().getTime())); preparedStatement.execute(); result = true; } catch (final SQLException ex) { log.error(ex.getMessage()); } return result; } RDBJobEventStorage(final DataSource dataSource); boolean addJobExecutionEvent(final JobExecutionEvent jobExecutionEvent); boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent);  }