feat(store): integrate `store-test` submodule
diff --git a/hugegraph-store/hg-store-test/pom.xml b/hugegraph-store/hg-store-test/pom.xml
new file mode 100644
index 0000000..bd66c99
--- /dev/null
+++ b/hugegraph-store/hg-store-test/pom.xml
@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>hugegraph-store</artifactId>
+ <groupId>org.apache.hugegraph</groupId>
+ <version>${revision}</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>hg-store-test</artifactId>
+
+ <properties>
+ <!--maven.test.skip>true</maven.test.skip-->
+ <log4j2.version>2.15.0</log4j2.version>
+ <lombok.version>1.18.20</lombok.version>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>jacoco</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.8.4</version>
+
+ <executions>
+ <execution>
+ <id>default</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>report-aggregate</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.basedir}/../target/site/jacoco
+ </outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.hugegraph</groupId>
+ <artifactId>hg-store-grpc</artifactId>
+ <version>${revision}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hugegraph</groupId>
+ <artifactId>hg-store-common</artifactId>
+ <version>${revision}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hugegraph</groupId>
+ <artifactId>hg-pd-client</artifactId>
+ <version>${revision}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>io.grpc</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>org.apache.hugegraph</groupId>-->
+ <!-- <artifactId>hg-store-core</artifactId>-->
+ <!-- </dependency>-->
+ <dependency>
+ <groupId>org.apache.hugegraph</groupId>
+ <artifactId>hg-pd-grpc</artifactId>
+ <version>${revision}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.7</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.13.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.13.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ <version>3.17.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>5.3.20</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>5.3.20</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.13.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.13.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <version>2.5.14</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-classloading-xstream</artifactId>
+ <version>2.0.0-RC.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4-rule</artifactId>
+ <version>2.0.0-RC.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-support</artifactId>
+ <version>2.0.0-RC.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-junit4</artifactId>
+ <version>2.0.0-RC.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ <version>2.0.0-RC.3</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hugegraph</groupId>
+ <artifactId>hg-store-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.alipay.sofa</groupId>
+ <artifactId>jraft-core</artifactId>
+ <version>1.3.9</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.rocksdb</groupId>
+ <artifactId>rocksdbjni</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- <dependency>-->
+ <!-- <groupId>org.apache.hugegraph</groupId>-->
+ <!-- <artifactId>hg-store-node</artifactId>-->
+ <!-- <version>${revision}</version>-->
+ <!-- <scope>compile</scope>-->
+ <!-- </dependency>-->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.20</version>
+ <executions>
+ <!-- TODO:uncomment later-->
+ <!-- <execution>-->
+ <!-- <id>store-client-test</id>-->
+ <!-- <configuration>-->
+ <!-- <testSourceDirectory>${basedir}/src/main/java/-->
+ <!-- </testSourceDirectory>-->
+ <!-- <testClassesDirectory>${basedir}/target/classes/-->
+ <!-- </testClassesDirectory>-->
+ <!-- <includes>-->
+ <!-- <include>**/ClientSuiteTest.java</include>-->
+ <!-- </includes>-->
+ <!-- </configuration>-->
+ <!-- </execution>-->
+ <!-- <execution>-->
+ <!-- <id>store-core-test</id>-->
+ <!-- <configuration>-->
+ <!-- <testSourceDirectory>${basedir}/src/main/java/-->
+ <!-- </testSourceDirectory>-->
+ <!-- <testClassesDirectory>${basedir}/target/classes/-->
+ <!-- </testClassesDirectory>-->
+ <!-- <includes>-->
+ <!-- <include>**/CoreSuiteTest.java</include>-->
+ <!-- </includes>-->
+ <!-- </configuration>-->
+ <!-- </execution>-->
+ <execution>
+ <id>store-common-test</id>
+ <configuration>
+ <testSourceDirectory>${basedir}/src/main/java/
+ </testSourceDirectory>
+ <testClassesDirectory>${basedir}/target/classes/
+ </testClassesDirectory>
+ <includes>
+ <include>**/CommonSuiteTest.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <!-- <execution>-->
+ <!-- <id>store-rocksdb-test</id>-->
+ <!-- <configuration>-->
+ <!-- <testSourceDirectory>${basedir}/src/main/java/-->
+ <!-- </testSourceDirectory>-->
+ <!-- <testClassesDirectory>${basedir}/target/classes/-->
+ <!-- </testClassesDirectory>-->
+ <!-- <includes>-->
+ <!-- <include>**/RocksDbSuiteTest.java</include>-->
+ <!-- </includes>-->
+ <!-- </configuration>-->
+ <!-- </execution>-->
+ <!-- <execution>-->
+ <!-- <id>store-server-test</id>-->
+ <!-- <configuration>-->
+ <!-- <testSourceDirectory>${basedir}/src/main/java/-->
+ <!-- </testSourceDirectory>-->
+ <!-- <testClassesDirectory>${basedir}/target/classes/-->
+ <!-- </testClassesDirectory>-->
+ <!-- <includes>-->
+ <!-- <include>**/ServerSuiteTest.java</include>-->
+ <!-- </includes>-->
+ <!-- <excludes>-->
+ <!-- <exclude>**/node/**/*</exclude>-->
+ <!-- </excludes>-->
+ <!-- </configuration>-->
+ <!-- </execution>-->
+ <!-- <execution>-->
+ <!-- <id>store-raftcore-test</id>-->
+ <!-- <configuration>-->
+ <!-- <testSourceDirectory>${basedir}/src/main/java/-->
+ <!-- </testSourceDirectory>-->
+ <!-- <testClassesDirectory>${basedir}/target/classes/-->
+ <!-- </testClassesDirectory>-->
+ <!-- <includes>-->
+ <!-- <include>**/RaftSuiteTest.java</include>-->
+ <!-- </includes>-->
+ <!-- </configuration>-->
+ <!-- </execution>-->
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.8.4</version>
+ <executions>
+ <execution>
+ <id>pre-test</id>
+
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>report-aggregate</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/site/jacoco</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <excludes>
+ <exclude>**/grpc/**/*</exclude>
+ <exclude>**/jraft/**/*</exclude>
+ <exclude>**/*Iterator*</exclude>
+ <exclude>**/node/**/*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources/</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+</project>
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 0000000..0067b11
--- /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 0000000..afa1f2b
--- /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 0000000..0faf345
--- /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 0000000..092cc80
--- /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 0000000..38ddb1a
--- /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 0000000..0a3aae7
--- /dev/null
+++ b/hugegraph-store/hg-store-test/src/main/resources/log4j2.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<!-- Config will be autoloaded every 60s -->
+<configuration status="error" monitorInterval="60">
+ <properties>
+ <property name="LOG_PATH">logs</property>
+ <property name="FILE_NAME">hg-store-test</property>
+ </properties>
+
+ <appenders>
+ <Console name="console" target="SYSTEM_OUT">
+ <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY" />
+ <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n" />
+ <!--JsonLayout compact="false" locationInfo="true">
+ <KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}"/>
+ </JsonLayout-->
+ </Console>
+
+ <!-- Normal server log config -->
+ <RollingRandomAccessFile name="file" fileName="${LOG_PATH}/${FILE_NAME}.log"
+ filePattern="${LOG_PATH}/$${date:yyyy-MM}/${FILE_NAME}-%d{yyyy-MM-dd}-%i.log"
+ bufferedIO="false" immediateFlush="true">
+ <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY" />
+ <PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} [%t] [%p] %c{1.} - %m%n" />
+ <!--JsonLayout compact="true" eventEol="true" complete="true" locationInfo="true">
+ <KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}"/>
+ </JsonLayout-->
+ <!-- Trigger after exceeding 1day or 50MB -->
+ <Policies>
+ <SizeBasedTriggeringPolicy size="50MB" />
+ <TimeBasedTriggeringPolicy interval="1" modulate="true" />
+ </Policies>
+ <!-- Keep 5 files per day & auto Delete after over 2GB or 100 files -->
+ <DefaultRolloverStrategy max="5">
+ <Delete basePath="${LOG_PATH}" maxDepth="2">
+ <IfFileName glob="*/*.log" />
+ <!-- Limit log amount & size -->
+ <IfAny>
+ <IfAccumulatedFileSize exceeds="2GB" />
+ <IfAccumulatedFileCount exceeds="100" />
+ </IfAny>
+ </Delete>
+ </DefaultRolloverStrategy>
+ </RollingRandomAccessFile>
+
+ <!-- Separate & compress audit log, buffer size is 512KB -->
+ <RollingRandomAccessFile name="audit" fileName="${LOG_PATH}/audit-${FILE_NAME}.log"
+ filePattern="${LOG_PATH}/$${date:yyyy-MM}/audit-${FILE_NAME}-%d{yyyy-MM-dd-HH}-%i.gz"
+ bufferedIO="true" bufferSize="524288" immediateFlush="false">
+ <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY" />
+ <!-- Use simple format for audit log to speed up -->
+ <!-- PatternLayout pattern="%-d{yyyy-MM-dd HH:mm:ss} - %m%n"/ -->
+ <JsonLayout compact="true" eventEol="true" complete="false" locationInfo="true">
+ <KeyValuePair key="timestamp" value="$${date:yyyy-MM-dd HH:mm:ss.SSS}" />
+ </JsonLayout>
+ <!-- Trigger after exceeding 1hour or 500MB -->
+ <Policies>
+ <SizeBasedTriggeringPolicy size="500MB" />
+ <TimeBasedTriggeringPolicy interval="1" modulate="true" />
+ </Policies>
+ <!-- Keep 2 files per hour & auto Delete [after 60 days] or [over 5GB or 500 files] -->
+ <DefaultRolloverStrategy max="2">
+ <Delete basePath="${LOG_PATH}" maxDepth="2">
+ <IfFileName glob="*/*.gz" />
+ <IfLastModified age="60d" />
+ <IfAny>
+ <IfAccumulatedFileSize exceeds="5GB" />
+ <IfAccumulatedFileCount exceeds="500" />
+ </IfAny>
+ </Delete>
+ </DefaultRolloverStrategy>
+ </RollingRandomAccessFile>
+ </appenders>
+
+ <loggers>
+ <logger name="io.grpc.netty" level="ERROR" additivity="false">
+ <appender-ref ref="file" />
+ </logger>
+ <root level="INFO">
+ <appender-ref ref="console" />
+ <appender-ref ref="file" />
+ </root>
+
+ </loggers>
+</configuration>
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 0000000..5608dc9
--- /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 0000000..b55f108
--- /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