You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by go...@apache.org on 2021/05/28 12:20:59 UTC

[incubator-inlong] 02/05: [INLONG-618] Add unit tests for metastore.dao.entity.*

This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch TUBEMQ-570
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git

commit 3aa7f4c33628cd79732e5553a924214fb768d2c1
Author: gosonzhang <go...@tencent.com>
AuthorDate: Wed May 26 18:48:00 2021 +0800

    [INLONG-618] Add unit tests for metastore.dao.entity.*
---
 .../metastore/dao/entity/BaseEntity.java           |  22 +-
 .../metastore/dao/entity/TopicDeployEntity.java    |   2 +
 .../metastore/dao/entity/BaseEntityTest.java       |   2 +
 .../metastore/dao/entity/BrokerConfEntityTest.java | 248 ++++++++++++++-------
 .../dao/entity/GroupConsumeCtrlEntityTest.java     |   8 +-
 .../dao/entity/TopicDeployEntityTest.java          | 161 +++++++++++++
 6 files changed, 350 insertions(+), 93 deletions(-)

diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntity.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntity.java
index 9cf1853..b964b96 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntity.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntity.java
@@ -22,6 +22,7 @@ import com.google.gson.GsonBuilder;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.tubemq.corebase.TBaseConstants;
 import org.apache.tubemq.corebase.utils.TStringUtils;
 import org.apache.tubemq.server.common.TServerConstants;
@@ -33,7 +34,8 @@ public class BaseEntity implements Serializable, Cloneable {
 
     private long dataVersionId =
             TBaseConstants.META_VALUE_UNDEFINED;    // -2: undefined, other: version
-    private long serialId = TBaseConstants.META_VALUE_UNDEFINED;
+    private final AtomicLong serialId =
+            new AtomicLong(TBaseConstants.META_VALUE_UNDEFINED);
     private String createUser = "";        // create user
     private Date createDate = null;        // create date
     private String modifyUser = "";       // modify user
@@ -57,7 +59,7 @@ public class BaseEntity implements Serializable, Cloneable {
         this.setCreateDate(other.createDate);
         this.modifyUser = other.modifyUser;
         this.setModifyDate(other.modifyDate);
-        this.serialId = other.serialId;
+        this.serialId.set(other.serialId.get());
         this.attributes = other.attributes;
     }
 
@@ -159,11 +161,16 @@ public class BaseEntity implements Serializable, Cloneable {
     }
 
     public long getSerialId() {
-        return serialId;
+        return serialId.get();
     }
 
     protected void updSerialId() {
-        this.serialId = System.currentTimeMillis();
+        if (serialId.get() == TBaseConstants.META_VALUE_UNDEFINED) {
+            this.serialId.set(System.currentTimeMillis());
+        } else {
+            this.serialId.incrementAndGet();
+        }
+
     }
 
     public String getModifyUser() {
@@ -223,7 +230,7 @@ public class BaseEntity implements Serializable, Cloneable {
     StringBuilder toWebJsonStr(StringBuilder sBuilder, boolean isLongName) {
         if (isLongName) {
             sBuilder.append(",\"dataVersionId\":").append(dataVersionId)
-                    .append(",\"serialId\":").append(serialId)
+                    .append(",\"serialId\":").append(serialId.get())
                     .append(",\"createUser\":\"").append(createUser).append("\"")
                     .append(",\"createDate\":\"").append(createDateStr).append("\"")
                     .append(",\"modifyUser\":\"").append(modifyUser).append("\"")
@@ -231,6 +238,7 @@ public class BaseEntity implements Serializable, Cloneable {
                     //.append(",\"attributes\":\"").append(attributes).append("\"");
         } else {
             sBuilder.append(",\"dVerId\":").append(dataVersionId)
+                    .append(",\"serialId\":").append(serialId.get())
                     .append(",\"cur\":\"").append(createUser).append("\"")
                     .append(",\"cDate\":\"").append(createDateStr).append("\"")
                     .append(",\"mur\":\"").append(modifyUser).append("\"")
@@ -260,7 +268,7 @@ public class BaseEntity implements Serializable, Cloneable {
         }
         BaseEntity that = (BaseEntity) o;
         return dataVersionId == that.dataVersionId &&
-                serialId == that.serialId &&
+                serialId.get() == that.serialId.get() &&
                 Objects.equals(createUser, that.createUser) &&
                 Objects.equals(createDate, that.createDate) &&
                 Objects.equals(modifyUser, that.modifyUser) &&
@@ -270,7 +278,7 @@ public class BaseEntity implements Serializable, Cloneable {
 
     @Override
     public int hashCode() {
-        return Objects.hash(dataVersionId, serialId, createUser,
+        return Objects.hash(dataVersionId, serialId.get(), createUser,
                 createDate, modifyUser, modifyDate, attributes);
     }
 
diff --git a/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntity.java b/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntity.java
index 8f79fc8..a2f6bd9 100644
--- a/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntity.java
+++ b/tubemq-server/src/main/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntity.java
@@ -84,6 +84,8 @@ public class TopicDeployEntity extends BaseEntity implements Cloneable {
                         getModifyUser(), getModifyDate());
         bdbEntity.setDataVerId(getDataVerId());
         bdbEntity.setTopicId(topicNameId);
+        bdbEntity.setTopicStatusId(deployStatus.getCode());
+        bdbEntity.setDataStore(topicProps.getDataStoreType(), topicProps.getDataPath());
         bdbEntity.setNumTopicStores(topicProps.getNumTopicStores());
         bdbEntity.setMemCacheMsgSizeInMB(topicProps.getMemCacheMsgSizeInMB());
         bdbEntity.setMemCacheMsgCntInK(topicProps.getMemCacheMsgCntInK());
diff --git a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntityTest.java b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntityTest.java
index 74ee410..417a613 100644
--- a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntityTest.java
+++ b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BaseEntityTest.java
@@ -19,6 +19,7 @@ package org.apache.tubemq.server.master.metamanage.metastore.dao.entity;
 
 import java.util.Date;
 import org.apache.tubemq.corebase.TBaseConstants;
+import org.apache.tubemq.corebase.utils.ThreadUtils;
 import org.apache.tubemq.server.common.TServerConstants;
 import org.apache.tubemq.server.common.utils.WebParameterUtils;
 import org.junit.Assert;
@@ -138,6 +139,7 @@ public class BaseEntityTest {
         BaseEntity baseEntity9 = (BaseEntity) baseEntity6.clone();
         Assert.assertEquals(baseEntity9, baseEntity6);
         baseEntity9.setAttributes("aaaaabbbbccccddd");
+        ThreadUtils.sleep(2000);
         baseEntity9.updSerialId();
         baseEntity9.updQueryKeyInfo(newDataVerId, newCreateUser, newModifyUser);
         Assert.assertNotEquals(baseEntity6.getDataVerId(), baseEntity9.getDataVerId());
diff --git a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BrokerConfEntityTest.java b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BrokerConfEntityTest.java
index b6b81f4..31bcd10 100644
--- a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BrokerConfEntityTest.java
+++ b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/BrokerConfEntityTest.java
@@ -18,10 +18,8 @@
 package org.apache.tubemq.server.master.metamanage.metastore.dao.entity;
 
 import java.util.Date;
-import org.apache.tubemq.corebase.TBaseConstants;
-import org.apache.tubemq.corebase.utils.SettingValidUtils;
-import org.apache.tubemq.server.common.statusdef.EnableStatus;
-import org.apache.tubemq.server.master.bdbstore.bdbentitys.BdbTopicAuthControlEntity;
+import org.apache.tubemq.server.common.statusdef.ManageStatus;
+import org.apache.tubemq.server.master.bdbstore.bdbentitys.BdbBrokerConfEntity;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -31,90 +29,170 @@ import org.junit.Test;
 public class BrokerConfEntityTest {
 
     @Test
-    public void trokerConfEntityTest() {
+    public void brokerConfEntityTest() {
         // case 1
-        String topicName = "test_1";
-        boolean enableAuthControl = false;
-        String attributes = "";
-        String createUser = "creater";
-        Date createDate = new Date();
-        int maxMsgSizeInB = 12222;
-        BdbTopicAuthControlEntity bdbEntity1 =
-                new BdbTopicAuthControlEntity(topicName,
-                        enableAuthControl, attributes, createUser, createDate);
-        TopicCtrlEntity ctrlEntity1 = new TopicCtrlEntity(bdbEntity1);
-        // check bdbEntity1
-        Assert.assertEquals(bdbEntity1.getTopicName(), topicName);
-        Assert.assertEquals(bdbEntity1.getTopicId(), TBaseConstants.META_VALUE_UNDEFINED);
-        Assert.assertEquals(bdbEntity1.isEnableAuthControl(), enableAuthControl);
-        Assert.assertEquals(bdbEntity1.getMaxMsgSize(), TBaseConstants.META_VALUE_UNDEFINED);
-        Assert.assertEquals(bdbEntity1.getCreateUser(), createUser);
-        Assert.assertEquals(bdbEntity1.getCreateDate(), createDate);
-        Assert.assertEquals(bdbEntity1.getDataVerId(), TBaseConstants.META_VALUE_UNDEFINED);
-        bdbEntity1.setMaxMsgSize(maxMsgSizeInB);
-        Assert.assertEquals(bdbEntity1.getMaxMsgSize(), maxMsgSizeInB);
-        // check ctrlEntity1
-        Assert.assertEquals(ctrlEntity1.getTopicName(), topicName);
-        Assert.assertEquals(ctrlEntity1.getTopicId(), TBaseConstants.META_VALUE_UNDEFINED);
-        Assert.assertEquals(ctrlEntity1.getAuthCtrlStatus(), EnableStatus.STATUS_DISABLE);
-        Assert.assertEquals(ctrlEntity1.getMaxMsgSizeInB(),
-                TBaseConstants.META_MAX_MESSAGE_DATA_SIZE);
-        Assert.assertEquals(ctrlEntity1.getMaxMsgSizeInMB(),
-                TBaseConstants.META_MIN_ALLOWED_MESSAGE_SIZE_MB);
-        Assert.assertEquals(ctrlEntity1.getCreateUser(), createUser);
-        Assert.assertEquals(ctrlEntity1.getCreateDate(), createDate);
-        Assert.assertEquals(ctrlEntity1.getDataVerId(), TBaseConstants.META_VALUE_UNDEFINED);
+        int brokerId1 = 22;
+        String brokerIp1 = "127.0.0.1";
+        int brokerPort1 = 555;
+        int numPartitions1 = 2;
+        int unflushThreshold1 = 3;
+        int unflushInterval1 = 4;
+        String deleteWhen1 = "";
+        String deletePolicy1 = "delete,5h";
+        int manageStatus1 = 1;
+        boolean acceptPublish1 = true;
+        boolean acceptSubscribe1 = false;
+        String attributes1 = "key1=test&key2=tas";
+        boolean isConfDataUpdated1 = true;
+        boolean isBrokerLoaded1 = false;
+        String createUser1 = "creater";
+        Date createDate1 = new Date();
+        String modifyUser1 = "modifyer";
+        Date modifyDate1 = new Date();
+        BdbBrokerConfEntity bdbEntity1 =
+                new BdbBrokerConfEntity(brokerId1, brokerIp1, brokerPort1, numPartitions1,
+                        unflushThreshold1, unflushInterval1, deleteWhen1, deletePolicy1,
+                        manageStatus1, acceptPublish1, acceptSubscribe1, attributes1,
+                        isConfDataUpdated1, isBrokerLoaded1, createUser1, createDate1,
+                        modifyUser1, modifyDate1);
+        BrokerConfEntity confEntity1 = new BrokerConfEntity(bdbEntity1);
+        // check confEntity1
+        Assert.assertEquals(confEntity1.getBrokerId(), brokerId1);
+        Assert.assertEquals(confEntity1.getBrokerIp(), brokerIp1);
+        Assert.assertEquals(confEntity1.getBrokerPort(), brokerPort1);
+        Assert.assertEquals(confEntity1.getBrokerTLSPort(), bdbEntity1.getBrokerTLSPort());
+        Assert.assertEquals(confEntity1.getBrokerWebPort(), bdbEntity1.getBrokerWebPort());
+        Assert.assertEquals(confEntity1.getGroupId(), bdbEntity1.getBrokerGroupId());
+        Assert.assertEquals(confEntity1.getManageStatus().getCode(), bdbEntity1.getManageStatus());
+        Assert.assertEquals(confEntity1.getRegionId(), bdbEntity1.getRegionId());
+        Assert.assertEquals(confEntity1.getCreateUser(), bdbEntity1.getRecordCreateUser());
+        Assert.assertEquals(confEntity1.getModifyUser(), bdbEntity1.getRecordModifyUser());
+        Assert.assertEquals(confEntity1.getCreateDate(), bdbEntity1.getRecordCreateDate());
+        Assert.assertEquals(confEntity1.getModifyDate(), bdbEntity1.getRecordModifyDate());
+        TopicPropGroup props1 = confEntity1.getTopicProps();
+        Assert.assertEquals(props1.getNumTopicStores(), bdbEntity1.getNumTopicStores());
+        Assert.assertEquals(props1.getNumPartitions(), bdbEntity1.getDftNumPartitions());
+        Assert.assertEquals(props1.getUnflushThreshold(), bdbEntity1.getDftUnflushThreshold());
+        Assert.assertEquals(props1.getUnflushInterval(), bdbEntity1.getDftUnflushInterval());
+        Assert.assertEquals(props1.getUnflushDataHold(), bdbEntity1.getDftUnFlushDataHold());
+        Assert.assertEquals(props1.getMemCacheMsgSizeInMB(), bdbEntity1.getDftMemCacheMsgSizeInMB());
+        Assert.assertEquals(props1.getMemCacheFlushIntvl(), bdbEntity1.getDftMemCacheFlushIntvl());
+        Assert.assertEquals(props1.getMemCacheMsgCntInK(), bdbEntity1.getDftMemCacheMsgCntInK());
+        Assert.assertEquals(props1.getAcceptPublish(), bdbEntity1.isAcceptPublish());
+        Assert.assertEquals(props1.getAcceptSubscribe(), bdbEntity1.isAcceptSubscribe());
+        Assert.assertEquals(props1.getDataStoreType(), bdbEntity1.getDataStoreType());
+        Assert.assertEquals(props1.getDataPath(), "");
+        Assert.assertEquals(props1.getDeletePolicy(), bdbEntity1.getDftDeletePolicy());
         // case 2
-        long dataVerId2 = 555;
-        int topicId2 = 222;
-        String topicName2 = "test_1";
-        boolean enableAuthControl2 = true;
-        String attributes2 = "";
-        String createUser2 = "creater2";
-        Date createDate2 = new Date();
-        int maxMsgSizeInB2 = 14;
-        TopicCtrlEntity ctrlEntity2 = ctrlEntity1.clone();
-        Assert.assertTrue(ctrlEntity2.isDataEquals(ctrlEntity1));
-        BaseEntity opInfoEntry = new BaseEntity(dataVerId2, createUser2, createDate2);
-        Assert.assertTrue(ctrlEntity2.updBaseModifyInfo(opInfoEntry));
-        Assert.assertTrue(ctrlEntity2.updModifyInfo(opInfoEntry.getDataVerId(),
-                topicId2, maxMsgSizeInB2, enableAuthControl2));
-        Assert.assertFalse(ctrlEntity2.isDataEquals(ctrlEntity1));
-        Assert.assertFalse(ctrlEntity2.isMatched(ctrlEntity1));
-        // check ctrlEntity2
-        Assert.assertEquals(ctrlEntity2.getTopicName(), topicName);
-        Assert.assertEquals(ctrlEntity2.getTopicId(), topicId2);
-        Assert.assertEquals(ctrlEntity2.getAuthCtrlStatus(), EnableStatus.STATUS_ENABLE);
-        Assert.assertEquals(ctrlEntity2.getMaxMsgSizeInB(),
-                SettingValidUtils.validAndXfeMaxMsgSizeFromMBtoB(maxMsgSizeInB2));
-        Assert.assertEquals(ctrlEntity2.getMaxMsgSizeInMB(), maxMsgSizeInB2);
-        Assert.assertEquals(ctrlEntity2.getCreateUser(), createUser);
-        Assert.assertEquals(ctrlEntity2.getCreateDate(), createDate);
-        Assert.assertEquals(ctrlEntity2.getModifyUser(), createUser2);
-        Assert.assertEquals(ctrlEntity2.getModifyDate(), createDate2);
-        Assert.assertEquals(ctrlEntity2.getDataVerId(), dataVerId2);
+        int dataVerId1 = 25;
+        int regionId1 = 95343;
+        int numTopicStores1 = 9;
+        int brokerTLSPort1 = 666;
+        int brokerWebPort1 = 888;
+        int memCacheFlushIntvl1 = 200;
+        int memCacheMsgCntInK1 = 250;
+        int memCacheMsgSizeInMB1 = 3;
+        int unFlushDataHold1 = 1000;
+        int groupId1 = 55;
+        int dataType1 = 2;
+        String dataPath1 = "/test";
+        bdbEntity1.setRegionId(regionId1);
+        bdbEntity1.setDataVerId(dataVerId1);
+        bdbEntity1.setBrokerGroupId(groupId1);
+        bdbEntity1.setBrokerTLSPort(brokerTLSPort1);
+        bdbEntity1.setBrokerWebPort(brokerWebPort1);
+        bdbEntity1.setNumTopicStores(numTopicStores1);
+        bdbEntity1.setDftMemCacheFlushIntvl(memCacheFlushIntvl1);
+        bdbEntity1.setDftMemCacheMsgCntInK(memCacheMsgCntInK1);
+        bdbEntity1.setDftMemCacheMsgSizeInMB(memCacheMsgSizeInMB1);
+        bdbEntity1.setDftUnFlushDataHold(unFlushDataHold1);
+        bdbEntity1.setDataStore(dataType1, dataPath1);
+        BrokerConfEntity confEntity2 = new BrokerConfEntity(bdbEntity1);
+        Assert.assertEquals(confEntity2.getBrokerId(), bdbEntity1.getBrokerId());
+        Assert.assertEquals(confEntity2.getBrokerIp(), bdbEntity1.getBrokerIp());
+        Assert.assertEquals(confEntity2.getBrokerPort(), bdbEntity1.getBrokerPort());
+        Assert.assertEquals(confEntity2.getBrokerTLSPort(), bdbEntity1.getBrokerTLSPort());
+        Assert.assertEquals(confEntity2.getBrokerWebPort(), bdbEntity1.getBrokerWebPort());
+        Assert.assertEquals(confEntity2.getGroupId(), bdbEntity1.getBrokerGroupId());
+        Assert.assertEquals(confEntity2.getManageStatus().getCode(), bdbEntity1.getManageStatus());
+        Assert.assertEquals(confEntity2.getRegionId(), bdbEntity1.getRegionId());
+        TopicPropGroup props2 = confEntity2.getTopicProps();
+        Assert.assertEquals(props2.getNumTopicStores(), bdbEntity1.getNumTopicStores());
+        Assert.assertEquals(props2.getNumPartitions(), bdbEntity1.getDftNumPartitions());
+        Assert.assertEquals(props2.getUnflushThreshold(), bdbEntity1.getDftUnflushThreshold());
+        Assert.assertEquals(props2.getUnflushInterval(), bdbEntity1.getDftUnflushInterval());
+        Assert.assertEquals(props2.getUnflushDataHold(), bdbEntity1.getDftUnFlushDataHold());
+        Assert.assertEquals(props2.getMemCacheMsgSizeInMB(), bdbEntity1.getDftMemCacheMsgSizeInMB());
+        Assert.assertEquals(props2.getMemCacheFlushIntvl(), bdbEntity1.getDftMemCacheFlushIntvl());
+        Assert.assertEquals(props2.getMemCacheMsgCntInK(), bdbEntity1.getDftMemCacheMsgCntInK());
+        Assert.assertEquals(props2.getAcceptPublish(), bdbEntity1.isAcceptPublish());
+        Assert.assertEquals(props2.getAcceptSubscribe(), bdbEntity1.isAcceptSubscribe());
+        Assert.assertEquals(props2.getDataStoreType(), bdbEntity1.getDataStoreType());
+        Assert.assertEquals(props2.getDataPath(), bdbEntity1.getDataPath());
+        Assert.assertEquals(props2.getDeletePolicy(), bdbEntity1.getDftDeletePolicy());
+        // check value
+        Assert.assertEquals(confEntity2.getDataVerId(), dataVerId1);
+        Assert.assertEquals(confEntity2.getBrokerId(), brokerId1);
+        Assert.assertEquals(confEntity2.getBrokerIp(), brokerIp1);
+        Assert.assertEquals(confEntity2.getBrokerPort(), brokerPort1);
+        Assert.assertEquals(confEntity2.getBrokerTLSPort(), brokerTLSPort1);
+        Assert.assertEquals(confEntity2.getBrokerWebPort(), brokerWebPort1);
+        Assert.assertEquals(confEntity2.getGroupId(), groupId1);
+        Assert.assertEquals(confEntity2.getManageStatus().getCode(), manageStatus1);
+        Assert.assertEquals(confEntity2.getRegionId(), regionId1);
+        Assert.assertEquals(props2.getNumTopicStores(), numTopicStores1);
+        Assert.assertEquals(props2.getNumPartitions(), numPartitions1);
+        Assert.assertEquals(props2.getUnflushThreshold(), unflushThreshold1);
+        Assert.assertEquals(props2.getUnflushInterval(), unflushInterval1);
+        Assert.assertEquals(props2.getUnflushDataHold(), unFlushDataHold1);
+        Assert.assertEquals(props2.getMemCacheMsgSizeInMB(), memCacheMsgSizeInMB1);
+        Assert.assertEquals(props2.getMemCacheFlushIntvl(), memCacheFlushIntvl1);
+        Assert.assertEquals(props2.getMemCacheMsgCntInK(), memCacheMsgCntInK1);
+        Assert.assertEquals(props2.getAcceptPublish(), acceptPublish1);
+        Assert.assertEquals(props2.getAcceptSubscribe(), acceptSubscribe1);
+        Assert.assertEquals(props2.getDataStoreType(), dataType1);
+        Assert.assertEquals(props2.getDataPath(), dataPath1);
+        Assert.assertEquals(props2.getDeletePolicy(), deletePolicy1);
+        Assert.assertEquals(confEntity2.getCreateUser(), createUser1);
+        Assert.assertEquals(confEntity2.getModifyUser(), modifyUser1);
+        Assert.assertEquals(confEntity2.getCreateDate(), createDate1);
+        Assert.assertEquals(confEntity2.getModifyDate(), modifyDate1);
         // case 3
-        BdbTopicAuthControlEntity bdbEntity3 =
-                ctrlEntity2.buildBdbTopicAuthControlEntity();
-        Assert.assertEquals(bdbEntity3.getTopicName(), ctrlEntity2.getTopicName());
-        Assert.assertEquals(bdbEntity3.getTopicId(), ctrlEntity2.getTopicId());
-        Assert.assertEquals(bdbEntity3.isEnableAuthControl(),
-                ctrlEntity2.getAuthCtrlStatus().isEnable());
-        Assert.assertEquals(bdbEntity3.getMaxMsgSize(), ctrlEntity2.getMaxMsgSizeInB());
-        Assert.assertEquals(bdbEntity3.getCreateUser(), ctrlEntity2.getModifyUser());
-        Assert.assertEquals(bdbEntity3.getCreateDate(), ctrlEntity2.getModifyDate());
-        Assert.assertEquals(bdbEntity3.getDataVerId(), ctrlEntity2.getDataVerId());
-        // case 4
-        TopicCtrlEntity ctrlEntity4 = new TopicCtrlEntity(bdbEntity3);
-        // check ctrlEntity4
-        Assert.assertTrue(ctrlEntity4.isDataEquals(ctrlEntity2));
-        Assert.assertEquals(ctrlEntity4.getTopicName(), ctrlEntity2.getTopicName());
-        Assert.assertEquals(ctrlEntity4.getTopicId(), ctrlEntity2.getTopicId());
-        Assert.assertEquals(ctrlEntity4.getAuthCtrlStatus(), ctrlEntity2.getAuthCtrlStatus());
-        Assert.assertEquals(ctrlEntity4.getMaxMsgSizeInB(), ctrlEntity2.getMaxMsgSizeInB());
-        Assert.assertEquals(ctrlEntity4.getCreateUser(), ctrlEntity2.getModifyUser());
-        Assert.assertEquals(ctrlEntity4.getCreateDate(), ctrlEntity2.getModifyDate());
-        Assert.assertEquals(ctrlEntity4.getDataVerId(), ctrlEntity2.getDataVerId());
+        long dataVerId3 = 777;
+        int brokerPort3 = 29;
+        int brokerTlsPort3 = 39;
+        int brokerWebPort3 = 49;
+        int regionId3 = 59;
+        int groupId3 = 69;
+        ManageStatus manageStatus3 = ManageStatus.STATUS_MANAGE_OFFLINE;
+        int numTopicStores3 = 1;
+        int numPartitions3 = 2;
+        int unflushThreshold3 = 3;
+        int unflushInterval3 = 4;
+        int unflushDataHold3 = 5;
+        int memCacheMsgSizeInMB3 = 6;
+        int memCacheMsgCntInK3 = 7;
+        int memCacheFlushIntvl3 = 8;
+        boolean acceptPublish3 = true;
+        boolean acceptSubscribe3 = false;
+        String deletePolicy3 = "delete,12h";
+        int dataStoreType3 = 9;
+        String dataPath3 = "testasest";
+        TopicPropGroup topicProps3 =
+                new TopicPropGroup(numTopicStores3, numPartitions3, unflushThreshold3,
+                        unflushInterval3, unflushDataHold3, memCacheMsgSizeInMB3,
+                        memCacheMsgCntInK3, memCacheFlushIntvl3, acceptPublish3,
+                        acceptSubscribe3, deletePolicy3, dataStoreType3, dataPath3);
+        BrokerConfEntity confEntity31 = confEntity2.clone();
+        Assert.assertTrue(confEntity31.isDataEquals(confEntity2));
+        Assert.assertTrue(confEntity31.updModifyInfo(dataVerId3, brokerPort3,
+                brokerTlsPort3, brokerWebPort3, regionId3, groupId3, manageStatus3, topicProps3));
+        BdbBrokerConfEntity bdbEntry3 =
+                confEntity31.buildBdbBrokerConfEntity();
+        BrokerConfEntity confEntity32 = new BrokerConfEntity(bdbEntry3);
+        Assert.assertTrue(confEntity32.isDataEquals(confEntity31));
+
+
     }
 
 }
diff --git a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/GroupConsumeCtrlEntityTest.java b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/GroupConsumeCtrlEntityTest.java
index 91ec3bc..aafacb2 100644
--- a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/GroupConsumeCtrlEntityTest.java
+++ b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/GroupConsumeCtrlEntityTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.tubemq.server.master.metamanage.metastore.dao.entity;
 
+import java.util.Calendar;
 import java.util.Date;
 import org.apache.tubemq.server.master.bdbstore.bdbentitys.BdbGroupFilterCondEntity;
 import org.junit.Assert;
@@ -59,8 +60,13 @@ public class GroupConsumeCtrlEntityTest {
         String disableRsn = "disable";
         boolean filterEnable = true;
         String newFilterCondStr = "[1,2,4]";
+        Date newDate = new Date();
+        Calendar c = Calendar.getInstance();
+        c.setTime(newDate);
+        c.add(Calendar.DAY_OF_MONTH, 1);
+        newDate = c.getTime();
         BaseEntity opInfoEntity =
-                new BaseEntity(newDataVerId, "modify", new Date());
+                new BaseEntity(newDataVerId, "modify", newDate);
         GroupConsumeCtrlEntity ctrlEntry2 = ctrlEntry1.clone();
         Assert.assertTrue(ctrlEntry2.isMatched(ctrlEntry1));
         ctrlEntry2.updBaseModifyInfo(opInfoEntity);
diff --git a/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntityTest.java b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntityTest.java
new file mode 100644
index 0000000..70e733b
--- /dev/null
+++ b/tubemq-server/src/test/java/org/apache/tubemq/server/master/metamanage/metastore/dao/entity/TopicDeployEntityTest.java
@@ -0,0 +1,161 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tubemq.server.master.metamanage.metastore.dao.entity;
+
+import java.util.Date;
+
+import org.apache.tubemq.corebase.utils.KeyBuilderUtils;
+import org.apache.tubemq.server.common.statusdef.TopicStatus;
+import org.apache.tubemq.server.master.bdbstore.bdbentitys.BdbTopicConfEntity;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+public class TopicDeployEntityTest {
+
+    @Test
+    public void topicDeployEntityTest() {
+        // case 1
+        int brokerId1 = 1;
+        String brokerIp1 = "127.0.0.1";
+        int brokerPort1 = 3;
+        String topicName1 = "test";
+        int numPartitions1 = 4;
+        int unflushThreshold1 = 5;
+        int unflushInterval1 = 6;
+        String deleteWhen1 = "";
+        String deletePolicy1 = "delete,9h";
+        boolean acceptPublish1 = false;
+        boolean acceptSubscribe1 = true;
+        int numTopicStores1 = 7;
+        String attributes1 = "key=val&aaa=bbb";
+        String createUser1 = "creater";
+        Date createDate1 = new Date();
+        String modifyUser1 = "modifyer";
+        Date modifyDate1 = new Date();
+        BdbTopicConfEntity bdbEntry1 =
+                new BdbTopicConfEntity(brokerId1, brokerIp1, brokerPort1, topicName1,
+                        numPartitions1, unflushThreshold1, unflushInterval1, deleteWhen1,
+                        deletePolicy1, acceptPublish1, acceptSubscribe1, numTopicStores1,
+                        attributes1, createUser1, createDate1, modifyUser1, modifyDate1);
+        TopicDeployEntity deployEntity1 = new TopicDeployEntity(bdbEntry1);
+        // check confEntity1
+        Assert.assertEquals(deployEntity1.getRecordKey(), bdbEntry1.getRecordKey());
+        Assert.assertEquals(deployEntity1.getBrokerId(), bdbEntry1.getBrokerId());
+        Assert.assertEquals(deployEntity1.getBrokerIp(), bdbEntry1.getBrokerIp());
+        Assert.assertEquals(deployEntity1.getBrokerPort(), bdbEntry1.getBrokerPort());
+        Assert.assertEquals(deployEntity1.getTopicName(), bdbEntry1.getTopicName());
+        Assert.assertEquals(deployEntity1.getTopicId(), bdbEntry1.getTopicId());
+        Assert.assertEquals(deployEntity1.getBrokerAddress(), bdbEntry1.getBrokerAddress());
+        Assert.assertEquals(deployEntity1.getDeployStatus().getCode(),
+                bdbEntry1.getTopicStatusId());
+        TopicPropGroup props1 = deployEntity1.getTopicProps();
+        Assert.assertEquals(props1.getNumTopicStores(), bdbEntry1.getNumTopicStores());
+        Assert.assertEquals(props1.getNumPartitions(), bdbEntry1.getNumPartitions());
+        Assert.assertEquals(props1.getUnflushThreshold(), bdbEntry1.getUnflushThreshold());
+        Assert.assertEquals(props1.getUnflushInterval(), bdbEntry1.getUnflushInterval());
+        Assert.assertEquals(props1.getUnflushDataHold(), bdbEntry1.getUnflushDataHold());
+        Assert.assertEquals(props1.getMemCacheMsgSizeInMB(), bdbEntry1.getMemCacheMsgSizeInMB());
+        Assert.assertEquals(props1.getMemCacheFlushIntvl(), bdbEntry1.getMemCacheFlushIntvl());
+        Assert.assertEquals(props1.getMemCacheMsgCntInK(), bdbEntry1.getMemCacheMsgCntInK());
+        Assert.assertEquals(props1.getAcceptPublish(), bdbEntry1.getAcceptPublish());
+        Assert.assertEquals(props1.getAcceptSubscribe(), bdbEntry1.getAcceptSubscribe());
+        Assert.assertEquals(props1.getDataStoreType(), bdbEntry1.getDataStoreType());
+        Assert.assertEquals(props1.getDataPath(), "");
+        Assert.assertEquals(props1.getDeletePolicy(), bdbEntry1.getDeletePolicy());
+        // case 2
+        int dataVerId2 = 25;
+        int topicNameId2 = 95;
+        int brokerPort2 = 33;
+        String brokerIp2 = "127.0.0.2";
+        TopicStatus deployStatus2 = TopicStatus.STATUS_TOPIC_HARD_REMOVE;
+        int numPartitions2 = 8;
+        int unflushThreshold2 = 2;
+        int unflushInterval2 = 5;
+        String deletePolicy2 = "delete,3h";
+        boolean acceptPublish2 = true;
+        boolean acceptSubscribe2 = false;
+        int numTopicStores2 = 3;
+        String attributes2 = "ay=val&aaa=bbb";
+        int dataStoreType2 = 5;
+        String dataPath2 = "aaa";
+        TopicPropGroup topicProps2 = props1.clone();
+        topicProps2.setNumTopicStores(numTopicStores2);
+        topicProps2.setNumPartitions(numPartitions2);
+        topicProps2.setUnflushThreshold(unflushThreshold2);
+        topicProps2.setUnflushInterval(unflushInterval2);
+        topicProps2.setAcceptPublish(acceptPublish2);
+        topicProps2.setAcceptSubscribe(acceptSubscribe2);
+        topicProps2.setDeletePolicy(deletePolicy2);
+        topicProps2.setDataStoreInfo(dataStoreType2, dataPath2);
+        TopicDeployEntity deployEntity2 = deployEntity1.clone();
+        Assert.assertTrue(deployEntity2.isMatched(deployEntity1));
+        Assert.assertTrue(deployEntity2.updModifyInfo(dataVerId2,
+                topicNameId2, brokerPort2, brokerIp2, deployStatus2, topicProps2));
+        TopicDeployEntity deployEntity31 = deployEntity2.clone();
+        BdbTopicConfEntity bdbEntry3 =
+                deployEntity31.buildBdbTopicConfEntity();
+        TopicDeployEntity deployEntity32 = new TopicDeployEntity(bdbEntry3);
+        Assert.assertTrue(deployEntity32.isDataEquals(deployEntity32));
+        // check value
+        Assert.assertEquals(deployEntity32.getRecordKey(), bdbEntry3.getRecordKey());
+        Assert.assertEquals(deployEntity32.getBrokerId(), bdbEntry3.getBrokerId());
+        Assert.assertEquals(deployEntity32.getBrokerIp(), bdbEntry3.getBrokerIp());
+        Assert.assertEquals(deployEntity32.getBrokerPort(), bdbEntry3.getBrokerPort());
+        Assert.assertEquals(deployEntity32.getTopicName(), bdbEntry3.getTopicName());
+        Assert.assertEquals(deployEntity32.getTopicId(), bdbEntry3.getTopicId());
+        Assert.assertEquals(deployEntity32.getBrokerAddress(), bdbEntry3.getBrokerAddress());
+        Assert.assertEquals(deployEntity32.getDeployStatus().getCode(),
+                bdbEntry3.getTopicStatusId());
+        TopicPropGroup props2 = deployEntity32.getTopicProps();
+        Assert.assertEquals(props2.getNumTopicStores(), bdbEntry3.getNumTopicStores());
+        Assert.assertEquals(props2.getNumPartitions(), bdbEntry3.getNumPartitions());
+        Assert.assertEquals(props2.getUnflushThreshold(), bdbEntry3.getUnflushThreshold());
+        Assert.assertEquals(props2.getUnflushInterval(), bdbEntry3.getUnflushInterval());
+        Assert.assertEquals(props2.getUnflushDataHold(), bdbEntry3.getUnflushDataHold());
+        Assert.assertEquals(props2.getMemCacheMsgSizeInMB(), bdbEntry3.getMemCacheMsgSizeInMB());
+        Assert.assertEquals(props2.getMemCacheFlushIntvl(), bdbEntry3.getMemCacheFlushIntvl());
+        Assert.assertEquals(props2.getMemCacheMsgCntInK(), bdbEntry3.getMemCacheMsgCntInK());
+        Assert.assertEquals(props2.getAcceptPublish(), bdbEntry3.getAcceptPublish());
+        Assert.assertEquals(props2.getAcceptSubscribe(), bdbEntry3.getAcceptSubscribe());
+        Assert.assertEquals(props2.getDataStoreType(), bdbEntry3.getDataStoreType());
+        Assert.assertEquals(props2.getDataPath(), bdbEntry3.getDataPath());
+        Assert.assertEquals(props2.getDeletePolicy(), bdbEntry3.getDeletePolicy());
+        //
+        Assert.assertEquals(deployEntity32.getDataVerId(), dataVerId2);
+        Assert.assertEquals(deployEntity32.getBrokerId(), brokerId1);
+        Assert.assertEquals(deployEntity32.getBrokerIp(), brokerIp2);
+        Assert.assertEquals(deployEntity32.getBrokerPort(), brokerPort2);
+        Assert.assertEquals(deployEntity32.getTopicName(), topicName1);
+        Assert.assertEquals(deployEntity32.getTopicId(), topicNameId2);
+        Assert.assertEquals(deployEntity32.getBrokerAddress(),
+                KeyBuilderUtils.buildAddressInfo(brokerIp2, brokerPort2));
+        Assert.assertEquals(deployEntity32.getDeployStatus(), deployStatus2);
+        Assert.assertEquals(props2.getNumTopicStores(), numTopicStores2);
+        Assert.assertEquals(props2.getNumPartitions(), numPartitions2);
+        Assert.assertEquals(props2.getUnflushThreshold(), unflushThreshold2);
+        Assert.assertEquals(props2.getUnflushInterval(), unflushInterval2);
+        Assert.assertEquals(props2.getAcceptPublish(), acceptPublish2);
+        Assert.assertEquals(props2.getAcceptSubscribe(), acceptSubscribe2);
+        Assert.assertEquals(props2.getDataStoreType(), dataStoreType2);
+        Assert.assertEquals(props2.getDataPath(), dataPath2);
+        Assert.assertEquals(props2.getDeletePolicy(), deletePolicy2);
+    }
+
+}