unit-test-extern
diff --git a/include/CCommon.h b/include/CCommon.h
index 63615d5..8b7136b 100644
--- a/include/CCommon.h
+++ b/include/CCommon.h
@@ -22,10 +22,10 @@
 extern "C" {
 #endif
 
-#define  MAX_MESSAGE_ID_LENGTH 256
-#define  MAX_TOPIC_LENGTH 512
-#define  MAX_BROKER_NAME_ID_LENGTH 256
-typedef enum _CStatus_{
+#define MAX_MESSAGE_ID_LENGTH 256
+#define MAX_TOPIC_LENGTH 512
+#define MAX_BROKER_NAME_ID_LENGTH 256
+typedef enum _CStatus_ {
     // Success
     OK = 0,
     // Failed, null pointer value
@@ -36,7 +36,7 @@
     PRODUCER_SEND_SYNC_FAILED = 11,
     PRODUCER_SEND_ONEWAY_FAILED = 12,
     PRODUCER_SEND_ORDERLY_FAILED = 13,
-	PRODUCER_SEND_ASYNC_FAILED = 14,
+    PRODUCER_SEND_ASYNC_FAILED = 14,
 
     PUSHCONSUMER_ERROR_CODE_START = 20,
     PUSHCONSUMER_START_FAILED = 20,
@@ -47,7 +47,7 @@
     PULLCONSUMER_FETCH_MESSAGE_FAILED = 32
 } CStatus;
 
-typedef enum _CLogLevel_{
+typedef enum _CLogLevel_ {
     E_LOG_LEVEL_FATAL = 1,
     E_LOG_LEVEL_ERROR = 2,
     E_LOG_LEVEL_WARN = 3,
@@ -75,12 +75,9 @@
 #define ROCKETMQCLIENT_API
 #endif
 
-typedef enum _CMessageModel_{
-    BROADCASTING,
-    CLUSTERING
-} CMessageModel;
+typedef enum _CMessageModel_ { BROADCASTING, CLUSTERING } CMessageModel;
 
 #ifdef __cplusplus
 };
 #endif
-#endif //__C_COMMON_H__
+#endif  //__C_COMMON_H__
diff --git a/include/MQClientException.h b/include/MQClientException.h
index 0adb805..85749f1 100755
--- a/include/MQClientException.h
+++ b/include/MQClientException.h
@@ -17,73 +17,65 @@
 #ifndef __MQCLIENTEXCEPTION_H__
 #define __MQCLIENTEXCEPTION_H__
 
+#include <string.h>
 #include <exception>
 #include <ostream>
 #include <sstream>
 #include <string>
-#include <string.h>
-#include "RocketMQClient.h"
 #include "CCommon.h"
-
+#include "RocketMQClient.h"
 
 namespace rocketmq {
 //<!***************************************************************************
 class ROCKETMQCLIENT_API MQException : public std::exception {
-
- public:
-  MQException(const std::string& msg, int error, const char* file,
-              int line) throw()
-      : m_error(error), m_line(line), m_file(file) {
-    try {
-      std::stringstream ss;
-      ss << "msg: " << msg << ",error:" << error << ",in file <" << file
-         << "> line:" << line;
-      m_msg = ss.str();
-    } catch (...) {
+   public:
+    MQException(const std::string &msg, int error, const char *file, int line) throw()
+        : m_error(error), m_line(line), m_file(file) {
+        try {
+            std::stringstream ss;
+            ss << "msg: " << msg << ",error:" << error << ",in file <" << file << "> line:" << line;
+            m_msg = ss.str();
+        } catch (...) {
+        }
     }
-  }
 
-  MQException(const std::string& msg, int error, const char* file,
-              const char* type, int line) throw()
-      : m_error(error), m_line(line), m_file(file), m_type(type) {
-    try {
-      std::stringstream ss;
-      ss << "msg: " << msg << ",error:" << error << ",in file <" << file
-         << "> line:" << line;
-      m_msg = ss.str();
-    } catch (...) {
+    MQException(const std::string &msg, int error, const char *file, const char *type, int line) throw()
+        : m_error(error), m_line(line), m_file(file), m_type(type) {
+        try {
+            std::stringstream ss;
+            ss << "msg: " << msg << ",error:" << error << ",in file <" << file << "> line:" << line;
+            m_msg = ss.str();
+        } catch (...) {
+        }
     }
-  }
-  
-  virtual ~MQException() throw() {}
-  const char* what() const throw() { return m_msg.c_str(); }
-  int GetError() const throw() { return m_error; }
-  virtual const char* GetType() const throw() { return m_type.c_str(); }
-  int GetLine() { return m_line;}
-  const char* GetFile()  { return m_file.c_str(); }
 
- protected:
-  int m_error;
-  int m_line;
-  std::string m_msg;
-  std::string m_file;
-  std::string m_type;
+    virtual ~MQException() throw() {}
+    const char *what() const throw() { return m_msg.c_str(); }
+    int GetError() const throw() { return m_error; }
+    virtual const char *GetType() const throw() { return m_type.c_str(); }
+    int GetLine() { return m_line; }
+    const char *GetFile() { return m_file.c_str(); }
+
+   protected:
+    int m_error;
+    int m_line;
+    std::string m_msg;
+    std::string m_file;
+    std::string m_type;
 };
 
-
-inline std::ostream& operator<<(std::ostream& os, const MQException& e) {
-  os << "Type: " << e.GetType() << " , " << e.what();
-  return os;
+inline std::ostream &operator<<(std::ostream &os, const MQException &e) {
+    os << "Type: " << e.GetType() << " , " << e.what();
+    return os;
 }
 
-#define DEFINE_MQCLIENTEXCEPTION(name)                                     \
-  class ROCKETMQCLIENT_API name : public MQException {                     \
-   public:                                                                 \
-    name(const std::string& msg, int error, const char* file,              \
-         int line) throw()                                                 \
-        : MQException(msg, error, file, #name, line) {}                    \
-    virtual const char* GetType() const throw() { return m_type.c_str(); } \
-  };
+#define DEFINE_MQCLIENTEXCEPTION(name)                                              \
+    class ROCKETMQCLIENT_API name : public MQException {                            \
+       public:                                                                      \
+        name(const std::string &msg, int error, const char *file, int line) throw() \
+            : MQException(msg, error, file, #name, line) {}                         \
+        virtual const char *GetType() const throw() { return m_type.c_str(); }      \
+    };
 
 DEFINE_MQCLIENTEXCEPTION(MQClientException)
 DEFINE_MQCLIENTEXCEPTION(MQBrokerException)
@@ -95,5 +87,5 @@
 #define NEW_MQEXCEPTION(e, msg, err) e(msg, err, __FILE__, __LINE__)
 
 //<!***************************************************************************
-}  //<!end namespace;
+}  // namespace rocketmq
 #endif
diff --git a/include/MQMessage.h b/include/MQMessage.h
index 2ea30f4..ef2ba10 100755
--- a/include/MQMessage.h
+++ b/include/MQMessage.h
@@ -23,112 +23,117 @@
 #include <vector>
 #include "RocketMQClient.h"
 
-
 namespace rocketmq {
 //<!***************************************************************************
 class ROCKETMQCLIENT_API MQMessage {
- public:
-  MQMessage();
-  MQMessage(const std::string& topic, const std::string& body);
-  MQMessage(const std::string& topic, const std::string& tags, const std::string& body);
-  MQMessage(const std::string& topic, const std::string& tags, const std::string& keys,
-            const std::string& body);
-  MQMessage(const std::string& topic, const std::string& tags, const std::string& keys,
-            const int flag, const std::string& body, bool waitStoreMsgOK);
+   public:
+    MQMessage();
+    MQMessage(const std::string &topic, const std::string &body);
+    MQMessage(const std::string &topic, const std::string &tags, const std::string &body);
+    MQMessage(const std::string &topic, const std::string &tags, const std::string &keys, const std::string &body);
+    MQMessage(const std::string &topic,
+              const std::string &tags,
+              const std::string &keys,
+              const int flag,
+              const std::string &body,
+              bool waitStoreMsgOK);
 
-  virtual ~MQMessage();
-  MQMessage(const MQMessage& other);
-  MQMessage& operator=(const MQMessage& other);
+    virtual ~MQMessage();
+    MQMessage(const MQMessage &other);
+    MQMessage &operator=(const MQMessage &other);
 
-  void setProperty(const std::string& name, const std::string& value) ;
-  const std::string & getProperty(const std::string& name) const;
+    void setProperty(const std::string &name, const std::string &value);
+    const std::string &getProperty(const std::string &name) const;
 
-  const std::string &getTopic() const;
-  void setTopic(const std::string& topic);
-  void setTopic(const char* body, int len);
+    const std::string &getTopic() const;
+    void setTopic(const std::string &topic);
+    void setTopic(const char *body, int len);
 
-  const std::string &getTags() const;
-  void setTags(const std::string& tags);
+    const std::string &getTags() const;
+    void setTags(const std::string &tags);
 
-  const std::string &getKeys() const;
-  void setKeys(const std::string& keys);
-  void setKeys(const std::vector<std::string>& keys);
+    const std::string &getKeys() const;
+    void setKeys(const std::string &keys);
+    void setKeys(const std::vector<std::string> &keys);
 
-  int getDelayTimeLevel() const;
-  void setDelayTimeLevel(int level);
+    int getDelayTimeLevel() const;
+    void setDelayTimeLevel(int level);
 
-  bool isWaitStoreMsgOK();
-  void setWaitStoreMsgOK(bool waitStoreMsgOK);
+    bool isWaitStoreMsgOK();
+    void setWaitStoreMsgOK(bool waitStoreMsgOK);
 
-  int getFlag() const;
-  void setFlag(int flag);
+    int getFlag() const;
+    void setFlag(int flag);
 
-  int getSysFlag() const;
-  void setSysFlag(int sysFlag);
+    int getSysFlag() const;
+    void setSysFlag(int sysFlag);
 
-  const std::string &getBody() const;
+    const std::string &getBody() const;
 
-  void setBody(const char* body, int len);
-  void setBody(const std::string& body);
+    void setBody(const char *body, int len);
+    void setBody(const std::string &body);
 
-  std::map<std::string, std::string> getProperties() const;
-  void setProperties(std::map<std::string, std::string>& properties);
+    std::map<std::string, std::string> getProperties() const;
+    void setProperties(std::map<std::string, std::string> &properties);
 
-  const std::string toString() const {
-    std::stringstream ss;
-    std::string tags = getTags();
-    ss << "Message [topic=" << m_topic << ", flag=" << m_flag
-       << ", tag=" << tags << "]";
-    return ss.str();
-  }
+    const std::string toString() const {
+        std::stringstream ss;
+        std::string tags = getTags();
+        ss << "Message [topic=" << m_topic << ", flag=" << m_flag << ", tag=" << tags << "]";
+        return ss.str();
+    }
 
- protected:
-  friend class MQDecoder;
-  void setPropertyInternal(const std::string& name, const std::string& value);
-  void setPropertiesInternal(std::map<std::string, std::string>& properties);
+   protected:
+    friend class MQDecoder;
+    void setPropertyInternal(const std::string &name, const std::string &value);
+    void setPropertiesInternal(std::map<std::string, std::string> &properties);
 
-  void Init(const std::string& topic, const std::string& tags, const std::string& keys,
-            const int flag, const std::string& body, bool waitStoreMsgOK);
+    void Init(const std::string &topic,
+              const std::string &tags,
+              const std::string &keys,
+              const int flag,
+              const std::string &body,
+              bool waitStoreMsgOK);
 
- public:
-  static const std::string PROPERTY_KEYS;
-  static const std::string PROPERTY_TAGS;
-  static const std::string PROPERTY_WAIT_STORE_MSG_OK;
-  static const std::string PROPERTY_DELAY_TIME_LEVEL;
-  static const std::string PROPERTY_RETRY_TOPIC;
-  static const std::string PROPERTY_REAL_TOPIC;
-  static const std::string PROPERTY_REAL_QUEUE_ID;
-  static const std::string PROPERTY_TRANSACTION_PREPARED;
-  static const std::string PROPERTY_PRODUCER_GROUP;
-  static const std::string PROPERTY_MIN_OFFSET;
-  static const std::string PROPERTY_MAX_OFFSET;
-  
-  static const std::string PROPERTY_BUYER_ID;
-  static const std::string PROPERTY_ORIGIN_MESSAGE_ID;
-  static const std::string PROPERTY_TRANSFER_FLAG;
-  static const std::string PROPERTY_CORRECTION_FLAG;
-  static const std::string PROPERTY_MQ2_FLAG;
-  static const std::string PROPERTY_RECONSUME_TIME;
-  static const std::string PROPERTY_MSG_REGION;
-  static const std::string PROPERTY_TRACE_SWITCH;
-  static const std::string PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX;
-  static const std::string PROPERTY_MAX_RECONSUME_TIMES;
-  static const std::string PROPERTY_CONSUME_START_TIMESTAMP;
-  static const std::string PROPERTY_TRANSACTION_PREPARED_QUEUE_OFFSET;
-  static const std::string PROPERTY_TRANSACTION_CHECK_TIMES;
-  static const std::string PROPERTY_CHECK_IMMUNITY_TIME_IN_SECONDS;
+   public:
+    static const std::string PROPERTY_KEYS;
+    static const std::string PROPERTY_TAGS;
+    static const std::string PROPERTY_WAIT_STORE_MSG_OK;
+    static const std::string PROPERTY_DELAY_TIME_LEVEL;
+    static const std::string PROPERTY_RETRY_TOPIC;
+    static const std::string PROPERTY_REAL_TOPIC;
+    static const std::string PROPERTY_REAL_QUEUE_ID;
+    static const std::string PROPERTY_TRANSACTION_PREPARED;
+    static const std::string PROPERTY_PRODUCER_GROUP;
+    static const std::string PROPERTY_MIN_OFFSET;
+    static const std::string PROPERTY_MAX_OFFSET;
 
-  static const std::string KEY_SEPARATOR;
+    static const std::string PROPERTY_BUYER_ID;
+    static const std::string PROPERTY_ORIGIN_MESSAGE_ID;
+    static const std::string PROPERTY_TRANSFER_FLAG;
+    static const std::string PROPERTY_CORRECTION_FLAG;
+    static const std::string PROPERTY_MQ2_FLAG;
+    static const std::string PROPERTY_RECONSUME_TIME;
+    static const std::string PROPERTY_MSG_REGION;
+    static const std::string PROPERTY_TRACE_SWITCH;
+    static const std::string PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX;
+    static const std::string PROPERTY_MAX_RECONSUME_TIMES;
+    static const std::string PROPERTY_CONSUME_START_TIMESTAMP;
+    static const std::string PROPERTY_TRANSACTION_PREPARED_QUEUE_OFFSET;
+    static const std::string PROPERTY_TRANSACTION_CHECK_TIMES;
+    static const std::string PROPERTY_CHECK_IMMUNITY_TIME_IN_SECONDS;
 
- protected:
-  int m_sysFlag;
+    static const std::string KEY_SEPARATOR;
 
- private:
-  std::string m_topic;
-  int m_flag;
-  std::string m_body;
-  std::map<std::string, std::string> m_properties;
+   protected:
+    int m_sysFlag;
+
+   private:
+    std::string m_topic;
+    int m_flag;
+    std::string m_body;
+    std::map<std::string, std::string> m_properties;
 };
 //<!***************************************************************************
-}  //<!end namespace;
+}  // namespace rocketmq
 #endif
diff --git a/test/src/UrlTest.cpp b/test/src/UrlTest.cpp
index c9d929a..b347e22 100644
--- a/test/src/UrlTest.cpp
+++ b/test/src/UrlTest.cpp
@@ -15,63 +15,62 @@
  * limitations under the License.
  */
 
-#include "url.h"
+#include <stdio.h>
+#include <unistd.h>
+#include "CCommon.h"
+#include "CMQException.h"
+#include "CMessage.h"
+#include "CProducer.h"
+#include "CSendResult.h"
 #include "TopicConfig.h"
-#include "gtest/gtest.h"
 #include "gmock/gmock.h"
-#include "CProducer.h"
-#include "CCommon.h"
-#include "CMessage.h"
-#include "CSendResult.h"
-#include "CMQException.h"
-#include <unistd.h>
-#include <stdio.h>
+#include "gtest/gtest.h"
+#include "url.h"
 
 #include <stdio.h>
 
-#include "CProducer.h"
-#include "CCommon.h"
-#include "CMessage.h"
-#include "CSendResult.h"
-#include "CMQException.h"
 #include <unistd.h>
+#include "CCommon.h"
+#include "CMQException.h"
+#include "CMessage.h"
+#include "CProducer.h"
+#include "CSendResult.h"
 
 using namespace std;
-using ::testing::InitGoogleTest;
-using ::testing::InitGoogleMock;
-using testing::Return;
-using rocketmq::Url;
 using rocketmq::TopicConfig;
+using rocketmq::Url;
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Return;
 
-class MockTopicConfig : public  TopicConfig{
-public:
-    MOCK_METHOD0(getReadQueueNums , int());
+class MockTopicConfig : public TopicConfig {
+   public:
+    MOCK_METHOD0(getReadQueueNums, int());
 };
 
 TEST(Url, Url) {
     Url url_s("172.17.0.2:9876");
-    EXPECT_EQ(url_s.protocol_ , "172.17.0.2:9876");
+    EXPECT_EQ(url_s.protocol_, "172.17.0.2:9876");
 
     Url url_z("https://www.aliyun.com/RocketMQ?5.0");
-    EXPECT_EQ(url_z.protocol_ , "https");
-    EXPECT_EQ(url_z.host_ , "www.aliyun.com");
-    EXPECT_EQ(url_z.port_ , "80");
-    EXPECT_EQ(url_z.path_ , "/RocketMQ");
-    EXPECT_EQ(url_z.query_ , "5.0");
+    EXPECT_EQ(url_z.protocol_, "https");
+    EXPECT_EQ(url_z.host_, "www.aliyun.com");
+    EXPECT_EQ(url_z.port_, "80");
+    EXPECT_EQ(url_z.path_, "/RocketMQ");
+    EXPECT_EQ(url_z.query_, "5.0");
 
     Url url_path("https://www.aliyun.com:9876/RocketMQ?5.0");
-    EXPECT_EQ(url_path.port_ , "9876");
+    EXPECT_EQ(url_path.port_, "9876");
     MockTopicConfig topicConfig;
-    EXPECT_CALL(topicConfig , getReadQueueNums()).WillRepeatedly(Return(-1));
+    EXPECT_CALL(topicConfig, getReadQueueNums()).WillRepeatedly(Return(-1));
     int nums = topicConfig.getReadQueueNums();
     cout << nums << endl;
 }
 
-
-
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
     InitGoogleMock(&argc, argv);
-	testing::GTEST_FLAG(filter) = "Url.Url";
-	int itestts = RUN_ALL_TESTS();;
+    testing::GTEST_FLAG(filter) = "Url.Url";
+    int itestts = RUN_ALL_TESTS();
+    ;
     return itestts;
 }
diff --git a/test/src/extern/CMessageExtTest.cpp b/test/src/extern/CMessageExtTest.cpp
new file mode 100644
index 0000000..77ed338
--- /dev/null
+++ b/test/src/extern/CMessageExtTest.cpp
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "CCommon.h"
+#include "CMessageExt.h"
+#include "MQMessageExt.h"
+
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Return;
+
+using rocketmq::MQMessageExt;
+
+TEST(cmessageExt, info) {
+    MQMessageExt *mqMessageExt = new MQMessageExt();
+    CMessageExt *messageExt = (CMessageExt *) mqMessageExt;
+
+    mqMessageExt->setTopic("testTopic");
+    EXPECT_EQ(GetMessageTopic(messageExt), mqMessageExt->getTopic());
+
+    mqMessageExt->setTags("testTags");
+    EXPECT_EQ(GetMessageTags(messageExt), mqMessageExt->getTags());
+
+    mqMessageExt->setKeys("testKeys");
+    EXPECT_EQ(GetMessageKeys(messageExt), mqMessageExt->getKeys());
+
+    mqMessageExt->setBody("testBody");
+    EXPECT_EQ(GetMessageBody(messageExt), mqMessageExt->getBody());
+
+    mqMessageExt->setProperty("testKey", "testValues");
+    EXPECT_EQ(GetMessageProperty(messageExt, "testKey"), mqMessageExt->getProperty("testKey"));
+
+    mqMessageExt->setMsgId("msgId123456");
+    EXPECT_EQ(GetMessageId(messageExt), mqMessageExt->getMsgId());
+
+    mqMessageExt->setDelayTimeLevel(1);
+    EXPECT_EQ(GetMessageDelayTimeLevel(messageExt), mqMessageExt->getDelayTimeLevel());
+
+    mqMessageExt->setQueueId(4);
+    EXPECT_EQ(GetMessageQueueId(messageExt), mqMessageExt->getQueueId());
+
+    mqMessageExt->setReconsumeTimes(1234567);
+    EXPECT_EQ(GetMessageReconsumeTimes(messageExt), mqMessageExt->getReconsumeTimes());
+
+    mqMessageExt->setStoreSize(127);
+    EXPECT_EQ(GetMessageStoreSize(messageExt), mqMessageExt->getStoreSize());
+
+    mqMessageExt->setBornTimestamp(9876543);
+    EXPECT_EQ(GetMessageBornTimestamp(messageExt), mqMessageExt->getBornTimestamp());
+
+    mqMessageExt->setStoreTimestamp(123123);
+    EXPECT_EQ(GetMessageStoreTimestamp(messageExt), mqMessageExt->getStoreTimestamp());
+
+    mqMessageExt->setQueueOffset(1024);
+    EXPECT_EQ(GetMessageQueueOffset(messageExt), mqMessageExt->getQueueOffset());
+
+    mqMessageExt->setCommitLogOffset(2048);
+    EXPECT_EQ(GetMessageCommitLogOffset(messageExt), mqMessageExt->getCommitLogOffset());
+
+    mqMessageExt->setPreparedTransactionOffset(4096);
+    EXPECT_EQ(GetMessagePreparedTransactionOffset(messageExt), mqMessageExt->getPreparedTransactionOffset());
+}
+
+TEST(cmessageExt, null) {
+    EXPECT_TRUE(GetMessageTopic(NULL) == NULL);
+    EXPECT_TRUE(GetMessageTags(NULL) == NULL);
+    EXPECT_TRUE(GetMessageKeys(NULL) == NULL);
+    EXPECT_TRUE(GetMessageBody(NULL) == NULL);
+    EXPECT_TRUE(GetMessageProperty(NULL, NULL) == NULL);
+    EXPECT_TRUE(GetMessageId(NULL) == NULL);
+    EXPECT_EQ(GetMessageDelayTimeLevel(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageQueueId(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageReconsumeTimes(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageStoreSize(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageBornTimestamp(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageStoreTimestamp(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageQueueOffset(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessageCommitLogOffset(NULL), NULL_POINTER);
+    EXPECT_EQ(GetMessagePreparedTransactionOffset(NULL), NULL_POINTER);
+}
+
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
+    testing::GTEST_FLAG(filter) = "cmessageExt.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
+}
diff --git a/test/src/extern/CMessageTest.cpp b/test/src/extern/CMessageTest.cpp
new file mode 100644
index 0000000..51c40cb
--- /dev/null
+++ b/test/src/extern/CMessageTest.cpp
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "CCommon.h"
+#include "CMessage.h"
+#include "MQMessage.h"
+
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Return;
+
+using rocketmq::MQMessage;
+
+TEST(cmessages, info) {
+    CMessage *message = CreateMessage(NULL);
+    MQMessage *mqMessage = (MQMessage *) message;
+    EXPECT_EQ(mqMessage->getTopic(), "");
+
+    SetMessageTopic(message, "testTopic");
+    EXPECT_EQ(mqMessage->getTopic(), "testTopic");
+
+    SetMessageTags(message, "testTags");
+    EXPECT_EQ(mqMessage->getTags(), "testTags");
+
+    SetMessageKeys(message, "testKeys");
+    EXPECT_EQ(mqMessage->getKeys(), "testKeys");
+
+    SetMessageBody(message, "testBody");
+    EXPECT_EQ(mqMessage->getBody(), "testBody");
+
+    SetByteMessageBody(message, "testBody", 5);
+    EXPECT_EQ(mqMessage->getBody(), "testB");
+
+    SetMessageProperty(message, "testKey", "testValue");
+    EXPECT_EQ(mqMessage->getProperty("testKey"), "testValue");
+
+    SetDelayTimeLevel(message, 1);
+    EXPECT_EQ(mqMessage->getDelayTimeLevel(), 1);
+
+    EXPECT_EQ(DestroyMessage(message), OK);
+
+    CMessage *twomessage = CreateMessage("testTwoTopic");
+    MQMessage *twoMqMessage = (MQMessage *) twomessage;
+    EXPECT_EQ(twoMqMessage->getTopic(), "testTwoTopic");
+
+    EXPECT_EQ(DestroyMessage(twomessage), OK);
+}
+
+TEST(cmessages, null) {
+    EXPECT_EQ(SetMessageTopic(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetMessageTags(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetMessageKeys(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetMessageBody(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetByteMessageBody(NULL, NULL, 0), NULL_POINTER);
+    EXPECT_EQ(SetMessageProperty(NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetDelayTimeLevel(NULL, NULL), NULL_POINTER);
+}
+
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
+
+    testing::GTEST_FLAG(filter) = "cmessages.null";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
+}
diff --git a/test/src/extern/CProducerTest.cpp b/test/src/extern/CProducerTest.cpp
new file mode 100644
index 0000000..1c38d72
--- /dev/null
+++ b/test/src/extern/CProducerTest.cpp
@@ -0,0 +1,229 @@
+/*
+ * 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.
+ */
+#include "string.h"
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "CMessage.h"
+#include "CProducer.h"
+#include "CSendResult.h"
+
+#include "AsyncCallback.h"
+#include "DefaultMQProducer.h"
+#include "MQMessage.h"
+#include "MQMessageQueue.h"
+#include "MQSelector.h"
+#include "SendResult.h"
+#include "SessionCredentials.h"
+
+using std::string;
+
+using ::testing::_;
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Mock;
+using testing::Return;
+
+using rocketmq::DefaultMQProducer;
+using rocketmq::elogLevel;
+using rocketmq::MessageQueueSelector;
+using rocketmq::MQMessage;
+using rocketmq::MQMessageQueue;
+using rocketmq::SendCallback;
+using rocketmq::SendResult;
+using rocketmq::SendStatus;
+using rocketmq::SessionCredentials;
+
+class MockDefaultMQProducer : public DefaultMQProducer {
+   public:
+    MockDefaultMQProducer(const string &groupname) : DefaultMQProducer(groupname) {}
+    MOCK_METHOD0(start, void());
+    MOCK_METHOD0(shutdown, void());
+    MOCK_METHOD2(setLogFileSizeAndNum, void(int, long));
+    MOCK_METHOD1(SetProducerLogLevel, void(elogLevel));
+    MOCK_METHOD2(send, SendResult(MQMessage &, bool));
+    MOCK_METHOD3(send, void(MQMessage &, SendCallback *, bool));
+    MOCK_METHOD2(sendOneway, void(MQMessage &, bool));
+    MOCK_METHOD5(send, SendResult(MQMessage &, MessageQueueSelector *, void *, int, bool));
+};
+
+TEST(cProducer, SendMessageAsync) {
+    MockDefaultMQProducer *mockProducer = new MockDefaultMQProducer("testGroup");
+    CProducer *cProducer = (CProducer *) mockProducer;
+    CMessage *msg = (CMessage *) new MQMessage();
+
+    CSendSuccessCallback cSendSuccessCallback;
+    CSendExceptionCallback cSendExceptionCallback;
+
+    EXPECT_EQ(SendMessageAsync(NULL, NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageAsync(cProducer, NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageAsync(cProducer, msg, cSendSuccessCallback, NULL), NULL_POINTER);
+
+    EXPECT_CALL(*mockProducer, send(_, _)).Times(1);
+    EXPECT_EQ(SendMessageAsync(cProducer, msg, cSendSuccessCallback, cSendExceptionCallback), OK);
+    Mock::AllowLeak(mockProducer);
+}
+
+TEST(cProducer, sendMessageOrderly) {
+    MockDefaultMQProducer *mockProducer = new MockDefaultMQProducer("testGroup");
+    CProducer *cProducer = (CProducer *) mockProducer;
+    CMessage *msg = (CMessage *) new MQMessage();
+    CSendResult *result;
+    MQMessageQueue messageQueue;
+    QueueSelectorCallback callback;
+
+    EXPECT_EQ(SendMessageOrderly(NULL, NULL, NULL, msg, 1, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageOrderly(cProducer, NULL, NULL, msg, 1, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageOrderly(cProducer, msg, NULL, msg, 1, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageOrderly(cProducer, msg, callback, NULL, 1, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageOrderly(cProducer, msg, callback, msg, 1, NULL), NULL_POINTER);
+
+    EXPECT_CALL(*mockProducer, send(_, _, _, _, _))
+        .WillOnce(Return(SendResult(SendStatus::SEND_OK, "3", "offset1", messageQueue, 14)));
+    // EXPECT_EQ(SendMessageOrderly(cProducer, msg, callback, msg, 1, result), OK);
+    Mock::AllowLeak(mockProducer);
+}
+
+TEST(cProducer, sendOneway) {
+    MockDefaultMQProducer *mockProducer = new MockDefaultMQProducer("testGroup");
+    CProducer *cProducer = (CProducer *) mockProducer;
+    CMessage *msg = (CMessage *) new MQMessage();
+
+    EXPECT_EQ(SendMessageOneway(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageOneway(cProducer, NULL), NULL_POINTER);
+
+    EXPECT_CALL(*mockProducer, sendOneway(_, _)).Times(1);
+    EXPECT_EQ(SendMessageOneway(cProducer, msg), OK);
+    Mock::AllowLeak(mockProducer);
+}
+
+TEST(cProducer, sendMessageSync) {
+    MockDefaultMQProducer *mockProducer = new MockDefaultMQProducer("testGroup");
+    CProducer *cProducer = (CProducer *) mockProducer;
+
+    CMessage *msg = (CMessage *) new MQMessage();
+    CSendResult *result;
+    MQMessageQueue messageQueue;
+    EXPECT_EQ(SendMessageSync(NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SendMessageSync(cProducer, NULL, NULL), NULL_POINTER);
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, NULL), NULL_POINTER);
+
+    result = (CSendResult *) malloc(sizeof(CSendResult));
+
+    EXPECT_CALL(*mockProducer, send(_, _))
+        .Times(5)
+        .WillOnce(Return(SendResult(SendStatus::SEND_FLUSH_DISK_TIMEOUT, "1", "offset1", messageQueue, 14)))
+        .WillOnce(Return(SendResult(SendStatus::SEND_FLUSH_SLAVE_TIMEOUT, "2", "offset1", messageQueue, 14)))
+        .WillOnce(Return(SendResult(SendStatus::SEND_SLAVE_NOT_AVAILABLE, "3", "offset1", messageQueue, 14)))
+        .WillOnce(Return(SendResult(SendStatus::SEND_OK, "3", "offset1", messageQueue, 14)))
+        .WillOnce(Return(SendResult((SendStatus) -1, "4", "offset1", messageQueue, 14)));
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, result), OK);
+    EXPECT_EQ(result->sendStatus, E_SEND_FLUSH_DISK_TIMEOUT);
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, result), OK);
+    EXPECT_EQ(result->sendStatus, E_SEND_FLUSH_SLAVE_TIMEOUT);
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, result), OK);
+    EXPECT_EQ(result->sendStatus, E_SEND_SLAVE_NOT_AVAILABLE);
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, result), OK);
+    EXPECT_EQ(result->sendStatus, E_SEND_OK);
+
+    EXPECT_EQ(SendMessageSync(cProducer, msg, result), OK);
+    EXPECT_EQ(result->sendStatus, E_SEND_OK);
+    Mock::AllowLeak(mockProducer);
+}
+
+TEST(cProducer, infoMock) {
+    MockDefaultMQProducer *mockProducer = new MockDefaultMQProducer("testGroup");
+    CProducer *cProducer = (CProducer *) mockProducer;
+
+    EXPECT_CALL(*mockProducer, start()).Times(1);
+    EXPECT_EQ(StartProducer(cProducer), OK);
+
+    EXPECT_CALL(*mockProducer, shutdown()).Times(1);
+    EXPECT_EQ(ShutdownProducer(cProducer), OK);
+
+    EXPECT_CALL(*mockProducer, setLogFileSizeAndNum(_, _)).Times(1);
+    EXPECT_EQ(SetProducerLogFileNumAndSize(cProducer, 1, 1), OK);
+
+    EXPECT_CALL(*mockProducer, SetProducerLogLevel(_)).Times(1);
+    EXPECT_EQ(SetProducerLogLevel(cProducer, E_LOG_LEVEL_FATAL), OK);
+    Mock::AllowLeak(mockProducer);
+}
+
+TEST(cProducer, info) {
+    CProducer *cProducer = CreateProducer("groupTest");
+    DefaultMQProducer *defaultMQProducer = (DefaultMQProducer *) cProducer;
+    EXPECT_TRUE(cProducer != NULL);
+    EXPECT_EQ(defaultMQProducer->getGroupName(), "groupTest");
+
+    EXPECT_EQ(SetProducerNameServerAddress(cProducer, "127.0.0.1:9876"), OK);
+    EXPECT_EQ(defaultMQProducer->getNamesrvAddr(), "127.0.0.1:9876");
+
+    EXPECT_EQ(SetProducerNameServerDomain(cProducer, "domain"), OK);
+    EXPECT_EQ(defaultMQProducer->getNamesrvDomain(), "domain");
+
+    EXPECT_EQ(SetProducerGroupName(cProducer, "testGroup"), OK);
+    EXPECT_EQ(defaultMQProducer->getGroupName(), "testGroup");
+
+    EXPECT_EQ(SetProducerInstanceName(cProducer, "instance"), OK);
+    EXPECT_EQ(defaultMQProducer->getInstanceName(), "instance");
+
+    EXPECT_EQ(SetProducerSendMsgTimeout(cProducer, 1), OK);
+    EXPECT_EQ(defaultMQProducer->getSendMsgTimeout(), 1);
+
+    EXPECT_EQ(SetProducerMaxMessageSize(cProducer, 2), OK);
+    EXPECT_EQ(defaultMQProducer->getMaxMessageSize(), 2);
+
+    EXPECT_EQ(SetProducerCompressLevel(cProducer, 1), OK);
+    EXPECT_EQ(defaultMQProducer->getCompressLevel(), 1);
+
+    EXPECT_EQ(SetProducerSessionCredentials(NULL, NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerSessionCredentials(cProducer, "accessKey", "secretKey", "channel"), OK);
+    SessionCredentials sessionCredentials = defaultMQProducer->getSessionCredentials();
+    EXPECT_EQ(sessionCredentials.getAccessKey(), "accessKey");
+    Mock::AllowLeak(defaultMQProducer);
+}
+
+TEST(cProducer, null) {
+    EXPECT_TRUE(CreateProducer(NULL) == NULL);
+    EXPECT_EQ(StartProducer(NULL), NULL_POINTER);
+    EXPECT_EQ(ShutdownProducer(NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerNameServerAddress(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerNameServerDomain(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerGroupName(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerInstanceName(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerSessionCredentials(NULL, NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetProducerLogLevel(NULL, E_LOG_LEVEL_FATAL), NULL_POINTER);
+    EXPECT_EQ(SetProducerSendMsgTimeout(NULL, 1), NULL_POINTER);
+    EXPECT_EQ(SetProducerCompressLevel(NULL, 1), NULL_POINTER);
+    EXPECT_EQ(SetProducerMaxMessageSize(NULL, 2), NULL_POINTER);
+    EXPECT_EQ(SetProducerLogLevel(NULL, E_LOG_LEVEL_FATAL), NULL_POINTER);
+    EXPECT_EQ(DestroyProducer(NULL), NULL_POINTER);
+}
+
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
+    testing::GTEST_FLAG(throw_on_failure) = true;
+    testing::GTEST_FLAG(filter) = "cProducer.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
+}
diff --git a/test/src/extern/CPullConsumerTest.cpp b/test/src/extern/CPullConsumerTest.cpp
new file mode 100644
index 0000000..6a1118d
--- /dev/null
+++ b/test/src/extern/CPullConsumerTest.cpp
@@ -0,0 +1,211 @@
+/*
+ * 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.
+ */
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "CCommon.h"
+#include "CPullConsumer.h"
+
+#include "DefaultMQPullConsumer.h"
+#include "MQClient.h"
+#include "MQMessageExt.h"
+#include "MQMessageQueue.h"
+#include "PullResult.h"
+#include "SessionCredentials.h"
+
+using std::string;
+using std::vector;
+
+using ::testing::_;
+using testing::Expectation;
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Return;
+using testing::SetArgReferee;
+
+using rocketmq::DefaultMQPullConsumer;
+using rocketmq::elogLevel;
+using rocketmq::MessageModel;
+using rocketmq::MQMessageExt;
+using rocketmq::MQMessageQueue;
+using rocketmq::PullResult;
+using rocketmq::PullStatus;
+using rocketmq::SessionCredentials;
+
+class MockDefaultMQPullConsumer : public DefaultMQPullConsumer {
+   public:
+    MockDefaultMQPullConsumer(const string &groupname) : DefaultMQPullConsumer(groupname) {}
+    MOCK_METHOD0(start, void());
+    MOCK_METHOD0(shutdown, void());
+    MOCK_METHOD2(setLogFileSizeAndNum, void(int, long));
+    MOCK_METHOD1(setLogLevel, void(elogLevel));
+    MOCK_METHOD2(fetchSubscribeMessageQueues, void(const string &, vector<MQMessageQueue> &));
+    MOCK_METHOD4(pull, PullResult(const MQMessageQueue &, const string &, int64, int));
+};
+
+TEST(cpullConsumer, pull) {
+    MockDefaultMQPullConsumer *mqPullConsumer = new MockDefaultMQPullConsumer("groudId");
+    CPullConsumer *pullConsumer = (CPullConsumer *) mqPullConsumer;
+
+    CMessageQueue *cMessageQueue;
+    cMessageQueue = (CMessageQueue *) malloc(sizeof(CMessageQueue));
+    strncpy(cMessageQueue->topic, "testTopic", 8);
+    strncpy(cMessageQueue->brokerName, "testBroker", 9);
+    cMessageQueue->queueId = 1;
+
+    PullResult timeOutPullResult(PullStatus::BROKER_TIMEOUT, 1, 2, 3);
+
+    PullResult noNewMsgPullResult(PullStatus::NO_NEW_MSG, 1, 2, 3);
+
+    PullResult noMatchedMsgPullResult(PullStatus::NO_MATCHED_MSG, 1, 2, 3);
+
+    PullResult offsetIllegalPullResult(PullStatus::OFFSET_ILLEGAL, 1, 2, 3);
+
+    PullResult defaultPullResult((PullStatus) -1, 1, 2, 3);
+
+    vector<MQMessageExt> src;
+    for (int i = 0; i < 5; i++) {
+        MQMessageExt ext;
+        src.push_back(ext);
+    }
+
+    PullResult foundPullResult(PullStatus::FOUND, 1, 2, 3, src);
+
+    EXPECT_CALL(*mqPullConsumer, pull(_, _, _, _))
+        .WillOnce(Return(timeOutPullResult))
+        .WillOnce(Return(noNewMsgPullResult))
+        .WillOnce(Return(noMatchedMsgPullResult))
+        .WillOnce(Return(offsetIllegalPullResult))
+        .WillOnce(Return(defaultPullResult))
+        /*.WillOnce(Return(timeOutPullResult))*/.WillOnce(Return(foundPullResult));
+
+    CPullResult timeOutcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(timeOutcPullResult.pullStatus, E_BROKER_TIMEOUT);
+
+    CPullResult noNewMsgcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(noNewMsgcPullResult.pullStatus, E_NO_NEW_MSG);
+
+    CPullResult noMatchedMsgcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(noMatchedMsgcPullResult.pullStatus, E_NO_MATCHED_MSG);
+
+    CPullResult offsetIllegalcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(offsetIllegalcPullResult.pullStatus, E_OFFSET_ILLEGAL);
+
+    CPullResult defaultcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(defaultcPullResult.pullStatus, E_NO_NEW_MSG);
+
+    CPullResult exceptionPullResult = Pull(pullConsumer, cMessageQueue, NULL, 0, 0);
+    EXPECT_EQ(exceptionPullResult.pullStatus, E_BROKER_TIMEOUT);
+
+    CPullResult foundcPullResult = Pull(pullConsumer, cMessageQueue, "123123", 0, 0);
+    EXPECT_EQ(foundcPullResult.pullStatus, E_FOUND);
+
+    delete mqPullConsumer;
+}
+
+TEST(cpullConsumer, infoMock) {
+    MockDefaultMQPullConsumer *mqPullConsumer = new MockDefaultMQPullConsumer("groudId");
+    CPullConsumer *pullConsumer = (CPullConsumer *) mqPullConsumer;
+
+    Expectation exp = EXPECT_CALL(*mqPullConsumer, start()).Times(1);
+    EXPECT_EQ(StartPullConsumer(pullConsumer), OK);
+
+    EXPECT_CALL(*mqPullConsumer, shutdown()).Times(1);
+    EXPECT_EQ(ShutdownPullConsumer(pullConsumer), OK);
+
+    // EXPECT_CALL(*mqPullConsumer,setLogFileSizeAndNum(_,_)).Times(1);
+    EXPECT_EQ(SetPullConsumerLogFileNumAndSize(pullConsumer, 1, 2), OK);
+
+    // EXPECT_CALL(*mqPullConsumer,setLogLevel(_)).Times(1);
+    EXPECT_EQ(SetPullConsumerLogLevel(pullConsumer, E_LOG_LEVEL_INFO), OK);
+
+    std::vector<MQMessageQueue> fullMQ;
+    for (int i = 0; i < 5; i++) {
+        MQMessageQueue queue("testTopic", "testsBroker", i);
+        fullMQ.push_back(queue);
+    }
+
+    EXPECT_CALL(*mqPullConsumer, fetchSubscribeMessageQueues(_, _)).Times(1).WillOnce(SetArgReferee<1>(fullMQ));
+    CMessageQueue *mqs = NULL;
+    int size = 0;
+    FetchSubscriptionMessageQueues(pullConsumer, "testTopic", &mqs, &size);
+    EXPECT_EQ(size, 5);
+
+    delete mqPullConsumer;
+}
+
+TEST(cpullConsumer, init) {
+    CPullConsumer *pullConsumer = CreatePullConsumer("testGroupId");
+    DefaultMQPullConsumer *defaultMQPullConsumer = (DefaultMQPullConsumer *) pullConsumer;
+    EXPECT_FALSE(pullConsumer == NULL);
+
+    EXPECT_EQ(SetPullConsumerGroupID(pullConsumer, "groupId"), OK);
+    EXPECT_EQ(GetPullConsumerGroupID(pullConsumer), defaultMQPullConsumer->getGroupName().c_str());
+
+    EXPECT_EQ(SetPullConsumerNameServerAddress(pullConsumer, "127.0.0.1:10091"), OK);
+    EXPECT_EQ(defaultMQPullConsumer->getNamesrvAddr(), "127.0.0.1:10091");
+
+    EXPECT_EQ(SetPullConsumerNameServerDomain(pullConsumer, "domain"), OK);
+    EXPECT_EQ(defaultMQPullConsumer->getNamesrvDomain(), "domain");
+
+    EXPECT_EQ(SetPullConsumerSessionCredentials(pullConsumer, "accessKey", "secretKey", "channel"), OK);
+    SessionCredentials sessionCredentials = defaultMQPullConsumer->getSessionCredentials();
+    EXPECT_EQ(sessionCredentials.getAccessKey(), "accessKey");
+
+    EXPECT_EQ(SetPullConsumerLogPath(pullConsumer, NULL), OK);
+
+    // EXPECT_EQ(SetPullConsumerLogFileNumAndSize(pullConsumer,NULL,NULL),NULL_POINTER);
+    EXPECT_EQ(SetPullConsumerLogLevel(pullConsumer, E_LOG_LEVEL_DEBUG), OK);
+}
+
+TEST(cpullConsumer, null) {
+    CPullConsumer *pullConsumer = CreatePullConsumer("testGroupId");
+    DefaultMQPullConsumer *defaultMQPullConsumer = (DefaultMQPullConsumer *) pullConsumer;
+    EXPECT_FALSE(pullConsumer == NULL);
+
+    EXPECT_EQ(SetPullConsumerGroupID(pullConsumer, "groupId"), OK);
+    EXPECT_EQ(GetPullConsumerGroupID(pullConsumer), defaultMQPullConsumer->getGroupName().c_str());
+
+    EXPECT_EQ(SetPullConsumerNameServerAddress(pullConsumer, "127.0.0.1:10091"), OK);
+    EXPECT_EQ(defaultMQPullConsumer->getNamesrvAddr(), "127.0.0.1:10091");
+
+    EXPECT_EQ(SetPullConsumerNameServerDomain(pullConsumer, "domain"), OK);
+    EXPECT_EQ(defaultMQPullConsumer->getNamesrvDomain(), "domain");
+
+    EXPECT_EQ(SetPullConsumerSessionCredentials(pullConsumer, "accessKey", "secretKey", "channel"), OK);
+    SessionCredentials sessionCredentials = defaultMQPullConsumer->getSessionCredentials();
+    EXPECT_EQ(sessionCredentials.getAccessKey(), "accessKey");
+
+    EXPECT_EQ(SetPullConsumerLogPath(pullConsumer, NULL), OK);
+    // EXPECT_EQ(SetPullConsumerLogFileNumAndSize(pullConsumer,NULL,NULL),NULL_POINTER);
+    EXPECT_EQ(SetPullConsumerLogLevel(pullConsumer, E_LOG_LEVEL_DEBUG), OK);
+    EXPECT_EQ(DestroyPullConsumer(pullConsumer), OK);
+    EXPECT_EQ(StartPullConsumer(NULL), NULL_POINTER);
+    EXPECT_EQ(ShutdownPullConsumer(NULL), NULL_POINTER);
+}
+
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
+    testing::GTEST_FLAG(throw_on_failure) = true;
+    testing::GTEST_FLAG(filter) = "cpullConsumer.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
+}
diff --git a/test/src/extern/CPushConsumerTest.cpp b/test/src/extern/CPushConsumerTest.cpp
new file mode 100644
index 0000000..54166fe
--- /dev/null
+++ b/test/src/extern/CPushConsumerTest.cpp
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+
+#include "string.h"
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "CPushConsumer.h"
+
+#include "ConsumeType.h"
+#include "DefaultMQPushConsumer.h"
+#include "MQMessageListener.h"
+#include "SessionCredentials.h"
+
+using std::string;
+
+using ::testing::_;
+using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
+using testing::Return;
+
+using rocketmq::DefaultMQPushConsumer;
+using rocketmq::elogLevel;
+using rocketmq::MessageListenerType;
+using rocketmq::MessageModel;
+using rocketmq::SessionCredentials;
+
+class MockDefaultMQPushConsumer : public DefaultMQPushConsumer {
+   public:
+    MockDefaultMQPushConsumer(const string &groupname) : DefaultMQPushConsumer(groupname) {}
+
+    MOCK_METHOD0(start, void());
+    MOCK_METHOD0(shutdown, void());
+    MOCK_METHOD2(setLogFileSizeAndNum, void(int, long));
+    MOCK_METHOD1(setLogLevel, void(elogLevel));
+};
+
+TEST(cPushComsumer, infomock) {
+    MockDefaultMQPushConsumer *pushComsumer = new MockDefaultMQPushConsumer("testGroup");
+    CPushConsumer *consumer = (CPushConsumer *) pushComsumer;
+
+    EXPECT_CALL(*pushComsumer, start()).Times(1);
+    EXPECT_EQ(StartPushConsumer(consumer), OK);
+
+    EXPECT_CALL(*pushComsumer, shutdown()).Times(1);
+    EXPECT_EQ(ShutdownPushConsumer(consumer), OK);
+
+    EXPECT_CALL(*pushComsumer, setLogFileSizeAndNum(1, 1)).Times(1);
+    pushComsumer->setLogFileSizeAndNum(1, 1);
+    EXPECT_EQ(SetPushConsumerLogFileNumAndSize(consumer, 1, 1), OK);
+
+    // EXPECT_CALL(*pushComsumer,setLogLevel(_)).Times(1);
+    EXPECT_EQ(SetPushConsumerLogLevel(consumer, E_LOG_LEVEL_FATAL), OK);
+
+    delete pushComsumer;
+}
+
+TEST(cPushComsumer, info) {
+    CPushConsumer *cpushConsumer = CreatePushConsumer("testGroup");
+    DefaultMQPushConsumer *mqPushConsumer = (DefaultMQPushConsumer *) cpushConsumer;
+
+    EXPECT_TRUE(cpushConsumer != NULL);
+    EXPECT_EQ(string(GetPushConsumerGroupID(cpushConsumer)), "testGroup");
+
+    EXPECT_EQ(SetPushConsumerGroupID(cpushConsumer, "testGroupTwo"), OK);
+    EXPECT_EQ(string(GetPushConsumerGroupID(cpushConsumer)), "testGroupTwo");
+
+    EXPECT_EQ(SetPushConsumerNameServerAddress(cpushConsumer, "127.0.0.1:9876"), OK);
+    EXPECT_EQ(mqPushConsumer->getNamesrvAddr(), "127.0.0.1:9876");
+
+    EXPECT_EQ(SetPushConsumerNameServerDomain(cpushConsumer, "domain"), OK);
+    EXPECT_EQ(mqPushConsumer->getNamesrvDomain(), "domain");
+
+    EXPECT_EQ(Subscribe(cpushConsumer, "testTopic", "testSub"), OK);
+
+    MessageCallBack pCallback;
+    EXPECT_EQ(RegisterMessageCallbackOrderly(cpushConsumer, pCallback), OK);
+    EXPECT_EQ(mqPushConsumer->getMessageListenerType(), MessageListenerType::messageListenerOrderly);
+
+    EXPECT_EQ(RegisterMessageCallback(cpushConsumer, pCallback), OK);
+    EXPECT_EQ(mqPushConsumer->getMessageListenerType(), MessageListenerType::messageListenerConcurrently);
+
+    EXPECT_EQ(UnregisterMessageCallbackOrderly(cpushConsumer), OK);
+    EXPECT_EQ(UnregisterMessageCallback(cpushConsumer), OK);
+
+    EXPECT_EQ(SetPushConsumerThreadCount(cpushConsumer, 10), OK);
+    EXPECT_EQ(mqPushConsumer->getConsumeThreadCount(), 10);
+
+    EXPECT_EQ(SetPushConsumerMessageBatchMaxSize(cpushConsumer, 1024), OK);
+    EXPECT_EQ(mqPushConsumer->getConsumeMessageBatchMaxSize(), 1024);
+
+    EXPECT_EQ(SetPushConsumerInstanceName(cpushConsumer, "instance"), OK);
+    EXPECT_EQ(mqPushConsumer->getInstanceName(), "instance");
+
+    EXPECT_EQ(SetPushConsumerSessionCredentials(cpushConsumer, "accessKey", "secretKey", "channel"), OK);
+    SessionCredentials sessionCredentials = mqPushConsumer->getSessionCredentials();
+    EXPECT_EQ(sessionCredentials.getAccessKey(), "accessKey");
+
+    EXPECT_EQ(SetPushConsumerMessageModel(cpushConsumer, BROADCASTING), OK);
+    EXPECT_EQ(mqPushConsumer->getMessageModel(), MessageModel::BROADCASTING);
+
+    // EXPECT_EQ(DestroyPushConsumer(cpushConsumer), OK);
+}
+
+TEST(cPushComsumer, null) {
+    CPushConsumer *cpushConsumer = CreatePushConsumer("testGroup");
+
+    EXPECT_TRUE(CreatePushConsumer(NULL) == NULL);
+    EXPECT_EQ(DestroyPushConsumer(NULL), NULL_POINTER);
+    EXPECT_EQ(StartPushConsumer(NULL), NULL_POINTER);
+    EXPECT_EQ(ShutdownPushConsumer(NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerGroupID(NULL, "testGroup"), NULL_POINTER);
+    EXPECT_TRUE(GetPushConsumerGroupID(NULL) == NULL);
+    EXPECT_EQ(SetPushConsumerNameServerAddress(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerNameServerDomain(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(Subscribe(NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(RegisterMessageCallbackOrderly(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(RegisterMessageCallbackOrderly(cpushConsumer, NULL), NULL_POINTER);
+    EXPECT_EQ(RegisterMessageCallback(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(UnregisterMessageCallbackOrderly(NULL), NULL_POINTER);
+    EXPECT_EQ(UnregisterMessageCallback(NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerThreadCount(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerMessageBatchMaxSize(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerInstanceName(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerSessionCredentials(NULL, NULL, NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerLogPath(NULL, NULL), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerLogFileNumAndSize(NULL, 1, 1), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerLogLevel(NULL, E_LOG_LEVEL_LEVEL_NUM), NULL_POINTER);
+    EXPECT_EQ(SetPushConsumerMessageModel(NULL, BROADCASTING), NULL_POINTER);
+}
+
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
+    testing::GTEST_FLAG(filter) = "cPushComsumer.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
+}
diff --git a/test/src/extern/CSendResultTest.cpp b/test/src/extern/CSendResultTest.cpp
new file mode 100644
index 0000000..dd88889
--- /dev/null
+++ b/test/src/extern/CSendResultTest.cpp
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+#include "gtest/gtest.h"
+#include "gmock/gmock.h"
+
+#include "SocketUtil.h"
+#include "TopicFilterType.h"
+#include "MessageSysFlag.h"
+#include "MQMessageExt.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::InitGoogleMock;
+using testing::Return;
+
+using rocketmq::MQMessageExt;
+
+
+
+
+TEST(messageExt, init){
+
+}
+
+
+int main(int argc, char* argv[]) {
+	InitGoogleMock(&argc, argv);
+	testing::GTEST_FLAG(throw_on_failure) = true;
+	testing::GTEST_FLAG(filter) = "messageExt.init";
+	int itestts = RUN_ALL_TESTS();
+	return itestts;
+}
diff --git a/test/src/message/MQDecoderTest.cpp b/test/src/message/MQDecoderTest.cpp
index 61195e6..4893200 100644
--- a/test/src/message/MQDecoderTest.cpp
+++ b/test/src/message/MQDecoderTest.cpp
@@ -14,195 +14,191 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "string.h"
 
 #include <stdio.h>
-#include <vector>
 #include <string>
-#include "gtest/gtest.h"
+#include <vector>
 #include "gmock/gmock.h"
+#include "gtest/gtest.h"
 
-#include "MemoryOutputStream.h"
 #include "MemoryInputStream.h"
+#include "MemoryOutputStream.h"
 
-#include "MessageSysFlag.h"
+#include "CommandHeader.h"
+#include "MQDecoder.h"
 #include "MQMessage.h"
 #include "MQMessageExt.h"
 #include "MQMessageId.h"
-#include "MQDecoder.h"
-#include "CommandHeader.h"
-#include "UtilAll.h"
+#include "MessageSysFlag.h"
 #include "RemotingCommand.h"
+#include "UtilAll.h"
 
 using namespace std;
 
-using ::testing::InitGoogleTest;
 using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
 using testing::Return;
 
+using rocketmq::MemoryBlock;
+using rocketmq::MemoryInputStream;
+using rocketmq::MemoryOutputStream;
 using rocketmq::MessageSysFlag;
+using rocketmq::MQDecoder;
 using rocketmq::MQMessage;
 using rocketmq::MQMessageExt;
 using rocketmq::MQMessageId;
-using rocketmq::MQDecoder;
-using rocketmq::SendMessageRequestHeader;
 using rocketmq::RemotingCommand;
+using rocketmq::SendMessageRequestHeader;
 using rocketmq::UtilAll;
-using rocketmq::MemoryInputStream;
-using rocketmq::MemoryOutputStream;
-using rocketmq::MemoryBlock;
 
-TEST(decoder, messageId) {
-	int host;
-	int port;
-	string msgIdStr = MQDecoder::createMessageId(
-			rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1"), 10091),
-			(int64) 1024);
-	MQMessageId msgId = MQDecoder::decodeMessageId(msgIdStr);
+// TODO
+TEST(decoders, messageId) {
+    int host;
+    int port;
+    string msgIdStr =
+        MQDecoder::createMessageId(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1"), 10091), (int64) 1024);
+    MQMessageId msgId = MQDecoder::decodeMessageId(msgIdStr);
 
-	EXPECT_EQ(msgId.getOffset(), 1024);
+    EXPECT_EQ(msgId.getOffset(), 1024);
 
-	rocketmq::socketAddress2IPPort(msgId.getAddress(), host, port);
-	EXPECT_EQ(host, inet_addr("127.0.0.1"));
-	EXPECT_EQ(port, 10091);
+    rocketmq::socketAddress2IPPort(msgId.getAddress(), host, port);
+    EXPECT_EQ(host, inet_addr("127.0.0.1"));
+    EXPECT_EQ(port, 10091);
 }
 
-TEST( decoder , decoder ) {
+TEST(decoder, decoder) {
+    MQMessageExt mext;
+    MemoryOutputStream *memoryOut = new MemoryOutputStream(1024);
 
-	MQMessageExt mext;
-	MemoryOutputStream *memoryOut = new MemoryOutputStream(1024);
+    // 1 TOTALSIZE 4
+    memoryOut->writeIntBigEndian(107);
+    mext.setStoreSize(107);
 
-	// 1 TOTALSIZE 4
-	memoryOut->writeIntBigEndian(107);
-	mext.setStoreSize(107);
+    // 2 MAGICCODE sizeof(int)  8=4+4
+    memoryOut->writeIntBigEndian(14);
 
-	// 2 MAGICCODE sizeof(int)  8=4+4
-	memoryOut->writeIntBigEndian(14);
+    // 3 BODYCRC  12=8+4
+    memoryOut->writeIntBigEndian(24);
+    mext.setBodyCRC(24);
+    // 4 QUEUEID 16=12+4
+    memoryOut->writeIntBigEndian(4);
+    mext.setQueueId(4);
+    // 5 FLAG    20=16+4
+    memoryOut->writeIntBigEndian(4);
+    mext.setFlag(4);
+    // 6 QUEUEOFFSET  28 = 20+8
+    memoryOut->writeInt64BigEndian((int64) 1024);
+    mext.setQueueOffset(1024);
+    // 7 PHYSICALOFFSET 36=28+8
+    memoryOut->writeInt64BigEndian((int64) 2048);
+    mext.setCommitLogOffset(2048);
+    // 8 SYSFLAG  40=36+4
+    memoryOut->writeIntBigEndian(0);
+    mext.setSysFlag(0);
+    // 9 BORNTIMESTAMP 48 = 40+8
+    memoryOut->writeInt64BigEndian((int64) 4096);
+    mext.setBornTimestamp(4096);
+    // 10 BORNHOST 56= 48+8
+    memoryOut->writeIntBigEndian(inet_addr("127.0.0.1"));
+    memoryOut->writeIntBigEndian(10091);
+    mext.setBornHost(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1"), 10091));
+    // 11 STORETIMESTAMP 64 =56+8
+    memoryOut->writeInt64BigEndian((int64) 4096);
+    mext.setStoreTimestamp(4096);
+    // 12 STOREHOST 72 = 64+8
+    memoryOut->writeIntBigEndian(inet_addr("127.0.0.2"));
+    memoryOut->writeIntBigEndian(10092);
+    mext.setStoreHost(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.2"), 10092));
+    // 13 RECONSUMETIMES 76 = 72+4
+    mext.setReconsumeTimes(111111);
+    memoryOut->writeIntBigEndian(mext.getReconsumeTimes());
+    // 14 Prepared Transaction Offset 84 = 76+8
+    memoryOut->writeInt64BigEndian((int64) 12);
+    mext.setPreparedTransactionOffset(12);
+    // 15 BODY 88 = 84+4   10
+    string *body = new string("1234567890");
+    mext.setBody(body->c_str());
+    memoryOut->writeIntBigEndian(10);
+    memoryOut->write(body->c_str(), body->size());
 
-	// 3 BODYCRC  12=8+4
-	memoryOut->writeIntBigEndian(24);
-	mext.setBodyCRC(24);
-	// 4 QUEUEID 16=12+4
-	memoryOut->writeIntBigEndian(4);
-	mext.setQueueId(4);
-	// 5 FLAG    20=16+4
-	memoryOut->writeIntBigEndian(4);
-	mext.setFlag(4);
-	// 6 QUEUEOFFSET  28 = 20+8
-	memoryOut->writeInt64BigEndian((int64) 1024);
-	mext.setQueueOffset(1024);
-	// 7 PHYSICALOFFSET 36=28+8
-	memoryOut->writeInt64BigEndian((int64) 2048);
-	mext.setCommitLogOffset(2048);
-	// 8 SYSFLAG  40=36+4
-	memoryOut->writeIntBigEndian(0);
-	mext.setSysFlag(0);
-	// 9 BORNTIMESTAMP 48 = 40+8
-	memoryOut->writeInt64BigEndian((int64) 4096);
-	mext.setBornTimestamp(4096);
-	// 10 BORNHOST 56= 48+8
-	memoryOut->writeIntBigEndian(inet_addr("127.0.0.1"));
-	memoryOut->writeIntBigEndian(10091);
-	mext.setBornHost(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1"), 10091));
-	// 11 STORETIMESTAMP 64 =56+8
-	memoryOut->writeInt64BigEndian((int64) 4096);
-	mext.setStoreTimestamp(4096);
-	// 12 STOREHOST 72 = 64+8
-	memoryOut->writeIntBigEndian(inet_addr("127.0.0.2"));
-	memoryOut->writeIntBigEndian(10092);
-	mext.setStoreHost(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.2"), 10092));
-	// 13 RECONSUMETIMES 76 = 72+4
-	mext.setReconsumeTimes(111111);
-	memoryOut->writeIntBigEndian(mext.getReconsumeTimes());
-	// 14 Prepared Transaction Offset 84 = 76+8
-	memoryOut->writeInt64BigEndian((int64) 12);
-	mext.setPreparedTransactionOffset(12);
-	// 15 BODY 88 = 84+4   10
-	string *body = new string("1234567890");
-	mext.setBody(body->c_str());
-	memoryOut->writeIntBigEndian(10);
-	memoryOut->write(body->c_str(), body->size());
+    // 16 TOPIC
+    memoryOut->writeByte(10);
+    memoryOut->write(body->c_str(), body->size());
+    mext.setTopic(body->c_str());
 
-	// 16 TOPIC
-	memoryOut->writeByte(10);
-	memoryOut->write(body->c_str(), body->size());
-	mext.setTopic(body->c_str());
+    // 17 PROPERTIES
+    memoryOut->writeShortBigEndian(0);
 
-	//17 PROPERTIES
-	memoryOut->writeShortBigEndian(0);
+    mext.setMsgId(MQDecoder::createMessageId(mext.getStoreHost(), (int64) mext.getCommitLogOffset()));
 
-	mext.setMsgId(MQDecoder::createMessageId(mext.getStoreHost(),(int64)mext.getCommitLogOffset()));
+    vector<MQMessageExt> mqvec;
+    MemoryBlock block = memoryOut->getMemoryBlock();
+    MQDecoder::decodes(&block, mqvec);
+    EXPECT_EQ(mqvec.size(), 1);
+    std::cout << mext.toString() << "\n";
+    std::cout << mqvec[0].toString() << "\n";
+    EXPECT_EQ(mqvec[0].toString(), mext.toString());
 
-	vector<MQMessageExt> mqvec;
-	MemoryBlock block = memoryOut->getMemoryBlock();
-	MQDecoder::decodes(&block, mqvec);
-	EXPECT_EQ(mqvec.size(), 1);
-	std::cout<< mext.toString()<<"\n";
-	std::cout<< mqvec[0].toString()<<"\n";
-	EXPECT_EQ(mqvec[0].toString() , mext.toString());
+    mqvec.clear();
+    MQDecoder::decodes(&block, mqvec, false);
+    EXPECT_FALSE(mqvec[0].getBody().size());
 
-	mqvec.clear();
-	MQDecoder::decodes(&block, mqvec , false);
-	EXPECT_FALSE(mqvec[0].getBody().size());
+    //===============================================================
+    // 8 SYSFLAG  40=36+4
+    mext.setSysFlag(0 | MessageSysFlag::CompressedFlag);
+    memoryOut->setPosition(36);
+    memoryOut->writeIntBigEndian(mext.getSysFlag());
 
-//===============================================================
-	// 8 SYSFLAG  40=36+4
-	mext.setSysFlag(0 | MessageSysFlag::CompressedFlag);
-	memoryOut->setPosition(36);
-	memoryOut->writeIntBigEndian( mext.getSysFlag());
+    // 15 Body 84
+    string outBody;
+    string boody("123123123");
+    UtilAll::deflate(boody, outBody, 5);
+    mext.setBody(outBody);
 
-	//15 Body 84
-	string outBody;
-	string boody("123123123");
-	UtilAll::deflate(boody, outBody, 5);
-	mext.setBody(outBody);
+    memoryOut->setPosition(84);
+    memoryOut->writeIntBigEndian(outBody.size());
+    memoryOut->write(outBody.c_str(), outBody.size());
 
-	memoryOut->setPosition(84);
-	memoryOut->writeIntBigEndian(outBody.size());
-	memoryOut->write(outBody.c_str(), outBody.size());
+    // 16 TOPIC
+    memoryOut->writeByte(10);
+    memoryOut->write(body->c_str(), body->size());
+    mext.setTopic(body->c_str());
 
-	// 16 TOPIC
-	memoryOut->writeByte(10);
-	memoryOut->write(body->c_str(), body->size());
-	mext.setTopic(body->c_str());
+    // 17 PROPERTIES
+    map<string, string> properties;
+    properties["RocketMQ"] = "cpp-client";
+    properties[MQMessage::PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX] = "123456";
+    mext.setProperties(properties);
+    mext.setMsgId("123456");
 
-	//17 PROPERTIES
-	map<string, string> properties;
-	properties["RocketMQ"] = "cpp-client";
-	properties[MQMessage::PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX] = "123456";
-	mext.setProperties(properties);
-	mext.setMsgId("123456");
+    string proString = MQDecoder::messageProperties2String(properties);
 
-	string proString = MQDecoder::messageProperties2String(properties);
+    memoryOut->writeShortBigEndian(proString.size());
+    memoryOut->write(proString.c_str(), proString.size());
 
-	memoryOut->writeShortBigEndian(proString.size());
-	memoryOut->write(proString.c_str(), proString.size());
+    mext.setStoreSize(memoryOut->getDataSize());
+    memoryOut->setPosition(0);
+    memoryOut->writeIntBigEndian(mext.getStoreSize());
 
-	mext.setStoreSize( memoryOut->getDataSize());
-	memoryOut->setPosition(0);
-	memoryOut->writeIntBigEndian( mext.getStoreSize() );
-
-
-	block = memoryOut->getMemoryBlock();
-	MQDecoder::decodes(&block, mqvec);
-	EXPECT_EQ(mqvec[0].toString() , mext.toString());
-
+    block = memoryOut->getMemoryBlock();
+    MQDecoder::decodes(&block, mqvec);
+    EXPECT_EQ(mqvec[0].toString(), mext.toString());
 }
 
-TEST(decoder , messagePropertiesAndToString){
-	map<string, string> properties;
-	properties["RocketMQ"] = "cpp-client";
-	string proString = MQDecoder::messageProperties2String(properties);
+TEST(decoder, messagePropertiesAndToString) {
+    map<string, string> properties;
+    properties["RocketMQ"] = "cpp-client";
+    string proString = MQDecoder::messageProperties2String(properties);
 
-	map<string, string> newProperties;
-	MQDecoder::string2messageProperties(proString ,newProperties );
-	EXPECT_EQ(properties , newProperties);
+    map<string, string> newProperties;
+    MQDecoder::string2messageProperties(proString, newProperties);
+    EXPECT_EQ(properties, newProperties);
 }
 
-int main(int argc, char* argv[]) {
-	InitGoogleMock(&argc, argv);
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
 
-	testing::GTEST_FLAG(filter) = "decoder.*";
-	int itestts = RUN_ALL_TESTS();
-	return itestts;
+    testing::GTEST_FLAG(filter) = "decoder.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
 }
diff --git a/test/src/message/MQMessageExtTest.cpp b/test/src/message/MQMessageExtTest.cpp
index f4b70c1..3772a03 100644
--- a/test/src/message/MQMessageExtTest.cpp
+++ b/test/src/message/MQMessageExtTest.cpp
@@ -14,133 +14,125 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
 
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "MQMessageExt.h"
+#include "MessageSysFlag.h"
 #include "SocketUtil.h"
 #include "TopicFilterType.h"
-#include "MessageSysFlag.h"
-#include "MQMessageExt.h"
 
-using ::testing::InitGoogleTest;
 using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
 using testing::Return;
 
+using rocketmq::MessageSysFlag;
 using rocketmq::MQMessageExt;
 using rocketmq::TopicFilterType;
-using rocketmq::MessageSysFlag;
 
+TEST(messageExt, init) {
+    MQMessageExt messageExt;
+    EXPECT_EQ(messageExt.getQueueOffset(), 0);
+    EXPECT_EQ(messageExt.getCommitLogOffset(), 0);
+    EXPECT_EQ(messageExt.getBornTimestamp(), 0);
+    EXPECT_EQ(messageExt.getStoreTimestamp(), 0);
+    EXPECT_EQ(messageExt.getPreparedTransactionOffset(), 0);
+    EXPECT_EQ(messageExt.getQueueId(), 0);
+    EXPECT_EQ(messageExt.getStoreSize(), 0);
+    EXPECT_EQ(messageExt.getReconsumeTimes(), 3);
+    EXPECT_EQ(messageExt.getBodyCRC(), 0);
+    EXPECT_EQ(messageExt.getMsgId(), "");
+    EXPECT_EQ(messageExt.getOffsetMsgId(), "");
 
+    messageExt.setQueueOffset(1);
+    EXPECT_EQ(messageExt.getQueueOffset(), 1);
 
+    messageExt.setCommitLogOffset(1024);
+    EXPECT_EQ(messageExt.getCommitLogOffset(), 1024);
 
-TEST(messageExt, init){
-	MQMessageExt messageExt;
-	EXPECT_EQ(messageExt.getQueueOffset() , 0);
-	EXPECT_EQ(messageExt.getCommitLogOffset() , 0);
-	EXPECT_EQ(messageExt.getBornTimestamp() , 0);
-	EXPECT_EQ(messageExt.getStoreTimestamp() , 0);
-	EXPECT_EQ(messageExt.getPreparedTransactionOffset() , 0);
-	EXPECT_EQ(messageExt.getQueueId(), 0 );
-	EXPECT_EQ(messageExt.getStoreSize() , 0);
-	EXPECT_EQ(messageExt.getReconsumeTimes() , 3);
-	EXPECT_EQ(messageExt.getBodyCRC() , 0);
-	EXPECT_EQ(messageExt.getMsgId() , "");
-	EXPECT_EQ(messageExt.getOffsetMsgId() , "");
+    messageExt.setBornTimestamp(1024);
+    EXPECT_EQ(messageExt.getBornTimestamp(), 1024);
 
+    messageExt.setStoreTimestamp(2048);
+    EXPECT_EQ(messageExt.getStoreTimestamp(), 2048);
 
-	messageExt.setQueueOffset(1);
-	EXPECT_EQ(messageExt.getQueueOffset() , 1);
+    messageExt.setPreparedTransactionOffset(4096);
+    EXPECT_EQ(messageExt.getPreparedTransactionOffset(), 4096);
 
-	messageExt.setCommitLogOffset(1024);
-	EXPECT_EQ(messageExt.getCommitLogOffset() , 1024);
+    messageExt.setQueueId(2);
+    EXPECT_EQ(messageExt.getQueueId(), 2);
 
-	messageExt.setBornTimestamp(1024);
-	EXPECT_EQ(messageExt.getBornTimestamp() , 1024);
+    messageExt.setStoreSize(12);
+    EXPECT_EQ(messageExt.getStoreSize(), 12);
 
-	messageExt.setStoreTimestamp(2048);
-	EXPECT_EQ(messageExt.getStoreTimestamp() , 2048);
+    messageExt.setReconsumeTimes(48);
+    EXPECT_EQ(messageExt.getReconsumeTimes(), 48);
 
-	messageExt.setPreparedTransactionOffset(4096);
-	EXPECT_EQ(messageExt.getPreparedTransactionOffset() , 4096);
+    messageExt.setBodyCRC(32);
+    EXPECT_EQ(messageExt.getBodyCRC(), 32);
 
-	messageExt.setQueueId(2);
-	EXPECT_EQ(messageExt.getQueueId(), 2 );
+    messageExt.setMsgId("MsgId");
+    EXPECT_EQ(messageExt.getMsgId(), "MsgId");
 
-	messageExt.setStoreSize(12);
-	EXPECT_EQ(messageExt.getStoreSize() , 12);
+    messageExt.setOffsetMsgId("offsetMsgId");
+    EXPECT_EQ(messageExt.getOffsetMsgId(), "offsetMsgId");
 
-	messageExt.setReconsumeTimes(48);
-	EXPECT_EQ(messageExt.getReconsumeTimes() , 48);
+    messageExt.setBornTimestamp(1111);
+    EXPECT_EQ(messageExt.getBornTimestamp(), 1111);
 
-	messageExt.setBodyCRC(32);
-	EXPECT_EQ(messageExt.getBodyCRC() , 32);
+    messageExt.setStoreTimestamp(2222);
+    EXPECT_EQ(messageExt.getStoreTimestamp(), 2222);
 
-	messageExt.setMsgId("MsgId");
-	EXPECT_EQ(messageExt.getMsgId() , "MsgId");
+    struct sockaddr_in sa;
+    sa.sin_family = AF_INET;
+    sa.sin_port = htons(10091);
+    sa.sin_addr.s_addr = inet_addr("127.0.0.1");
 
-	messageExt.setOffsetMsgId("offsetMsgId");
-	EXPECT_EQ(messageExt.getOffsetMsgId() , "offsetMsgId");
+    sockaddr bornHost;
+    memcpy(&bornHost, &sa, sizeof(sockaddr));
 
-	messageExt.setBornTimestamp(1111);
-	EXPECT_EQ(messageExt.getBornTimestamp( ) ,1111);
+    messageExt.setBornHost(bornHost);
+    EXPECT_EQ(messageExt.getBornHostNameString(), rocketmq::getHostName(bornHost));
+    EXPECT_EQ(messageExt.getBornHostString(), rocketmq::socketAddress2String(bornHost));
 
-	messageExt.setStoreTimestamp(2222);
-	EXPECT_EQ(messageExt.getStoreTimestamp() , 2222);
+    struct sockaddr_in storeSa;
+    storeSa.sin_family = AF_INET;
+    storeSa.sin_port = htons(10092);
+    storeSa.sin_addr.s_addr = inet_addr("127.0.0.2");
 
+    sockaddr storeHost;
+    memcpy(&storeHost, &storeSa, sizeof(sockaddr));
+    messageExt.setStoreHost(storeHost);
+    EXPECT_EQ(messageExt.getStoreHostString(), rocketmq::socketAddress2String(storeHost));
 
+    MQMessageExt twoMessageExt(2, 1024, bornHost, 2048, storeHost, "msgId");
+    EXPECT_EQ(twoMessageExt.getQueueOffset(), 0);
+    EXPECT_EQ(twoMessageExt.getCommitLogOffset(), 0);
+    EXPECT_EQ(twoMessageExt.getBornTimestamp(), 1024);
+    EXPECT_EQ(twoMessageExt.getStoreTimestamp(), 2048);
+    EXPECT_EQ(twoMessageExt.getPreparedTransactionOffset(), 0);
+    EXPECT_EQ(twoMessageExt.getQueueId(), 2);
+    EXPECT_EQ(twoMessageExt.getStoreSize(), 0);
+    EXPECT_EQ(twoMessageExt.getReconsumeTimes(), 3);
+    EXPECT_EQ(twoMessageExt.getBodyCRC(), 0);
+    EXPECT_EQ(twoMessageExt.getMsgId(), "msgId");
+    EXPECT_EQ(twoMessageExt.getOffsetMsgId(), "");
 
-	struct sockaddr_in sa;
-	sa.sin_family = AF_INET;
-	sa.sin_port = htons(10091);
-	sa.sin_addr.s_addr = inet_addr("127.0.0.1");
+    EXPECT_EQ(twoMessageExt.getBornHostNameString(), rocketmq::getHostName(bornHost));
+    EXPECT_EQ(twoMessageExt.getBornHostString(), rocketmq::socketAddress2String(bornHost));
 
-	sockaddr bornHost;
-	memcpy(&bornHost, &sa, sizeof(sockaddr));
+    EXPECT_EQ(twoMessageExt.getStoreHostString(), rocketmq::socketAddress2String(storeHost));
 
-	messageExt.setBornHost(bornHost);
-	EXPECT_EQ(messageExt.getBornHostNameString() , rocketmq::getHostName(bornHost));
-	EXPECT_EQ(messageExt.getBornHostString() , rocketmq::socketAddress2String(bornHost));
+    EXPECT_EQ(MQMessageExt::parseTopicFilterType(MessageSysFlag::MultiTagsFlag), TopicFilterType::MULTI_TAG);
 
-	struct sockaddr_in storeSa;
-	storeSa.sin_family = AF_INET;
-	storeSa.sin_port = htons(10092);
-	storeSa.sin_addr.s_addr = inet_addr("127.0.0.2");
-
-	sockaddr storeHost;
-	memcpy(&storeHost, &storeSa, sizeof(sockaddr));
-	messageExt.setStoreHost(storeHost);
-	EXPECT_EQ(messageExt.getStoreHostString() , rocketmq::socketAddress2String(storeHost));
-
-
-	MQMessageExt twoMessageExt(2 , 1024 , bornHost , 2048 , storeHost , "msgId");
-	EXPECT_EQ(twoMessageExt.getQueueOffset() , 0);
-	EXPECT_EQ(twoMessageExt.getCommitLogOffset() , 0);
-	EXPECT_EQ(twoMessageExt.getBornTimestamp() , 1024);
-	EXPECT_EQ(twoMessageExt.getStoreTimestamp() , 2048);
-	EXPECT_EQ(twoMessageExt.getPreparedTransactionOffset() , 0);
-	EXPECT_EQ(twoMessageExt.getQueueId(), 2 );
-	EXPECT_EQ(twoMessageExt.getStoreSize() , 0);
-	EXPECT_EQ(twoMessageExt.getReconsumeTimes() , 3);
-	EXPECT_EQ(twoMessageExt.getBodyCRC() , 0);
-	EXPECT_EQ(twoMessageExt.getMsgId() , "msgId");
-	EXPECT_EQ(twoMessageExt.getOffsetMsgId() , "");
-
-	EXPECT_EQ(twoMessageExt.getBornHostNameString() , rocketmq::getHostName(bornHost));
-	EXPECT_EQ(twoMessageExt.getBornHostString() , rocketmq::socketAddress2String(bornHost));
-
-	EXPECT_EQ(twoMessageExt.getStoreHostString() , rocketmq::socketAddress2String(storeHost));
-
-	EXPECT_EQ(MQMessageExt::parseTopicFilterType(MessageSysFlag::MultiTagsFlag) , TopicFilterType::MULTI_TAG);
-
-	EXPECT_EQ(MQMessageExt::parseTopicFilterType(0) , TopicFilterType::SINGLE_TAG);
-
+    EXPECT_EQ(MQMessageExt::parseTopicFilterType(0), TopicFilterType::SINGLE_TAG);
 }
 
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
 
-int main(int argc, char* argv[]) {
-	InitGoogleMock(&argc, argv);
-
-	testing::GTEST_FLAG(filter) = "messageExt.init";
-	int itestts = RUN_ALL_TESTS();
-	return itestts;
+    testing::GTEST_FLAG(filter) = "messageExt.init";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
 }
diff --git a/test/src/message/MQMessageIdTest.cpp b/test/src/message/MQMessageIdTest.cpp
index e19e0ba..191438d 100644
--- a/test/src/message/MQMessageIdTest.cpp
+++ b/test/src/message/MQMessageIdTest.cpp
@@ -16,44 +16,41 @@
  */
 #include <stdio.h>
 
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
 #include "MQMessageId.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
 
 using namespace std;
-using ::testing::InitGoogleTest;
 using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
 using testing::Return;
 
 using rocketmq::MQMessageId;
 
-
-
-TEST(messageId , id) {
-	int host;
-	int port;
-	sockaddr addr = rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1") , 10091);
+TEST(messageId, id) {
+    int host;
+    int port;
+    sockaddr addr = rocketmq::IPPort2socketAddress(inet_addr("127.0.0.1"), 10091);
     MQMessageId id(addr, 1024);
 
-	rocketmq::socketAddress2IPPort(id.getAddress() ,host , port );
-	EXPECT_EQ(host , inet_addr("127.0.0.1"));
-	EXPECT_EQ(port , 10091);
-	EXPECT_EQ(id.getOffset() , 1024);
+    rocketmq::socketAddress2IPPort(id.getAddress(), host, port);
+    EXPECT_EQ(host, inet_addr("127.0.0.1"));
+    EXPECT_EQ(port, 10091);
+    EXPECT_EQ(id.getOffset(), 1024);
 
-	id.setAddress(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.2") , 10092));
-	id.setOffset(2048);
+    id.setAddress(rocketmq::IPPort2socketAddress(inet_addr("127.0.0.2"), 10092));
+    id.setOffset(2048);
 
-	rocketmq::socketAddress2IPPort(id.getAddress() ,host , port );
-	EXPECT_EQ(host , inet_addr("127.0.0.2"));
-	EXPECT_EQ(port , 10092);
-	EXPECT_EQ(id.getOffset() , 2048);
+    rocketmq::socketAddress2IPPort(id.getAddress(), host, port);
+    EXPECT_EQ(host, inet_addr("127.0.0.2"));
+    EXPECT_EQ(port, 10092);
+    EXPECT_EQ(id.getOffset(), 2048);
 }
 
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
 
-int main(int argc, char* argv[]) {
-	InitGoogleMock(&argc, argv);
-
-	testing::GTEST_FLAG(filter) = "messageId.id";
-	int itestts = RUN_ALL_TESTS();
-	return itestts;
+    testing::GTEST_FLAG(filter) = "messageId.id";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
 }
diff --git a/test/src/message/MQMessageQueueTest.cpp b/test/src/message/MQMessageQueueTest.cpp
index cfedca0..4522349 100644
--- a/test/src/message/MQMessageQueueTest.cpp
+++ b/test/src/message/MQMessageQueueTest.cpp
@@ -14,77 +14,73 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "gtest/gtest.h"
 #include "gmock/gmock.h"
+#include "gtest/gtest.h"
 
 #include "MQMessageQueue.h"
 
-using ::testing::InitGoogleTest;
 using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
 using testing::Return;
 
 using rocketmq::MQMessageQueue;
 
-TEST(messageQueue, init){
-	MQMessageQueue messageQueue;
-	EXPECT_EQ(messageQueue.getBrokerName() , "");
-	EXPECT_EQ(messageQueue.getTopic()      , "");
-	EXPECT_EQ(messageQueue.getQueueId() , -1);
+TEST(messageQueue, init) {
+    MQMessageQueue messageQueue;
+    EXPECT_EQ(messageQueue.getBrokerName(), "");
+    EXPECT_EQ(messageQueue.getTopic(), "");
+    EXPECT_EQ(messageQueue.getQueueId(), -1);
 
-	MQMessageQueue twoMessageQueue("testTopic" ,"testBroker" , 1);
-	EXPECT_EQ(twoMessageQueue.getBrokerName() ,"testBroker");
-	EXPECT_EQ(twoMessageQueue.getTopic(), "testTopic");
-	EXPECT_EQ(twoMessageQueue.getQueueId() , 1);
+    MQMessageQueue twoMessageQueue("testTopic", "testBroker", 1);
+    EXPECT_EQ(twoMessageQueue.getBrokerName(), "testBroker");
+    EXPECT_EQ(twoMessageQueue.getTopic(), "testTopic");
+    EXPECT_EQ(twoMessageQueue.getQueueId(), 1);
 
-	MQMessageQueue threeMessageQueue("threeTestTopic" ,"threeTestBroker" , 2);
-	MQMessageQueue frouMessageQueue(threeMessageQueue);
-	EXPECT_EQ(frouMessageQueue.getBrokerName() ,"threeTestBroker");
-	EXPECT_EQ(frouMessageQueue.getTopic(), "threeTestTopic");
-	EXPECT_EQ(frouMessageQueue.getQueueId() , 2);
+    MQMessageQueue threeMessageQueue("threeTestTopic", "threeTestBroker", 2);
+    MQMessageQueue frouMessageQueue(threeMessageQueue);
+    EXPECT_EQ(frouMessageQueue.getBrokerName(), "threeTestBroker");
+    EXPECT_EQ(frouMessageQueue.getTopic(), "threeTestTopic");
+    EXPECT_EQ(frouMessageQueue.getQueueId(), 2);
 
-	frouMessageQueue = twoMessageQueue;
-	EXPECT_EQ(frouMessageQueue.getBrokerName() ,"testBroker");
-	EXPECT_EQ(frouMessageQueue.getTopic() , "testTopic");
-	EXPECT_EQ(frouMessageQueue.getQueueId() , 1);
+    frouMessageQueue = twoMessageQueue;
+    EXPECT_EQ(frouMessageQueue.getBrokerName(), "testBroker");
+    EXPECT_EQ(frouMessageQueue.getTopic(), "testTopic");
+    EXPECT_EQ(frouMessageQueue.getQueueId(), 1);
 
-	frouMessageQueue.setBrokerName("frouTestBroker");
-	frouMessageQueue.setTopic("frouTestTopic");
-	frouMessageQueue.setQueueId(4);
-	EXPECT_EQ(frouMessageQueue.getBrokerName() ,"frouTestBroker");
-	EXPECT_EQ(frouMessageQueue.getTopic() , "frouTestTopic");
-	EXPECT_EQ(frouMessageQueue.getQueueId() , 4);
+    frouMessageQueue.setBrokerName("frouTestBroker");
+    frouMessageQueue.setTopic("frouTestTopic");
+    frouMessageQueue.setQueueId(4);
+    EXPECT_EQ(frouMessageQueue.getBrokerName(), "frouTestBroker");
+    EXPECT_EQ(frouMessageQueue.getTopic(), "frouTestTopic");
+    EXPECT_EQ(frouMessageQueue.getQueueId(), 4);
 }
 
-TEST(messageQueue , operators ){
-	MQMessageQueue messageQueue;
-	EXPECT_EQ(messageQueue , messageQueue);
-	EXPECT_EQ(messageQueue.compareTo(messageQueue) , 0);
+TEST(messageQueue, operators) {
+    MQMessageQueue messageQueue;
+    EXPECT_EQ(messageQueue, messageQueue);
+    EXPECT_EQ(messageQueue.compareTo(messageQueue), 0);
 
+    MQMessageQueue twoMessageQueue;
+    EXPECT_EQ(messageQueue, twoMessageQueue);
+    EXPECT_EQ(messageQueue.compareTo(twoMessageQueue), 0);
 
-	MQMessageQueue twoMessageQueue;
-	EXPECT_EQ(messageQueue , twoMessageQueue);
-	EXPECT_EQ(messageQueue.compareTo(twoMessageQueue) , 0);
+    twoMessageQueue.setTopic("testTopic");
+    EXPECT_FALSE(messageQueue == twoMessageQueue);
+    EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
 
-	twoMessageQueue.setTopic("testTopic");
-	EXPECT_FALSE(messageQueue == twoMessageQueue);
-	EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
+    twoMessageQueue.setQueueId(1);
+    EXPECT_FALSE(messageQueue == twoMessageQueue);
+    EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
 
-
-	twoMessageQueue.setQueueId(1);
-	EXPECT_FALSE(messageQueue == twoMessageQueue);
-	EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
-
-	twoMessageQueue.setBrokerName("testBroker");
-	EXPECT_FALSE(messageQueue == twoMessageQueue);
-	EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
-
-
+    twoMessageQueue.setBrokerName("testBroker");
+    EXPECT_FALSE(messageQueue == twoMessageQueue);
+    EXPECT_FALSE(messageQueue.compareTo(twoMessageQueue) == 0);
 }
 
-int main(int argc, char* argv[]) {
-	InitGoogleMock(&argc, argv);
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
 
-	testing::GTEST_FLAG(filter) = "messageQueue.*";
-	int itestts = RUN_ALL_TESTS();
-	return itestts;
+    testing::GTEST_FLAG(filter) = "messageQueue.*";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
 }
diff --git a/test/src/message/MQMessageTest.cpp b/test/src/message/MQMessageTest.cpp
index 4ab38be..2a121f5 100644
--- a/test/src/message/MQMessageTest.cpp
+++ b/test/src/message/MQMessageTest.cpp
@@ -19,139 +19,134 @@
 #include <map>
 #include <string>
 
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
 #include "MQMessage.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
 
 using namespace std;
 
-using ::testing::InitGoogleTest;
 using ::testing::InitGoogleMock;
+using ::testing::InitGoogleTest;
 using testing::Return;
 
 using rocketmq::MQMessage;
 
+TEST(message, Init) {
+    MQMessage messageOne;
+    EXPECT_EQ(messageOne.getTopic(), "");
+    EXPECT_EQ(messageOne.getBody(), "");
+    EXPECT_EQ(messageOne.getTags(), "");
+    EXPECT_EQ(messageOne.getFlag(), 0);
 
-TEST(message, Init){
+    MQMessage messageTwo("test", "testBody");
+    EXPECT_EQ(messageTwo.getTopic(), "test");
+    EXPECT_EQ(messageTwo.getBody(), "testBody");
+    EXPECT_EQ(messageTwo.getTags(), "");
+    EXPECT_EQ(messageTwo.getFlag(), 0);
 
-	MQMessage messageOne;
-	EXPECT_EQ(messageOne.getTopic(), "");
-	EXPECT_EQ(messageOne.getBody() , "");
-	//EXPECT_EQ(messageOne.getTags() , "");
-	EXPECT_EQ(messageOne.getFlag() , 0);
+    MQMessage messageThree("test", "tagTest", "testBody");
+    EXPECT_EQ(messageThree.getTopic(), "test");
+    EXPECT_EQ(messageThree.getBody(), "testBody");
+    EXPECT_EQ(messageThree.getTags(), "tagTest");
+    EXPECT_EQ(messageThree.getFlag(), 0);
 
-	MQMessage messageTwo("test" , "testBody");
-	EXPECT_EQ(messageTwo.getTopic(), "test");
-	EXPECT_EQ(messageTwo.getBody() , "testBody");
-	//EXPECT_EQ(messageTwo.getTags() , "");
-	EXPECT_EQ(messageTwo.getFlag() , 0);
+    MQMessage messageFour("test", "tagTest", "testKey", "testBody");
+    EXPECT_EQ(messageFour.getTopic(), "test");
+    EXPECT_EQ(messageFour.getBody(), "testBody");
+    EXPECT_EQ(messageFour.getTags(), "tagTest");
+    EXPECT_EQ(messageFour.getKeys(), "testKey");
+    EXPECT_EQ(messageFour.getFlag(), 0);
 
-	MQMessage messageThree("test" ,"tagTest" ,"testBody");
-	EXPECT_EQ(messageThree.getTopic(), "test");
-	EXPECT_EQ(messageThree.getBody() , "testBody");
-	//EXPECT_EQ(messageThree.getTags() , "tagTest");
-	EXPECT_EQ(messageThree.getFlag() , 0);
+    MQMessage messageFive("test", "tagTest", "testKey", 1, "testBody", 2);
+    EXPECT_EQ(messageFive.getTopic(), "test");
+    EXPECT_EQ(messageFive.getBody(), "testBody");
+    EXPECT_EQ(messageFive.getTags(), "tagTest");
+    EXPECT_EQ(messageFive.getKeys(), "testKey");
+    EXPECT_EQ(messageFive.getFlag(), 1);
 
-
-	MQMessage messageFour("test" ,"tagTest" , "testKey" , "testBody");
-	EXPECT_EQ(messageFour.getTopic(), "test");
-	EXPECT_EQ(messageFour.getBody() , "testBody");
-	//EXPECT_EQ(messageFour.getTags() , "tagTest");
-	EXPECT_EQ(messageFour.getKeys() , "testKey");
-	EXPECT_EQ(messageFour.getFlag() , 0);
-
-
-	MQMessage messageFive("test" ,"tagTest" , "testKey" , 1,"testBody" , 2);
-	EXPECT_EQ(messageFive.getTopic(), "test");
-	EXPECT_EQ(messageFive.getBody() , "testBody");
-	//EXPECT_EQ(messageFive.getTags() , "tagTest");
-	EXPECT_EQ(messageFive.getKeys() , "testKey");
-	EXPECT_EQ(messageFive.getFlag() , 1);
-
-	MQMessage messageSix(messageFive);
-	EXPECT_EQ(messageSix.getTopic(), "test");
-	EXPECT_EQ(messageSix.getBody() , "testBody");
-	//EXPECT_EQ(messageSix.getTags() , "tagTest");
-	EXPECT_EQ(messageSix.getKeys() , "testKey");
-	EXPECT_EQ(messageSix.getFlag() , 1);
+    MQMessage messageSix(messageFive);
+    EXPECT_EQ(messageSix.getTopic(), "test");
+    EXPECT_EQ(messageSix.getBody(), "testBody");
+    EXPECT_EQ(messageSix.getTags(), "tagTest");
+    EXPECT_EQ(messageSix.getKeys(), "testKey");
+    EXPECT_EQ(messageSix.getFlag(), 1);
 }
 
+TEST(message, info) {
+    MQMessage message;
 
-TEST(message , info){
-	MQMessage message;
+    EXPECT_EQ(message.getTopic(), "");
+    message.setTopic("testTopic");
+    EXPECT_EQ(message.getTopic(), "testTopic");
+    char *topic = "testTopic";
+    message.setTopic(topic, 5);
+    EXPECT_EQ(message.getTopic(), "testT");
 
-	EXPECT_EQ(message.getTopic(), "");
-	message.setTopic("testTopic");
-	EXPECT_EQ(message.getTopic(), "testTopic");
-	char *topic = "testTopic";
-	message.setTopic(topic , 5);
-	EXPECT_EQ(message.getTopic(), "testT");
+    EXPECT_EQ(message.getBody(), "");
+    message.setBody("testBody");
+    EXPECT_EQ(message.getBody(), "testBody");
 
-	EXPECT_EQ(message.getBody() , "");
-	message.setBody("testBody");
-	EXPECT_EQ(message.getBody() , "testBody");
+    char *body = "testBody";
+    message.setBody(body, 5);
+    EXPECT_EQ(message.getBody(), "testB");
 
-	char *body = "testBody";
-	message.setBody(body , 5);
-	EXPECT_EQ(message.getBody(), "testB");
+    string tags(message.getTags());
+    EXPECT_EQ(tags, "");
+    EXPECT_EQ(message.getFlag(), 0);
+    message.setFlag(2);
+    EXPECT_EQ(message.getFlag(), 2);
 
-	string tags (message.getTags());
-	EXPECT_EQ(tags , "");
-	EXPECT_EQ(message.getFlag() , 0);
-	message.setFlag(2);
-	EXPECT_EQ(message.getFlag() , 2);
+    EXPECT_EQ(message.isWaitStoreMsgOK(), true);
+    message.setWaitStoreMsgOK(false);
+    EXPECT_EQ(message.isWaitStoreMsgOK(), false);
+    message.setWaitStoreMsgOK(true);
+    EXPECT_EQ(message.isWaitStoreMsgOK(), true);
 
-	EXPECT_EQ(message.isWaitStoreMsgOK(), true);
-	message.setWaitStoreMsgOK(false);
-	EXPECT_EQ(message.isWaitStoreMsgOK(), false);
-	message.setWaitStoreMsgOK(true);
-	EXPECT_EQ(message.isWaitStoreMsgOK(), true);
+    string keys(message.getTags());
+    EXPECT_EQ(keys, "");
+    message.setKeys("testKeys");
+    EXPECT_EQ(message.getKeys(), "testKeys");
 
-	string keys (message.getTags());
-	EXPECT_EQ(keys , "");
-	message.setKeys("testKeys");
-	EXPECT_EQ(message.getKeys() , "testKeys");
+    EXPECT_EQ(message.getDelayTimeLevel(), 0);
+    message.setDelayTimeLevel(1);
+    EXPECT_EQ(message.getDelayTimeLevel(), 1);
 
-	EXPECT_EQ(message.getDelayTimeLevel() ,0);
-	message.setDelayTimeLevel(1);
-	EXPECT_EQ(message.getDelayTimeLevel() ,1);
-
-	message.setSysFlag(1);
-	EXPECT_EQ(message.getSysFlag() ,1);
+    message.setSysFlag(1);
+    EXPECT_EQ(message.getSysFlag(), 1);
 }
 
-TEST(message , properties){
-	MQMessage message;
-	EXPECT_EQ(message.getProperties().size() , 1);
-	EXPECT_STREQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED ).c_str() , "");
+TEST(message, properties) {
+    MQMessage message;
+    EXPECT_EQ(message.getProperties().size(), 1);
+    EXPECT_STREQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED).c_str(), "");
 
-	message.setProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED , "true");
-	EXPECT_EQ(message.getProperties().size() , 2);
-	EXPECT_EQ(message.getSysFlag() , 4);
-	EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED ) , "true");
+    message.setProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED, "true");
+    EXPECT_EQ(message.getProperties().size(), 2);
+    EXPECT_EQ(message.getSysFlag(), 4);
+    EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED), "true");
 
-	message.setProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED , "false");
-	EXPECT_EQ(message.getProperties().size() , 2);
-	EXPECT_EQ(message.getSysFlag() , 0);
-	EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED ) , "false");
+    message.setProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED, "false");
+    EXPECT_EQ(message.getProperties().size(), 2);
+    EXPECT_EQ(message.getSysFlag(), 0);
+    EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED), "false");
 
-	map<string, string> newProperties ;
+    map<string, string> newProperties;
 
-	newProperties[MQMessage::PROPERTY_TRANSACTION_PREPARED]="true";
-	message.setProperties(newProperties);
-	EXPECT_EQ(message.getSysFlag() , 4);
-	EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED ) , "true");
+    newProperties[MQMessage::PROPERTY_TRANSACTION_PREPARED] = "true";
+    message.setProperties(newProperties);
+    EXPECT_EQ(message.getSysFlag(), 4);
+    EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED), "true");
 
-	newProperties[MQMessage::PROPERTY_TRANSACTION_PREPARED]="false";
-	message.setProperties(newProperties);
-	EXPECT_EQ(message.getSysFlag() , 0);
-	EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED ) , "false");
+    newProperties[MQMessage::PROPERTY_TRANSACTION_PREPARED] = "false";
+    message.setProperties(newProperties);
+    EXPECT_EQ(message.getSysFlag(), 0);
+    EXPECT_EQ(message.getProperty(MQMessage::PROPERTY_TRANSACTION_PREPARED), "false");
 }
 
-int main(int argc, char* argv[]) {
-	InitGoogleMock(&argc, argv);
+int main(int argc, char *argv[]) {
+    InitGoogleMock(&argc, argv);
 
-	testing::GTEST_FLAG(filter) = "message.info";
-	int itestts = RUN_ALL_TESTS();
-	return itestts;
+    testing::GTEST_FLAG(filter) = "message.info";
+    int itestts = RUN_ALL_TESTS();
+    return itestts;
 }