You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by lo...@apache.org on 2016/12/23 09:32:36 UTC
[1/6] incubator-rocketmq git commit: Improvement: Standardize build
script using maven wrapper.
Repository: incubator-rocketmq
Updated Branches:
refs/heads/master dd985d095 -> 774101da1
Improvement: Standardize build script using maven wrapper.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/a61a82d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/a61a82d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/a61a82d0
Branch: refs/heads/master
Commit: a61a82d05cb4e66eb91e955ad65a1f950bf6e3b4
Parents: b9bd59f
Author: lollipop <lo...@apache.org>
Authored: Fri Dec 23 10:42:22 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 10:42:22 2016 +0800
----------------------------------------------------------------------
deploy.bat | 16 ----------------
eclipse.bat | 16 ----------------
install.bat | 17 -----------------
install.sh | 28 ----------------------------
4 files changed, 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/a61a82d0/deploy.bat
----------------------------------------------------------------------
diff --git a/deploy.bat b/deploy.bat
deleted file mode 100644
index 9cc3dae..0000000
--- a/deploy.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-mvn -Dmaven.test.skip=true deploy
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/a61a82d0/eclipse.bat
----------------------------------------------------------------------
diff --git a/eclipse.bat b/eclipse.bat
deleted file mode 100644
index 24e7313..0000000
--- a/eclipse.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-mvn -U eclipse:eclipse
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/a61a82d0/install.bat
----------------------------------------------------------------------
diff --git a/install.bat b/install.bat
deleted file mode 100644
index 550f4b0..0000000
--- a/install.bat
+++ /dev/null
@@ -1,17 +0,0 @@
-REM Licensed to the Apache Software Foundation (ASF) under one or more
-REM contributor license agreements. See the NOTICE file distributed with
-REM this work for additional information regarding copyright ownership.
-REM The ASF licenses this file to You under the Apache License, Version 2.0
-REM (the "License"); you may not use this file except in compliance with
-REM the License. You may obtain a copy of the License at
-REM
-REM http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing, software
-REM distributed under the License is distributed on an "AS IS" BASIS,
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-REM See the License for the specific language governing permissions and
-REM limitations under the License.
-
-mvn -Dmaven.test.skip=true clean package install assembly:assembly -U
-
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/a61a82d0/install.sh
----------------------------------------------------------------------
diff --git a/install.sh b/install.sh
deleted file mode 100755
index 6a536ed..0000000
--- a/install.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-git pull
-
-rm -rf target
-rm -f devenv
-if [ -z "$JAVA_HOME" ]; then
- JAVA_HOME=/usr/java
-fi
-export PATH=$JAVA_HOME/bin:$PATH
-mvn clean package install assembly:assembly -U
-
-ln -s target/alibaba-rocketmq-broker/alibaba-rocketmq devenv
[4/6] incubator-rocketmq git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-rocketmq
Posted by lo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-rocketmq
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/c92332e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/c92332e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/c92332e1
Branch: refs/heads/master
Commit: c92332e18e408a039b3489f45c390a6aeaf10bb2
Parents: 0014a4c 4b446d7
Author: lollipop <lo...@apache.org>
Authored: Fri Dec 23 16:27:56 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 16:27:56 2016 +0800
----------------------------------------------------------------------
pom.xml | 8 +-
.../rocketmq/broker/BrokerControllerTest.java | 53 +++++++++++++
.../alibaba/rocketmq/client/ValidatorsTest.java | 18 ++---
rocketmq-store/pom.xml | 18 ++++-
.../alibaba/rocketmq/store/ha/HAService.java | 28 ++++---
.../rocketmq/store/DefaultMessageStoreTest.java | 78 +++++++++++--------
.../rocketmq/store/MappedFileQueueTest.java | 59 ++++++--------
.../alibaba/rocketmq/store/MappedFileTest.java | 82 ++++++++++----------
.../com/alibaba/rocketmq/store/RecoverTest.java | 3 +-
.../rocketmq/store/StoreCheckpointTest.java | 35 ++++-----
.../rocketmq/store/index/IndexFileTest.java | 61 ++++++---------
.../src/test/resources/logback-test.xml | 34 ++++++++
12 files changed, 277 insertions(+), 200 deletions(-)
----------------------------------------------------------------------
[6/6] incubator-rocketmq git commit: MASTER [ROCKETMQ-3] Clean up and
perfect the unit test of rocketmq-broker closes apache/incubator-rocketmq#7
Posted by lo...@apache.org.
MASTER [ROCKETMQ-3] Clean up and perfect the unit test of rocketmq-broker closes apache/incubator-rocketmq#7
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/774101da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/774101da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/774101da
Branch: refs/heads/master
Commit: 774101da10125a158cb0ab8943a73526b18cee4c
Parents: 07b3cd1
Author: dongeforever <zh...@yeah.net>
Authored: Fri Dec 23 17:15:39 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 17:15:39 2016 +0800
----------------------------------------------------------------------
pom.xml | 1 -
.../rocketmq/broker/BrokerTestHarness.java | 74 +++++++++++++++++
.../rocketmq/broker/api/SendMessageTest.java | 84 ++++++++++----------
.../offset/ConsumerOffsetManagerTest.java | 63 +++++++--------
.../broker/topic/TopicConfigManagerTest.java | 49 +++++-------
.../src/test/resources/logback-test.xml | 33 ++++++++
6 files changed, 199 insertions(+), 105 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index decb352..fa4a0be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -242,7 +242,6 @@
<exclude>com/alibaba/rocketmq/common/protocol/MQProtosHelperTest.java</exclude>
<exclude>com/alibaba/rocketmq/client/consumer/loadbalance/AllocateMessageQueueAveragelyTest.java</exclude>
<exclude>com/alibaba/rocketmq/store/RecoverTest.java</exclude>
- <exclude>com/alibaba/rocketmq/broker/api/SendMessageTest.java</exclude>
</excludes>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerTestHarness.java
----------------------------------------------------------------------
diff --git a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerTestHarness.java b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerTestHarness.java
new file mode 100644
index 0000000..ca6f17b
--- /dev/null
+++ b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/BrokerTestHarness.java
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+/**
+ * $Id: SendMessageTest.java 1831 2013-05-16 01:39:51Z shijia.wxr $
+ */
+package com.alibaba.rocketmq.broker;
+
+import com.alibaba.rocketmq.common.BrokerConfig;
+import com.alibaba.rocketmq.remoting.netty.NettyClientConfig;
+import com.alibaba.rocketmq.remoting.netty.NettyServerConfig;
+import com.alibaba.rocketmq.store.config.MessageStoreConfig;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Random;
+
+/**
+ * @author zander
+ */
+public class BrokerTestHarness {
+
+ protected BrokerController brokerController = null;
+
+ protected Random random = new Random();
+ public final String BROKER_NAME = "TestBrokerName";
+ protected String brokerAddr = "";
+ protected Logger logger = LoggerFactory.getLogger(BrokerTestHarness.class);
+ protected BrokerConfig brokerConfig = new BrokerConfig();
+ protected NettyServerConfig nettyServerConfig = new NettyServerConfig();
+ protected NettyClientConfig nettyClientConfig = new NettyClientConfig();
+ protected MessageStoreConfig storeConfig = new MessageStoreConfig();
+
+ @Before
+ public void startup() throws Exception {
+ brokerConfig.setBrokerName(BROKER_NAME);
+ brokerConfig.setBrokerIP1("127.0.0.1");
+ storeConfig.setStorePathRootDir(System.getProperty("user.home") + File.separator + "unitteststore");
+ storeConfig.setStorePathCommitLog(System.getProperty("user.home") + File.separator + "unitteststore" + File.separator + "commitlog");
+ nettyServerConfig.setListenPort(10000 + random.nextInt(1000));
+ brokerAddr = brokerConfig.getBrokerIP1() + ":" + nettyServerConfig.getListenPort();
+ brokerController = new BrokerController(brokerConfig, nettyServerConfig, nettyClientConfig, storeConfig);
+ boolean initResult = brokerController.initialize();
+ Assert.assertTrue(initResult);
+ logger.info("Broker Start name:{} addr:{}", brokerConfig.getBrokerName(), brokerController.getBrokerAddr());
+ brokerController.start();
+ }
+
+ @After
+ public void shutdown() throws Exception {
+ if (brokerController != null) {
+ brokerController.shutdown();
+ }
+ //maybe need to clean the file store. But we do not suggest deleting anything.
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/api/SendMessageTest.java
----------------------------------------------------------------------
diff --git a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/api/SendMessageTest.java b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/api/SendMessageTest.java
index 34ebfa5..d9babc2 100644
--- a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/api/SendMessageTest.java
+++ b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/api/SendMessageTest.java
@@ -20,68 +20,68 @@
*/
package com.alibaba.rocketmq.broker.api;
-import com.alibaba.rocketmq.broker.BrokerController;
+import com.alibaba.rocketmq.broker.BrokerTestHarness;
+import com.alibaba.rocketmq.client.ClientConfig;
import com.alibaba.rocketmq.client.hook.SendMessageContext;
import com.alibaba.rocketmq.client.impl.CommunicationMode;
import com.alibaba.rocketmq.client.impl.MQClientAPIImpl;
import com.alibaba.rocketmq.client.producer.SendResult;
-import com.alibaba.rocketmq.common.BrokerConfig;
+import com.alibaba.rocketmq.client.producer.SendStatus;
import com.alibaba.rocketmq.common.MixAll;
import com.alibaba.rocketmq.common.message.Message;
import com.alibaba.rocketmq.common.message.MessageDecoder;
import com.alibaba.rocketmq.common.protocol.header.SendMessageRequestHeader;
import com.alibaba.rocketmq.remoting.netty.NettyClientConfig;
-import com.alibaba.rocketmq.remoting.netty.NettyServerConfig;
-import com.alibaba.rocketmq.store.config.MessageStoreConfig;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
+import static org.junit.Assert.*;
+
/**
- * @author shijia.wxr
+ * @author zander
*/
-public class SendMessageTest {
- @Test
- public void test_sendMessage() throws Exception {
- BrokerController brokerController = new BrokerController(//
- new BrokerConfig(), //
- new NettyServerConfig(), //
- new NettyClientConfig(), //
- new MessageStoreConfig());
- boolean initResult = brokerController.initialize();
- System.out.println("initialize " + initResult);
+public class SendMessageTest extends BrokerTestHarness{
- brokerController.start();
+ MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null, null, new ClientConfig());
+ String topic = "UnitTestTopic";
- MQClientAPIImpl client = new MQClientAPIImpl(new NettyClientConfig(), null, null, null);
+ @Before
+ @Override
+ public void startup() throws Exception {
+ super.startup();
client.start();
- for (int i = 0; i < 100; i++) {
- String topic = "UnitTestTopic_" + i % 3;
- Message msg = new Message(topic, "TAG1 TAG2", "100200300", ("Hello, Nice world\t" + i).getBytes());
- msg.setDelayTimeLevel(i % 3 + 1);
-
- try {
- SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
- requestHeader.setProducerGroup("abc");
- requestHeader.setTopic(msg.getTopic());
- requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC);
- requestHeader.setDefaultTopicQueueNums(4);
- requestHeader.setQueueId(i % 4);
- requestHeader.setSysFlag(0);
- requestHeader.setBornTimestamp(System.currentTimeMillis());
- requestHeader.setFlag(msg.getFlag());
- requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties()));
-
- SendResult result = client.sendMessage("127.0.0.1:10911", "brokerName", msg, requestHeader, 1000 * 5,
- CommunicationMode.SYNC, new SendMessageContext(), null);
- System.out.println(i + "\t" + result);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ }
+ @After
+ @Override
+ public void shutdown() throws Exception {
client.shutdown();
+ super.shutdown();
+ }
- brokerController.shutdown();
+ @Test
+ public void testSendSingle() throws Exception {
+ Message msg = new Message(topic, "TAG1 TAG2", "100200300", "body".getBytes());
+ try {
+ SendMessageRequestHeader requestHeader = new SendMessageRequestHeader();
+ requestHeader.setProducerGroup("abc");
+ requestHeader.setTopic(msg.getTopic());
+ requestHeader.setDefaultTopic(MixAll.DEFAULT_TOPIC);
+ requestHeader.setDefaultTopicQueueNums(4);
+ requestHeader.setQueueId(0);
+ requestHeader.setSysFlag(0);
+ requestHeader.setBornTimestamp(System.currentTimeMillis());
+ requestHeader.setFlag(msg.getFlag());
+ requestHeader.setProperties(MessageDecoder.messageProperties2String(msg.getProperties()));
+
+ SendResult result = client.sendMessage(brokerAddr, BROKER_NAME, msg, requestHeader, 1000 * 5,
+ CommunicationMode.SYNC, new SendMessageContext(), null);
+ assertTrue(result.getSendStatus() == SendStatus.SEND_OK);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
----------------------------------------------------------------------
diff --git a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/offset/ConsumerOffsetManagerTest.java b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
index 55844eb..94504a4 100644
--- a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
+++ b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/offset/ConsumerOffsetManagerTest.java
@@ -20,49 +20,46 @@
*/
package com.alibaba.rocketmq.broker.offset;
-import com.alibaba.rocketmq.broker.BrokerController;
-import com.alibaba.rocketmq.common.BrokerConfig;
-import com.alibaba.rocketmq.remoting.netty.NettyClientConfig;
-import com.alibaba.rocketmq.remoting.netty.NettyServerConfig;
-import com.alibaba.rocketmq.store.config.MessageStoreConfig;
+import com.alibaba.rocketmq.broker.BrokerTestHarness;
import org.junit.Test;
-import java.util.Random;
+import static org.junit.Assert.assertEquals;
/**
- * @author shijia.wxr
+ * @author zander
*/
-public class ConsumerOffsetManagerTest {
- @Test
- public void test_flushConsumerOffset() throws Exception {
- BrokerController brokerController = new BrokerController(//
- new BrokerConfig(), //
- new NettyServerConfig(), //
- new NettyClientConfig(), //
- new MessageStoreConfig());
- boolean initResult = brokerController.initialize();
- System.out.println("initialize " + initResult);
- brokerController.start();
+public class ConsumerOffsetManagerTest extends BrokerTestHarness{
+ @Test
+ public void testFlushConsumerOffset() throws Exception {
ConsumerOffsetManager consumerOffsetManager = new ConsumerOffsetManager(brokerController);
-
- Random random = new Random();
-
- for (int i = 0; i < 100; i++) {
- String group = "DIANPU_GROUP_" + i;
- for (int id = 0; id < 16; id++) {
- consumerOffsetManager.commitOffset(null, group, "TOPIC_A", id,
- random.nextLong() % 1024 * 1024 * 1024);
- consumerOffsetManager.commitOffset(null, group, "TOPIC_B", id,
- random.nextLong() % 1024 * 1024 * 1024);
- consumerOffsetManager.commitOffset(null, group, "TOPIC_C", id,
- random.nextLong() % 1024 * 1024 * 1024);
+ for (int i = 0; i < 10; i++) {
+ String group = "UNIT_TEST_GROUP_" + i;
+ for (int id = 0; id < 10; id++) {
+ consumerOffsetManager.commitOffset(null, group, "TOPIC_A", id, id + 100);
+ consumerOffsetManager.commitOffset(null, group, "TOPIC_B", id, id + 100);
+ consumerOffsetManager.commitOffset(null, group, "TOPIC_C", id, id + 100);
}
}
-
consumerOffsetManager.persist();
-
- brokerController.shutdown();
+ consumerOffsetManager.getOffsetTable().clear();
+ for (int i = 0; i < 10; i++) {
+ String group = "UNIT_TEST_GROUP_" + i;
+ for (int id = 0; id < 10; id++) {
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_A", id), -1);
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_B", id), -1);
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_B", id), -1);
+ }
+ }
+ consumerOffsetManager.load();
+ for (int i = 0; i < 10; i++) {
+ String group = "UNIT_TEST_GROUP_" + i;
+ for (int id = 0; id < 10; id++) {
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_A", id), id + 100);
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_B", id), id + 100);
+ assertEquals(consumerOffsetManager.queryOffset(group, "TOPIC_B", id), id + 100);
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/topic/TopicConfigManagerTest.java
----------------------------------------------------------------------
diff --git a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/topic/TopicConfigManagerTest.java b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/topic/TopicConfigManagerTest.java
index 9edd02e..7a6503f 100644
--- a/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/topic/TopicConfigManagerTest.java
+++ b/rocketmq-broker/src/test/java/com/alibaba/rocketmq/broker/topic/TopicConfigManagerTest.java
@@ -20,52 +20,43 @@
*/
package com.alibaba.rocketmq.broker.topic;
-import com.alibaba.rocketmq.broker.BrokerController;
-import com.alibaba.rocketmq.common.BrokerConfig;
+import com.alibaba.rocketmq.broker.BrokerTestHarness;
import com.alibaba.rocketmq.common.MixAll;
import com.alibaba.rocketmq.common.TopicConfig;
-import com.alibaba.rocketmq.remoting.netty.NettyClientConfig;
-import com.alibaba.rocketmq.remoting.netty.NettyServerConfig;
-import com.alibaba.rocketmq.store.config.MessageStoreConfig;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
/**
- * @author shijia.wxr
+ * @author zander
*/
-public class TopicConfigManagerTest {
+public class TopicConfigManagerTest extends BrokerTestHarness {
@Test
- public void test_flushTopicConfig() throws Exception {
- BrokerController brokerController = new BrokerController(//
- new BrokerConfig(), //
- new NettyServerConfig(), //
- new NettyClientConfig(), //
- new MessageStoreConfig());
- boolean initResult = brokerController.initialize();
- System.out.println("initialize " + initResult);
- brokerController.start();
-
+ public void testFlushTopicConfig() throws Exception {
TopicConfigManager topicConfigManager = new TopicConfigManager(brokerController);
- TopicConfig topicConfig =
- topicConfigManager.createTopicInSendMessageMethod("TestTopic_SEND", MixAll.DEFAULT_TOPIC,
- null, 4, 0);
- assertTrue(topicConfig != null);
-
- System.out.println(topicConfig);
-
for (int i = 0; i < 10; i++) {
String topic = "UNITTEST-" + i;
- topicConfig =
- topicConfigManager
- .createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0);
+ TopicConfig topicConfig = topicConfigManager.createTopicInSendMessageMethod(topic, MixAll.DEFAULT_TOPIC, null, 4, 0);
assertTrue(topicConfig != null);
}
-
topicConfigManager.persist();
- brokerController.shutdown();
+ topicConfigManager.getTopicConfigTable().clear();
+
+ for (int i = 0; i < 10; i++) {
+ String topic = "UNITTEST-" + i;
+ TopicConfig topicConfig = topicConfigManager.selectTopicConfig(topic);
+ assertTrue(topicConfig == null);
+ }
+ topicConfigManager.load();
+ for (int i = 0; i < 10; i++) {
+ String topic = "UNITTEST-" + i;
+ TopicConfig topicConfig = topicConfigManager.selectTopicConfig(topic);
+ assertTrue(topicConfig != null);
+ assertTrue(topicConfig.getTopicSysFlag() == 0);
+ assertTrue(topicConfig.getReadQueueNums() == 4);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/774101da/rocketmq-broker/src/test/resources/logback-test.xml
----------------------------------------------------------------------
diff --git a/rocketmq-broker/src/test/resources/logback-test.xml b/rocketmq-broker/src/test/resources/logback-test.xml
new file mode 100644
index 0000000..3481c93
--- /dev/null
+++ b/rocketmq-broker/src/test/resources/logback-test.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+
+<configuration>
+
+ <appender name="DefaultAppender" class="ch.qos.logback.core.ConsoleAppender">
+ <append>true</append>
+ <encoder>
+ <pattern>%d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n</pattern>
+ <charset class="java.nio.charset.Charset">UTF-8</charset>
+ </encoder>
+ </appender>
+
+ <root>
+ <level value="OFF"/>
+ <appender-ref ref="DefaultAppender"/>
+ </root>
+</configuration>
[3/6] incubator-rocketmq git commit: Step 2: Add BUILDING document.
Posted by lo...@apache.org.
Step 2: Add BUILDING document.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/0014a4c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/0014a4c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/0014a4c8
Branch: refs/heads/master
Commit: 0014a4c8abd1ead27d64c50c65887a033ef79128
Parents: e9b4ce6
Author: lollipop <lo...@apache.org>
Authored: Fri Dec 23 13:56:30 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 13:56:30 2016 +0800
----------------------------------------------------------------------
BUILDING | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/0014a4c8/BUILDING
----------------------------------------------------------------------
diff --git a/BUILDING b/BUILDING
index 8914fe9..a5ed798 100644
--- a/BUILDING
+++ b/BUILDING
@@ -32,6 +32,6 @@ Then, import to eclipse by specifying the root directory of the project via:
(4) Building packages
-Execute the following command in order to build the tar.gz packages and install them to the local repository:
+Execute the following command in order to build the tar.gz packages and install JAR to the local repository:
$ mvn clean package install assembly:assembly -U
\ No newline at end of file
[5/6] incubator-rocketmq git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-rocketmq into unit-test
Posted by lo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-rocketmq into unit-test
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/07b3cd1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/07b3cd1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/07b3cd1b
Branch: refs/heads/master
Commit: 07b3cd1b48a59c6059b46ac350b96d1f77b91bc2
Parents: c92332e dd985d0
Author: lollipop <lo...@apache.org>
Authored: Fri Dec 23 17:11:04 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 17:11:04 2016 +0800
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/6] incubator-rocketmq git commit: Step 2: Add BUILDING document.
Posted by lo...@apache.org.
Step 2: Add BUILDING document.
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/e9b4ce63
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/e9b4ce63
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/e9b4ce63
Branch: refs/heads/master
Commit: e9b4ce632240c7bf1f55b65cd6a9c6fc83c5b54c
Parents: a61a82d
Author: lollipop <lo...@apache.org>
Authored: Fri Dec 23 13:54:39 2016 +0800
Committer: lollipop <lo...@apache.org>
Committed: Fri Dec 23 13:54:39 2016 +0800
----------------------------------------------------------------------
BUILDING | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/e9b4ce63/BUILDING
----------------------------------------------------------------------
diff --git a/BUILDING b/BUILDING
new file mode 100644
index 0000000..8914fe9
--- /dev/null
+++ b/BUILDING
@@ -0,0 +1,37 @@
+Build instructions for RocketMQ
+
+====================================================
+
+(1) Requisites
+
+JDK 1.7+ is required in order to compile and run RocketMQ.
+
+RocketMQ utilizes Maven as a distribution management and packaging tool. Version 3.0.3 or later is required.
+Maven installation and configuration instructions can be found here:
+
+http://maven.apache.org/run-maven/index.html
+
+
+(2) Executing test cases
+
+Execute the following command in order to compile and test the components:
+
+$ mvn test
+
+
+(3) Importing projects to eclipse
+
+First, generate eclipse project files:
+
+$ mvn -U eclipse:eclipse
+
+Then, import to eclipse by specifying the root directory of the project via:
+
+[File] > [Import] > [Existing Projects into Workspace].
+
+
+(4) Building packages
+
+Execute the following command in order to build the tar.gz packages and install them to the local repository:
+
+$ mvn clean package install assembly:assembly -U
\ No newline at end of file