diff --git a/hugegraph-store/hg-store-test/pom.xml b/hugegraph-store/hg-store-test/pom.xml
new file mode 100644
index 0000000000..bd66c99441
--- /dev/null
+++ b/hugegraph-store/hg-store-test/pom.xml
@@ -0,0 +1,339 @@
+
+
+
+
+
+ hugegraph-store
+ org.apache.hugegraph
+ ${revision}
+ ../pom.xml
+
+ 4.0.0
+
+ hg-store-test
+
+
+
+ 2.15.0
+ 1.18.20
+
+
+
+
+ jacoco
+
+ false
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.4
+
+
+
+ default
+ verify
+
+ report-aggregate
+
+
+ ${project.basedir}/../target/site/jacoco
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.hugegraph
+ hg-store-grpc
+ ${revision}
+
+
+ org.apache.hugegraph
+ hg-store-common
+ ${revision}
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ ${log4j2.version}
+
+
+ org.apache.hugegraph
+ hg-pd-client
+ ${revision}
+
+
+ io.grpc
+ *
+
+
+
+
+
+
+
+
+ org.apache.hugegraph
+ hg-pd-grpc
+ ${revision}
+
+
+ commons-io
+ commons-io
+ 2.7
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.13.0
+
+
+
+ junit
+ junit
+ 4.13.2
+
+
+ com.google.protobuf
+ protobuf-java-util
+ 3.17.2
+ compile
+
+
+ org.springframework
+ spring-context-support
+ 5.3.20
+
+
+ org.springframework
+ spring-test
+ 5.3.20
+ test
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+ 2.13.0
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ 2.13.0
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 2.5.14
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+ org.powermock
+ powermock-classloading-xstream
+ 2.0.0-RC.3
+
+
+ org.powermock
+ powermock-module-junit4-rule
+ 2.0.0-RC.3
+
+
+ org.powermock
+ powermock-api-support
+ 2.0.0-RC.3
+
+
+ org.powermock
+ powermock-module-junit4
+ 2.0.0-RC.3
+ compile
+
+
+ org.powermock
+ powermock-api-mockito2
+ 2.0.0-RC.3
+ compile
+
+
+ org.apache.hugegraph
+ hg-store-client
+
+
+ com.alipay.sofa
+ jraft-core
+ 1.3.9
+
+
+ org.rocksdb
+ rocksdbjni
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.20
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ store-common-test
+
+ ${basedir}/src/main/java/
+
+ ${basedir}/target/classes/
+
+
+ **/CommonSuiteTest.java
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.4
+
+
+ pre-test
+
+
+ prepare-agent
+
+
+
+ post-test
+ test
+
+ report-aggregate
+
+
+ ${basedir}/target/site/jacoco
+
+
+
+
+
+ **/grpc/**/*
+ **/jraft/**/*
+ **/*Iterator*
+ **/node/**/*
+
+
+
+
+
+
+ src/main/resources/
+ true
+
+
+
+
diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java
new file mode 100644
index 0000000000..0067b11ae7
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BaseCommonTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package org.apache.hugegraph.store.common;
+
+import org.junit.After;
+import org.junit.BeforeClass;
+
+public class BaseCommonTest {
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ }
+
+ @After
+ public void teardown() throws Exception {
+ // pass
+ }
+}
diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java
new file mode 100644
index 0000000000..afa1f2baba
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/BitsTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.apache.hugegraph.store.common;
+
+import org.apache.hugegraph.store.term.Bits;
+import org.junit.Assert;
+// import org.junit.Test;
+
+public class BitsTest {
+
+ // @Test
+ public void test() {
+ for (int i = 0; i < Integer.MAX_VALUE; i = i + 10) {
+ byte[] val = new byte[4];
+ Bits.putInt(val, 0, i);
+ int n = Bits.getInt(val, 0);
+ Assert.assertEquals(i, n);
+ }
+ }
+}
diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java
new file mode 100644
index 0000000000..0faf3457c7
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/ByteBufferAllocatorTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package org.apache.hugegraph.store.common;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.hugegraph.store.buffer.ByteBufferAllocator;
+import org.junit.Assert;
+import org.junit.Test;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class ByteBufferAllocatorTest extends BaseCommonTest {
+
+ @Test
+ public void getAndReleaseTest() throws InterruptedException {
+ final CountDownLatch latch = new CountDownLatch(2);
+
+ ByteBufferAllocator allocator = new ByteBufferAllocator(1, 2);
+
+ new Thread(() -> {
+ try {
+ var buffer1 = allocator.get();
+ var buffer2 = allocator.get();
+ Thread.sleep(2000);
+ Assert.assertEquals(buffer1.limit(), 1);
+ allocator.release(buffer1);
+ allocator.release(buffer2);
+ latch.countDown();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }).start();
+
+ new Thread(() -> {
+ try {
+ Thread.sleep(1000);
+ var buffer1 = allocator.get();
+ var buffer2 = allocator.get();
+ Assert.assertEquals(buffer1.limit(), 1);
+ allocator.release(buffer1);
+ allocator.release(buffer2);
+ latch.countDown();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }).start();
+
+ latch.await();
+ }
+}
diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java
new file mode 100644
index 0000000000..092cc804fe
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/CommonSuiteTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package org.apache.hugegraph.store.common;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import lombok.extern.slf4j.Slf4j;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ ByteBufferAllocatorTest.class,
+ KVByteBufferTest.class
+})
+
+@Slf4j
+public class CommonSuiteTest {
+
+}
diff --git a/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/KVByteBufferTest.java b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/KVByteBufferTest.java
new file mode 100644
index 0000000000..38ddb1af3f
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/java/org/apache/hugegraph/store/common/KVByteBufferTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package org.apache.hugegraph.store.common;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+
+import org.apache.hugegraph.store.buffer.KVByteBuffer;
+import org.junit.Test;
+
+public class KVByteBufferTest {
+
+ @Test
+ public void testOps() {
+ KVByteBuffer buffer1 = new KVByteBuffer(10);
+ buffer1.put((byte) 10);
+ // just put a byte
+ assertEquals(1, buffer1.position());
+ // 9 left
+ assertTrue(buffer1.hasRemaining());
+ buffer1.clear();
+ assertEquals(10, buffer1.get());
+
+ buffer1.clear();
+ buffer1.putInt(10);
+ buffer1.clear();
+ assertEquals(10, buffer1.getInt());
+
+ buffer1.flip();
+ // just write to a int
+ assertEquals(4, buffer1.getBuffer().limit());
+
+ byte[] bytes = new byte[]{10, 20, 30};
+ KVByteBuffer buffer2 = new KVByteBuffer(bytes);
+ assertArrayEquals(buffer2.array(), bytes);
+
+ ByteBuffer bb = ByteBuffer.allocate(10);
+ KVByteBuffer buffer3 = new KVByteBuffer(bb);
+ buffer3.put(bytes);
+ buffer3.clear();
+ assertArrayEquals(buffer3.getBytes(), bytes);
+
+ // int (4) + byte(3)
+ assertEquals(7, buffer3.getBuffer().position());
+
+ ByteBuffer bb2 = buffer3.copyBuffer();
+ assertEquals(7, bb2.capacity());
+ }
+}
diff --git a/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml b/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml
new file mode 100644
index 0000000000..0a3aae7b9d
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+ logs
+ hg-store-test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hugegraph-store/hg-store-test/src/main/resources/pd-server.yml b/hugegraph-store/hg-store-test/src/main/resources/pd-server.yml
new file mode 100644
index 0000000000..5608dc9dd4
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/resources/pd-server.yml
@@ -0,0 +1,71 @@
+#
+# 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.
+#
+
+spring:
+ application:
+ name: hugegraph-pd
+
+management:
+ metrics:
+ export:
+ prometheus:
+ enabled: true
+ endpoints:
+ web:
+ exposure:
+ include: "*"
+
+grpc:
+ port: 8686
+ netty-server:
+ max-inbound-message-size: 100MB
+
+server:
+ port: 8620
+
+pd:
+
+ patrol-interval: 3000000
+ data-path: tmp/8686
+ # 最少节点数,少于该数字,集群停止入库
+ initial-store-count: 1
+ # 初始store列表,在列表内的store自动激活
+ initial-store-list: 127.0.0.1:8501,127.0.0.1:8502,127.0.0.1:8503
+ #initial-store-list: 127.0.0.1:8501
+raft:
+ address: 127.0.0.1:8610
+ # raft集群
+ peers-list: 127.0.0.1:8610
+ # raft rpc读写超时时间,单位毫秒
+ rpc-timeout: 10000
+ # 快照生成时间间隔,单位秒
+ snapshotInterval: 30000
+ metrics: true
+store:
+ # store心跳超时时间,超过该时间,认为store临时不可用,转移Leader到其他副本,单位秒
+ keepAlive-timeout: 300
+ # store下线时间。超过该时间,认为store永久不可用,分配副本到其他机器,单位秒
+ max-down-time: 180000
+partition:
+ # 默认每个分区副本数
+ default-shard-count: 3
+ # 默认每机器最大副本数,初始分区数= store-max-shard-count * store-number / default-shard-count
+ store-max-shard-count: 1
+
+discovery:
+ #客户端注册后,无心跳最长次数,超过后,之前的注册信息会被删除
+ heartbeat-try-count: 3
diff --git a/hugegraph-store/hg-store-test/src/main/resources/version.txt b/hugegraph-store/hg-store-test/src/main/resources/version.txt
new file mode 100644
index 0000000000..b55f10804f
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/resources/version.txt
@@ -0,0 +1 @@
+3.6.5
\ No newline at end of file