diff --git a/elastic-job-cloud/elastic-job-cloud-executor/src/test/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutorTest.java b/elastic-job-cloud/elastic-job-cloud-executor/src/test/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutorTest.java index c354e1d372..2a35273ad2 100644 --- a/elastic-job-cloud/elastic-job-cloud-executor/src/test/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutorTest.java +++ b/elastic-job-cloud/elastic-job-cloud-executor/src/test/java/com/dangdang/ddframe/job/cloud/executor/TaskExecutorTest.java @@ -20,7 +20,6 @@ import com.dangdang.ddframe.job.api.JobType; import com.dangdang.ddframe.job.cloud.executor.fixture.TestJob; import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import com.dangdang.ddframe.job.executor.ShardingContexts; import com.google.protobuf.ByteString; import org.apache.commons.lang3.SerializationUtils; @@ -95,8 +94,7 @@ public void assertLaunchTaskWithTransientTaskAndJavaScriptJob() { @Test public void assertRegisteredWithoutData() { ExecutorInfo executorInfo = ExecutorInfo.newBuilder().setExecutorId(Protos.ExecutorID.newBuilder().setValue("test_executor")).setCommand(Protos.CommandInfo.getDefaultInstance()) - .setData(ByteString.copyFrom(SerializationUtils.serialize(new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:test_executor", "sa", "", JobTraceEvent.LogLevel.INFO)))) - .build(); + .setData(ByteString.copyFrom(SerializationUtils.serialize(new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:test_executor", "sa", "")))).build(); taskExecutor.registered(executorDriver, executorInfo, frameworkInfo, slaveInfo); } diff --git a/elastic-job-cloud/elastic-job-cloud-scheduler/src/main/java/com/dangdang/ddframe/job/cloud/scheduler/boot/env/BootstrapEnvironment.java b/elastic-job-cloud/elastic-job-cloud-scheduler/src/main/java/com/dangdang/ddframe/job/cloud/scheduler/boot/env/BootstrapEnvironment.java index f74365e4bd..2f0674dae3 100644 --- a/elastic-job-cloud/elastic-job-cloud-scheduler/src/main/java/com/dangdang/ddframe/job/cloud/scheduler/boot/env/BootstrapEnvironment.java +++ b/elastic-job-cloud/elastic-job-cloud-scheduler/src/main/java/com/dangdang/ddframe/job/cloud/scheduler/boot/env/BootstrapEnvironment.java @@ -18,7 +18,6 @@ package com.dangdang.ddframe.job.cloud.scheduler.boot.env; import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration; import com.google.common.base.Optional; import com.google.common.base.Preconditions; @@ -113,7 +112,7 @@ public Optional getRdbConfiguration() { String username = getValue(EnvironmentArgument.EVENT_TRACE_RDB_USERNAME); String password = getValue(EnvironmentArgument.EVENT_TRACE_RDB_PASSWORD); if (!Strings.isNullOrEmpty(driver) && !Strings.isNullOrEmpty(url) && !Strings.isNullOrEmpty(username)) { - return Optional.of(new JobEventRdbConfiguration(driver, url, username, password, JobTraceEvent.LogLevel.INFO)); + return Optional.of(new JobEventRdbConfiguration(driver, url, username, password)); } return Optional.absent(); } diff --git a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/JobEventListener.java b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/JobEventListener.java index affd848202..2b21b2310e 100644 --- a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/JobEventListener.java +++ b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/JobEventListener.java @@ -20,7 +20,6 @@ import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import com.google.common.eventbus.AllowConcurrentEvents; import com.google.common.eventbus.Subscribe; @@ -31,15 +30,6 @@ */ public interface JobEventListener extends JobEventIdentity { - /** - * 作业运行痕迹事件监听执行. - * - * @param jobTraceEvent 作业运行痕迹事件 - */ - @Subscribe - @AllowConcurrentEvents - void listen(JobTraceEvent jobTraceEvent); - /** * 作业执行事件监听执行. * diff --git a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfiguration.java b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfiguration.java index dce8fef26b..173c2333a5 100644 --- a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfiguration.java +++ b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfiguration.java @@ -19,7 +19,6 @@ import com.dangdang.ddframe.job.event.JobEventConfiguration; import com.dangdang.ddframe.job.event.JobEventListener; -import com.dangdang.ddframe.job.event.type.JobTraceEvent.LogLevel; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -47,8 +46,6 @@ public class JobEventRdbConfiguration extends JobEventRdbIdentity implements Job private final String password; - private final LogLevel logLevel; - @Override public JobEventListener createJobEventListener() { try { diff --git a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListener.java b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListener.java index 6a7af725d0..2beec147ed 100644 --- a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListener.java +++ b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListener.java @@ -20,7 +20,6 @@ import com.dangdang.ddframe.job.event.JobEventListener; import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import java.sql.SQLException; @@ -34,12 +33,7 @@ public final class JobEventRdbListener extends JobEventRdbIdentity implements Jo private final JobEventRdbStorage repository; public JobEventRdbListener(final JobEventRdbConfiguration config) throws SQLException { - repository = new JobEventRdbStorage(config.getDriverClassName(), config.getUrl(), config.getUsername(), config.getPassword(), config.getLogLevel()); - } - - @Override - public void listen(final JobTraceEvent traceEvent) { - repository.addJobTraceEvent(traceEvent); + repository = new JobEventRdbStorage(config.getDriverClassName(), config.getUrl(), config.getUsername(), config.getPassword()); } @Override diff --git a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorage.java b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorage.java index 5725caa6a5..5eb560caf5 100644 --- a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorage.java +++ b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorage.java @@ -19,8 +19,6 @@ import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent.LogLevel; import com.google.common.base.Strings; import lombok.extern.slf4j.Slf4j; @@ -41,18 +39,13 @@ @Slf4j class JobEventRdbStorage { - private static final String TABLE_JOB_TRACE_LOG = "JOB_TRACE_LOG"; - private static final String TABLE_JOB_EXECUTION_LOG = "JOB_EXECUTION_LOG"; private static final String TABLE_JOB_STATUS_TRACE_LOG = "JOB_STATUS_TRACE_LOG"; private final DataSource dataSource; - private final LogLevel logLevel; - - JobEventRdbStorage(final String driverClassName, final String url, final String username, final String password, final LogLevel logLevel) throws SQLException { - this.logLevel = logLevel; + JobEventRdbStorage(final String driverClassName, final String url, final String username, final String password) throws SQLException { dataSource = JobEventRdbDataSourceFactory.getDataSource(driverClassName, url, username, password); initTables(); } @@ -60,11 +53,6 @@ class JobEventRdbStorage { private void initTables() throws SQLException { try (Connection conn = dataSource.getConnection()) { DatabaseMetaData dbMetaData = conn.getMetaData(); - try (ResultSet resultSet = dbMetaData.getTables(null, null, TABLE_JOB_TRACE_LOG, new String[]{"TABLE"})) { - if (!resultSet.next()) { - createJobTraceTable(conn); - } - } try (ResultSet resultSet = dbMetaData.getTables(null, null, TABLE_JOB_EXECUTION_LOG, new String[]{"TABLE"})) { if (!resultSet.next()) { createJobExecutionTable(conn); @@ -78,22 +66,6 @@ private void initTables() throws SQLException { } } - private void createJobTraceTable(final Connection conn) throws SQLException { - String dbSchema = "CREATE TABLE `" + TABLE_JOB_TRACE_LOG + "` (" - + "`id` VARCHAR(40) NOT NULL, " - + "`job_name` VARCHAR(100) NOT NULL, " - + "`hostname` VARCHAR(255) NOT NULL, " - + "`ip` VARCHAR(50) NOT NULL, " - + "`log_level` CHAR(5) NOT NULL, " - + "`message` VARCHAR(2000) NOT NULL, " - + "`failure_cause` VARCHAR(4000) NULL, " - + "`creation_time` TIMESTAMP NOT NULL, " - + "PRIMARY KEY (`id`));"; - try (PreparedStatement preparedStatement = conn.prepareStatement(dbSchema)) { - preparedStatement.execute(); - } - } - private void createJobExecutionTable(final Connection conn) throws SQLException { String dbSchema = "CREATE TABLE `" + TABLE_JOB_EXECUTION_LOG + "` (" + "`id` VARCHAR(40) NOT NULL, " @@ -132,31 +104,6 @@ private void createJobStatusTraceTable(final Connection conn) throws SQLExceptio } } - boolean addJobTraceEvent(final JobTraceEvent traceEvent) { - boolean result = false; - if (needTrace(traceEvent.getLogLevel())) { - String sql = "INSERT INTO `" + TABLE_JOB_TRACE_LOG + "` (`id`, `job_name`, `hostname`, `ip`, `log_level`, `message`, `failure_cause`, `creation_time`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);"; - try ( - Connection conn = dataSource.getConnection(); - PreparedStatement preparedStatement = conn.prepareStatement(sql)) { - preparedStatement.setString(1, UUID.randomUUID().toString()); - preparedStatement.setString(2, traceEvent.getJobName()); - preparedStatement.setString(3, traceEvent.getHostname()); - preparedStatement.setString(4, traceEvent.getIp()); - preparedStatement.setString(5, traceEvent.getLogLevel().name()); - preparedStatement.setString(6, traceEvent.getMessage()); - preparedStatement.setString(7, truncateString(traceEvent.getFailureCause())); - preparedStatement.setTimestamp(8, new Timestamp(traceEvent.getCreationTime().getTime())); - preparedStatement.execute(); - result = true; - } catch (final SQLException ex) { - // TODO 记录失败直接输出日志,未来可考虑配置化 - log.error(ex.getMessage()); - } - } - return result; - } - boolean addJobExecutionEvent(final JobExecutionEvent jobExecutionEvent) { boolean result = false; if (null == jobExecutionEvent.getCompleteTime()) { @@ -241,10 +188,6 @@ boolean addJobStatusTraceEvent(final JobStatusTraceEvent jobStatusTraceEvent) { return result; } - private boolean needTrace(final LogLevel logLevel) { - return logLevel.ordinal() >= this.logLevel.ordinal(); - } - private String truncateString(final String str) { return !Strings.isNullOrEmpty(str) && str.length() > 4000 ? str.substring(0, 4000) : str; } diff --git a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/type/JobTraceEvent.java b/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/type/JobTraceEvent.java deleted file mode 100644 index e816ffeb6c..0000000000 --- a/elastic-job-core/src/main/java/com/dangdang/ddframe/job/event/type/JobTraceEvent.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1999-2015 dangdang.com. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- */ - -package com.dangdang.ddframe.job.event.type; - -import com.dangdang.ddframe.job.event.JobEvent; -import com.dangdang.ddframe.job.util.env.LocalHostService; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Date; - -/** - * 作业运行痕迹事件. - * - * @author zhangliang - */ -@RequiredArgsConstructor -@AllArgsConstructor -@Getter -public class JobTraceEvent implements JobEvent { - - private static LocalHostService localHostService = new LocalHostService(); - - private final String jobName; - - private final LogLevel logLevel; - - private final String message; - - private Throwable failureCause; - - private final String hostname = localHostService.getHostName(); - - private final String ip = localHostService.getIp(); - - private final Date creationTime = new Date(); - - /** - * 获取失败原因. - * @return 失败原因 - */ - public String getFailureCause() { - if (null == failureCause) { - return ""; - } - StringWriter result = new StringWriter(); - try (PrintWriter writer = new PrintWriter(result)) { - failureCause.printStackTrace(writer); - } - return result.toString(); - } - - /** - * 事件级别. - */ - public enum LogLevel { - TRACE, DEBUG, INFO, WARN, ERROR - } -} diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/AllEventTests.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/AllEventTests.java index 044847cf5b..f821350d1e 100644 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/AllEventTests.java +++ b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/AllEventTests.java @@ -27,7 +27,6 @@ @RunWith(Suite.class) @Suite.SuiteClasses({ - JobTraceEventTest.class, JobExecutionEventTest.class, JobEventBusTest.class, JobEventRdbIdentityTest.class, diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/JobTraceEventTest.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/JobTraceEventTest.java deleted file mode 100644 index a90caacea5..0000000000 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/JobTraceEventTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 1999-2015 dangdang.com. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *

- */ - -package com.dangdang.ddframe.job.event; - -import com.dangdang.ddframe.job.event.type.JobTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent.LogLevel; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.startsWith; -import static org.hamcrest.MatcherAssert.assertThat; - -public final class JobTraceEventTest { - - @Test - public void assertGetFailureCause() { - assertThat(new JobTraceEvent("test_job", LogLevel.INFO, "ok", new RuntimeException(new IllegalArgumentException("illegal argument"))).getFailureCause(), - startsWith("java.lang.RuntimeException: java.lang.IllegalArgumentException: illegal argument")); - } -} diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/fixture/TestJobEventListener.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/fixture/TestJobEventListener.java index 0aa5eb47d5..8ff42b0f6c 100644 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/fixture/TestJobEventListener.java +++ b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/fixture/TestJobEventListener.java @@ -20,30 +20,17 @@ import com.dangdang.ddframe.job.event.JobEventListener; import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import lombok.Getter; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public final class TestJobEventListener extends TestJobEventIdentity implements JobEventListener { - @Getter - private static volatile boolean traceEventCalled; - @Getter private static volatile boolean executionEventCalled; - @Getter - private static volatile boolean statusTraceEventCalled; - private final JobEventCaller jobEventCaller; - @Override - public void listen(final JobTraceEvent traceEvent) { - jobEventCaller.call(); - traceEventCalled = true; - } - @Override public void listen(final JobExecutionEvent jobExecutionEvent) { jobEventCaller.call(); @@ -51,14 +38,11 @@ public void listen(final JobExecutionEvent jobExecutionEvent) { } @Override - public void listen(JobStatusTraceEvent jobStatusTraceEvent) { + public void listen(final JobStatusTraceEvent jobStatusTraceEvent) { jobEventCaller.call(); - statusTraceEventCalled = true; } public static void reset() { - traceEventCalled = false; executionEventCalled = false; - statusTraceEventCalled = false; } } diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfigurationTest.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfigurationTest.java index e2d24786a3..e8460e61df 100644 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfigurationTest.java +++ b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbConfigurationTest.java @@ -17,7 +17,6 @@ package com.dangdang.ddframe.job.event.rdb; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import org.junit.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -28,12 +27,11 @@ public final class JobEventRdbConfigurationTest { @Test public void assertCreateJobEventListenerSuccess() { - assertThat( - new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:job_event_storage", "sa", "", JobTraceEvent.LogLevel.INFO).createJobEventListener(), instanceOf(JobEventRdbListener.class)); + assertThat(new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:job_event_storage", "sa", "").createJobEventListener(), instanceOf(JobEventRdbListener.class)); } @Test public void assertCreateJobEventListenerFailure() { - assertNull(new JobEventRdbConfiguration("", "", "", "", JobTraceEvent.LogLevel.INFO).createJobEventListener()); + assertNull(new JobEventRdbConfiguration("", "", "", "").createJobEventListener()); } } diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListenerTest.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListenerTest.java index d13170ee5a..22b4a67556 100644 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListenerTest.java +++ b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbListenerTest.java @@ -21,8 +21,6 @@ import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent; import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent.State; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent.LogLevel; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -51,19 +49,12 @@ public final class JobEventRdbListenerTest { @Before public void setUp() throws SQLException, NoSuchFieldException { - JobEventRdbListener jobEventRdbListener = new JobEventRdbListener(new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:job_event_storage", "sa", "", JobTraceEvent.LogLevel.INFO)); + JobEventRdbListener jobEventRdbListener = new JobEventRdbListener(new JobEventRdbConfiguration("org.h2.Driver", "jdbc:h2:mem:job_event_storage", "sa", "")); ReflectionUtils.setFieldValue(jobEventRdbListener, "repository", repository); when(jobEventRdbConfiguration.createJobEventListener()).thenReturn(jobEventRdbListener); jobEventBus = new JobEventBus(jobEventRdbConfiguration); } - @Test - public void assertPostJobTraceEvent() { - JobTraceEvent jobTraceEvent = new JobTraceEvent(JOB_NAME, LogLevel.INFO, "ok"); - jobEventBus.post(jobTraceEvent); - verify(repository, atMost(1)).addJobTraceEvent(jobTraceEvent); - } - @Test public void assertPostJobExecutionEvent() { JobExecutionEvent jobExecutionEvent = new JobExecutionEvent("fake_task_id", JOB_NAME, JobExecutionEvent.ExecutionSource.NORMAL_TRIGGER, 0); diff --git a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorageTest.java b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorageTest.java index a9d7bfca3d..7045da7e39 100644 --- a/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorageTest.java +++ b/elastic-job-core/src/test/java/com/dangdang/ddframe/job/event/rdb/JobEventRdbStorageTest.java @@ -19,14 +19,11 @@ import com.dangdang.ddframe.job.event.type.JobExecutionEvent; import com.dangdang.ddframe.job.event.type.JobExecutionEvent.ExecutionSource; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; -import com.dangdang.ddframe.job.event.type.JobTraceEvent.LogLevel; import org.junit.Before; import org.junit.Test; import java.sql.SQLException; -import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertTrue; import static org.hamcrest.CoreMatchers.startsWith; @@ -38,23 +35,7 @@ public class JobEventRdbStorageTest { @Before public void setup() throws SQLException { - storage = new JobEventRdbStorage(org.h2.Driver.class.getName(), "jdbc:h2:mem:job_event_storage", "sa", "", LogLevel.INFO); - } - - @Test - public void assertAddJobTraceEvent() throws SQLException { - assertTrue(storage.addJobTraceEvent(new JobTraceEvent("test_job", LogLevel.WARN, "message"))); - } - - @Test - public void assertAddJobTraceEventWhenFailure() throws SQLException { - assertFalse(storage.addJobTraceEvent(new JobTraceEvent("test_job", LogLevel.DEBUG, "message", new Exception("failure")))); - } - - @Test - public void assertAddTraceLogWithLogLevel() throws SQLException { - JobEventRdbStorage rdbStorage = new JobEventRdbStorage(org.h2.Driver.class.getName(), "jdbc:h2:mem:job_event_storage", "sa", "", LogLevel.INFO); - assertFalse(rdbStorage.addJobTraceEvent(new JobTraceEvent("test_job", LogLevel.DEBUG, "message"))); + storage = new JobEventRdbStorage(org.h2.Driver.class.getName(), "jdbc:h2:mem:job_event_storage", "sa", ""); } @Test diff --git a/elastic-job-example/elastic-job-example-lite/src/main/java/com/dangdang/ddframe/job/example/JavaLiteJobMain.java b/elastic-job-example/elastic-job-example-lite/src/main/java/com/dangdang/ddframe/job/example/JavaLiteJobMain.java index ad82db37bf..a9eae171ef 100644 --- a/elastic-job-example/elastic-job-example-lite/src/main/java/com/dangdang/ddframe/job/example/JavaLiteJobMain.java +++ b/elastic-job-example/elastic-job-example-lite/src/main/java/com/dangdang/ddframe/job/example/JavaLiteJobMain.java @@ -23,7 +23,6 @@ import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration; import com.dangdang.ddframe.job.event.JobEventConfiguration; import com.dangdang.ddframe.job.event.rdb.JobEventRdbConfiguration; -import com.dangdang.ddframe.job.event.type.JobTraceEvent; import com.dangdang.ddframe.job.example.job.dataflow.JavaDataflowJob; import com.dangdang.ddframe.job.example.job.simple.JavaSimpleJob; import com.dangdang.ddframe.job.example.listener.SimpleDistributeListener; @@ -59,10 +58,8 @@ public final class JavaLiteJobMain { private static final String EVENT_RDB_STORAGE_PASSWORD = ""; - private static final JobTraceEvent.LogLevel EVENT_RDB_STORAGE_LOG_LEVEL = JobTraceEvent.LogLevel.INFO; - private static final Collection JOB_EVENT_CONFIGS = Collections.singletonList( - new JobEventRdbConfiguration(EVENT_RDB_STORAGE_DRIVER, EVENT_RDB_STORAGE_URL, EVENT_RDB_STORAGE_USERNAME, EVENT_RDB_STORAGE_PASSWORD, EVENT_RDB_STORAGE_LOG_LEVEL)); + new JobEventRdbConfiguration(EVENT_RDB_STORAGE_DRIVER, EVENT_RDB_STORAGE_URL, EVENT_RDB_STORAGE_USERNAME, EVENT_RDB_STORAGE_PASSWORD)); // CHECKSTYLE:OFF public static void main(final String[] args) throws Exception {