diff --git a/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java b/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java index 797e0d882a2600d436a38a2f6c5ba9c40e3fc31b..56abf084a7c48ba277c1eec0a27794fc9934d161 100644 --- a/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java +++ b/broker/src/test/java/org/apache/rocketmq/broker/BrokerControllerTest.java @@ -17,6 +17,7 @@ package org.apache.rocketmq.broker; +import java.io.File; import org.apache.rocketmq.common.BrokerConfig; import org.apache.rocketmq.common.UtilAll; import org.apache.rocketmq.remoting.netty.NettyClientConfig; @@ -25,16 +26,10 @@ import org.apache.rocketmq.store.config.MessageStoreConfig; import org.junit.After; import org.junit.Test; -import java.io.File; - import static org.assertj.core.api.Assertions.assertThat; public class BrokerControllerTest { - /** - * Tests if the controller can be properly stopped and started. - * - * @throws Exception If fails. - */ + @Test public void testBrokerRestart() throws Exception { BrokerController brokerController = new BrokerController( @@ -48,7 +43,7 @@ public class BrokerControllerTest { } @After - public void destory() { + public void destroy() { UtilAll.deleteFile(new File(new MessageStoreConfig().getStorePathRootDir())); } } diff --git a/logappender/src/test/java/org/apache/rocketmq/logappender/Log4jTest.java b/logappender/src/test/java/org/apache/rocketmq/logappender/Log4jTest.java index c139283a0c95d5af574b778d2d20fa786efd76b8..cf99c6937f49d58a8ebd2c56b9ef5abdddb891bc 100644 --- a/logappender/src/test/java/org/apache/rocketmq/logappender/Log4jTest.java +++ b/logappender/src/test/java/org/apache/rocketmq/logappender/Log4jTest.java @@ -17,7 +17,6 @@ package org.apache.rocketmq.logappender; import org.apache.log4j.Logger; -import org.apache.rocketmq.client.exception.MQClientException; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -30,7 +29,7 @@ public abstract class Log4jTest extends AbstractTestCase { public abstract String getType(); @Test - public void testLog4j() throws InterruptedException, MQClientException { + public void testLog4j() { clear(); Logger logger = Logger.getLogger("testLogger"); for (int i = 0; i < 10; i++) { diff --git a/logappender/src/test/java/org/apache/rocketmq/logappender/LogbackTest.java b/logappender/src/test/java/org/apache/rocketmq/logappender/LogbackTest.java index d7ec184a4b79fb450974570293207734d7423116..3dc18f0dccfaf819cbd6a073e7c70f19c297014f 100644 --- a/logappender/src/test/java/org/apache/rocketmq/logappender/LogbackTest.java +++ b/logappender/src/test/java/org/apache/rocketmq/logappender/LogbackTest.java @@ -20,15 +20,13 @@ import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.util.StatusPrinter; -import org.apache.rocketmq.client.exception.MQClientException; +import java.io.File; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; - public class LogbackTest extends AbstractTestCase { @Before @@ -42,7 +40,7 @@ public class LogbackTest extends AbstractTestCase { } @Test - public void testLogback() throws InterruptedException, MQClientException { + public void testLogback() { clear(); Logger logger = LoggerFactory.getLogger("testLogger"); for (int i = 0; i < 10; i++) { diff --git a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShuwDownTest.java b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShutDownTest.java similarity index 95% rename from store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShuwDownTest.java rename to store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShutDownTest.java index ac85d59f1c7473c0a30c8979a34dfd9ebc930a5d..ee0c365ea3ad5d025f54a06c6f087a97ec0629d7 100644 --- a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShuwDownTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreShutDownTest.java @@ -35,7 +35,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) -public class DefaultMessageStoreShuwDownTest { +public class DefaultMessageStoreShutdownTest { private DefaultMessageStore messageStore; @Before @@ -48,7 +48,7 @@ public class DefaultMessageStoreShuwDownTest { } @Test - public void testDispatchBehindWhenShutDown() { + public void testDispatchBehindWhenShutdown() { messageStore.shutdown(); assertTrue(!messageStore.shutDownNormal); File file = new File(StorePathConfigHelper.getAbortFile(messageStore.getMessageStoreConfig().getStorePathRootDir())); @@ -56,7 +56,7 @@ public class DefaultMessageStoreShuwDownTest { } @After - public void destory() { + public void destroy() { messageStore.destroy(); File file = new File(messageStore.getMessageStoreConfig().getStorePathRootDir()); UtilAll.deleteFile(file); diff --git a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java index 9269cdfa77268b90574270e99f34d440191d89b8..a400ed5a5a7e818527645d6b409fee27a326320b 100644 --- a/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java +++ b/store/src/test/java/org/apache/rocketmq/store/DefaultMessageStoreTest.java @@ -59,7 +59,6 @@ public class DefaultMessageStoreTest { @Test(expected = OverlappingFileLockException.class) public void test_repate_restart() throws Exception { - long totalMsgs = 100; QUEUE_TOTAL = 1; MessageBody = StoreMessage.getBytes(); @@ -92,7 +91,7 @@ public class DefaultMessageStoreTest { UtilAll.deleteFile(file); } - public MessageStore buildMessageStore() throws Exception { + private MessageStore buildMessageStore() throws Exception { MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); messageStoreConfig.setMapedFileSizeCommitLog(1024 * 1024 * 10); messageStoreConfig.setMapedFileSizeConsumeQueue(1024 * 1024 * 10); @@ -103,8 +102,8 @@ public class DefaultMessageStoreTest { } @Test - public void testWriteAndRead() throws Exception { - long totalMsgs = 100; + public void testWriteAndRead() { + long totalMsgs = 10; QUEUE_TOTAL = 1; MessageBody = StoreMessage.getBytes(); for (long i = 0; i < totalMsgs; i++) { @@ -119,7 +118,7 @@ public class DefaultMessageStoreTest { verifyThatMasterIsFunctional(totalMsgs, messageStore); } - public MessageExtBrokerInner buildMessage() { + private MessageExtBrokerInner buildMessage() { MessageExtBrokerInner msg = new MessageExtBrokerInner(); msg.setTopic("FooBar"); msg.setTags("TAG1"); @@ -134,23 +133,6 @@ public class DefaultMessageStoreTest { return msg; } - @Test - public void testGroupCommit() throws Exception { - long totalMsgs = 10; - QUEUE_TOTAL = 1; - MessageBody = StoreMessage.getBytes(); - for (long i = 0; i < totalMsgs; i++) { - messageStore.putMessage(buildMessage()); - } - - for (long i = 0; i < totalMsgs; i++) { - GetMessageResult result = messageStore.getMessage("GROUP_A", "TOPIC_A", 0, i, 1024 * 1024, null); - assertThat(result).isNotNull(); - result.release(); - } - verifyThatMasterIsFunctional(totalMsgs, messageStore); - } - private void verifyThatMasterIsFunctional(long totalMsgs, MessageStore master) { for (long i = 0; i < totalMsgs; i++) { master.putMessage(buildMessage());