Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

add auth backup and auth restore #76

Merged
merged 26 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
373baa7
add auth backup and auth restore
xuliguov5 Nov 30, 2020
b1f53bb
update some code format
xuliguov5 Nov 30, 2020
5e42e78
Add functional tests for auth backup and restore
xuliguov5 Dec 1, 2020
9c1f61b
update auth restore format
xuliguov5 Dec 1, 2020
038980c
add travis for tools
xuliguov5 Dec 1, 2020
cfc5f5a
update some format and some code optimization
xuliguov5 Dec 3, 2020
a984e85
update some format and code optimization
xuliguov5 Dec 4, 2020
8bb22f7
update code format
xuliguov5 Dec 7, 2020
7ae2624
Update and optimize code format
xuliguov5 Dec 8, 2020
0021560
Update and optimize code format
xuliguov5 Dec 9, 2020
2158524
Update and optimize some code
xuliguov5 Dec 10, 2020
1e6fde0
Update and optimize some code
xuliguov5 Dec 11, 2020
0e569ac
Add inner class for auth restore
xuliguov5 Dec 14, 2020
fdf2512
Update and optimize some code
xuliguov5 Dec 14, 2020
a6eb1d9
Update and optimize some code
xuliguov5 Dec 16, 2020
00df91d
Update and optimize auth backup
xuliguov5 Dec 17, 2020
7292549
Update and optimize some code
xuliguov5 Dec 17, 2020
b84753b
Update and optimize some code
xuliguov5 Dec 18, 2020
65f03fa
Update and optimized some code
xuliguov5 Dec 21, 2020
d11a231
Update and optimize some code
xuliguov5 Dec 23, 2020
4b9e59d
Opdate and optimize some code
xuliguov5 Dec 25, 2020
4c3d5c5
add checkstyle for code
xuliguov5 Dec 25, 2020
81aaed2
Optimize some code
xuliguov5 Dec 28, 2020
57d3eb9
Update retry description to lower case
xuliguov5 Jan 4, 2021
4079bd3
Update and optimize some code
xuliguov5 Jan 4, 2021
3589982
Update the first code after the ‘.’ to uppercase
xuliguov5 Jan 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: java

jdk:
- openjdk8

sudo: required

branches:
only:
- master
- /^release-.*$/
- /^test-.*$/

install: mvn compile -Dmaven.javadoc.skip=true | grep -v "Downloading\|Downloaded"

before_script:
- $TRAVIS_DIR/install-hugegraph.sh $TRAVIS_BRANCH | grep -v "Downloading\|Downloaded"

script:
- mvn test -Dtest=FuncTestSuite

after_success:
- bash <(curl -s https://codecov.io/bash)

env:
global:
- TRAVIS_DIR=assembly/travis
110 changes: 110 additions & 0 deletions assembly/travis/conf/gremlin-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# host and port of gremlin server, need to be consistent with host and port in rest-server.properties
#host: 127.0.0.1
#port: 8182

# timeout in ms of gremlin query
scriptEvaluationTimeout: 30000

channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer
graphs: {
hugegraph: conf/hugegraph.properties
}
scriptEngines: {
gremlin-groovy: {
plugins: {
com.baidu.hugegraph.plugin.HugeGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
classImports: [
java.lang.Math,
com.baidu.hugegraph.backend.id.IdGenerator,
com.baidu.hugegraph.type.define.Directions,
com.baidu.hugegraph.type.define.NodeRole,
com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser,
com.baidu.hugegraph.traversal.algorithm.CountTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser,
com.baidu.hugegraph.traversal.algorithm.CustomizePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser,
com.baidu.hugegraph.traversal.algorithm.HugeTraverser,
com.baidu.hugegraph.traversal.algorithm.JaccardSimilarTraverser,
com.baidu.hugegraph.traversal.algorithm.KneighborTraverser,
com.baidu.hugegraph.traversal.algorithm.KoutTraverser,
com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.NeighborRankTraverser,
com.baidu.hugegraph.traversal.algorithm.PathsTraverser,
com.baidu.hugegraph.traversal.algorithm.PersonalRankTraverser,
com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser,
com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser,
com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser,
com.baidu.hugegraph.traversal.algorithm.TemplatePathsTraverser,
com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.RepeatEdgeStep,
com.baidu.hugegraph.traversal.algorithm.steps.WeightedEdgeStep,
com.baidu.hugegraph.traversal.optimize.Text,
com.baidu.hugegraph.traversal.optimize.TraversalUtil,
com.baidu.hugegraph.util.DateUtil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged, rebase

],
methodImports: [java.lang.Math#*]
},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
files: [scripts/empty-sample.groovy]
}
}
}
}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
metrics: {
consoleReporter: {enabled: false, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: false},
slf4jReporter: {enabled: false, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}
}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false
}
authentication: {
authenticator: com.baidu.hugegraph.auth.StandardAuthenticator,
authenticationHandler: com.baidu.hugegraph.auth.WsAndHttpBasicAuthHandler,
config: {tokens: conf/rest-server.properties}
}
68 changes: 68 additions & 0 deletions assembly/travis/conf/hugegraph.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# gremlin entrence to create graph
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# cache config
#schema.cache_capacity=100000
# vertex-cache default is 1000w, 10min expired
#vertex.cache_capacity=10000000
#vertex.cache_expire=600
# edge-cache default is 100w, 10min expired
#edge.cache_capacity=1000000
#edge.cache_expire=600


# schema illegal name template
#schema.illegal_name_regex=\s+|~.*

#vertex.default_label=vertex

backend=rocksdb
serializer=binary

store=hugegraph

search.text_analyzer=jieba
search.text_analyzer_mode=INDEX

# rocksdb backend config
#rocksdb.data_path=/path/to/disk
#rocksdb.wal_path=/path/to/disk


# cassandra backend config
cassandra.host=localhost
cassandra.port=9042
cassandra.username=
cassandra.password=
#cassandra.connect_timeout=5
#cassandra.read_timeout=20
#cassandra.keyspace.strategy=SimpleStrategy
#cassandra.keyspace.replication=3

# hbase backend config
#hbase.hosts=localhost
#hbase.port=2181
#hbase.znode_parent=/hbase
#hbase.threads_max=64

# mysql backend config
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://127.0.0.1:3306
#jdbc.username=root
#jdbc.password=
#jdbc.reconnect_max_times=3
#jdbc.reconnect_interval=3
#jdbc.sslmode=false

# palo backend config
#palo.host=127.0.0.1
#palo.poll_interval=10
#palo.temp_dir=./palo-data
#palo.file_limit_size=32

# postgresql & cockroachdb backend config
#jdbc.driver=org.postgresql.Driver
#jdbc.url=jdbc:postgresql://localhost:5432/
#jdbc.username=postgres
#jdbc.password=
#jdbc.postgresql.connect_database=template1
12 changes: 12 additions & 0 deletions assembly/travis/conf/rest-server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# bind url
restserver.url=http://127.0.0.1:8080
# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
#gremlinserver.url=http://127.0.0.1:8182

# graphs list with pair NAME:CONF_PATH
graphs=[hugegraph:conf/hugegraph.properties]

# authentication
auth.authenticator=com.baidu.hugegraph.auth.StandardAuthenticator
#auth.admin_token=
#auth.user_tokens=[]
45 changes: 45 additions & 0 deletions assembly/travis/install-hugegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -ev

TRAVIS_DIR=`dirname $0`

if [ $# -ne 1 ]; then
echo "Must pass base branch name of pull request"
exit 1
fi

CLIENT_BRANCH=$1
HUGEGRAPH_BRANCH=$CLIENT_BRANCH

HUGEGRAPH_GIT_URL="https://github.com/hugegraph/hugegraph.git"

git clone $HUGEGRAPH_GIT_URL

cd hugegraph

git checkout $HUGEGRAPH_BRANCH

mvn package -DskipTests

mv hugegraph-*.tar.gz ../

cd ../

rm -rf hugegraph

tar -zxvf hugegraph-*.tar.gz

HTTPS_SERVER_DIR="hugegraph_https"

mkdir $HTTPS_SERVER_DIR

cp -r hugegraph-*/. $HTTPS_SERVER_DIR

cd hugegraph-*

cp ../$TRAVIS_DIR/conf/* conf

echo -e "123456" | bin/init-store.sh

bin/start-hugegraph.sh
87 changes: 87 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--参考:https://checkstyle.sourceforge.io/checks.html-->
<module name="Checker">
<!--检查不通过时被判定的违规级别,必须修复后才能使build通过-->
<property name="severity" value="error"/>
<!--对java文件做检查-->
<property name="fileExtensions" value="java"/>
<!--对UTF-8编码的文件做检查-->
<property name="charset" value="UTF-8"/>
<!--文件中不允许包含制表符-->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!--检查java源文件并定义一些适用于检查此类文件的一些属性-->
<module name="TreeWalker">
<!--检查行长度-->
<module name="LineLength">
<property name="max" value="80"/>
<!--可以忽略的行-->
<property name="ignorePattern"
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<!--检查没有import语句使用*号-->
<module name="AvoidStarImport"/>
<!--检查是否存在多余的import语句,比如重复的,java自带的包,相同包下的其他类-->
<module name="RedundantImport"/>
<!--检查是否存在没有使用的import语句-->
<module name="UnusedImports"/>
<!--检查包名称是否遵守命名规约-->
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
</module>
<!--检查局部变量的名称是否遵守命名规约-->
<module name="LocalVariableName">
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
</module>
<!--检查成员变量(非静态字段)的名称是否遵守命名规约-->
<module name="MemberName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!--检查方法名称是否遵守命名规约-->
<module name="MethodName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!--检查参数名称是否遵守命名规约-->
<module name="ParameterName">
<property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
</module>
<!--检查常量(用static final修饰的字段)的名称是否遵守命名规约-->
<module name="ConstantName">
<property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/>
</module>
<!--检查数组是否属于java风格,方括号放在类型后面,而不是变量后面,比如:int[] nums(合法),int nums[](不合法)-->
<module name="ArrayTypeStyle">
<property name="javaStyle" value="true"/>
</module>
<!--long类型的字面量如果要以"L"结尾,必须是大写的"L",而非小写的"l"-->
<module name="UpperEll"/>
<!--代码换行时,运算符必须在当前行的末尾,比如:+、&&、?、: 等-->
<module name="OperatorWrap">
<property name="option" value="eol"/>
</module>
<!--检查指定标记的周围是否有空格,比如:if、for、while、synchoronized 等-->
<module name="WhitespaceAround"/>
<!--检查修饰符是否符合Java建议,顺序是:public、protected、private、abstract、default、static、final、transient、volatile、synchronized、native、strictfp-->
<module name="ModifierOrder"/>
<!--检查代码块的左花括号的放置位置,必须在当前行的末尾-->
<module name="LeftCurly">
<property name="option" value="eol"/>
<property name="ignoreEnums" value="false"/>
</module>
<!--代码中不允许有空语句,也就是单独的;符号-->
<module name="EmptyStatement"/>
<!--覆盖equals()方法的类必须也覆盖了hashCode()方法-->
<module name="EqualsHashCode"/>
<!--switch语句必须含有default子句-->
<module name="MissingSwitchDefault"/>
<!--switch语句的default必须放在所有的case分支之后-->
<module name="DefaultComesLast"/>
<!--覆盖clone()方法时调用了super.clone()方法-->
<module name="SuperClone"/>
</module>
</module>
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,28 @@
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
Expand Down
Loading